Update Nextcloud configuration and dependencies

This commit is contained in:
2024-10-06 01:45:58 +02:00
parent 90852bb9a6
commit cae03aa746
6 changed files with 69 additions and 10 deletions
+15
View File
@@ -3,3 +3,18 @@
This is part of A13Labs project, any unauthorized copy is no allowed. If you got access to this This is part of A13Labs project, any unauthorized copy is no allowed. If you got access to this
code DELETE immediately. We have been warned. code DELETE immediately. We have been warned.
# Updating Nextcloud
```
# Enable maintenance
/bin/occ maintenance:mode --on
# Update config.tf
# Apply
# Run maintenance operations
./bin/occ upgrade
./bin/occ db:add-missing-columns
./bin/occ db:add-missing-indices
./bin/occ db:add-missing-primary-keys
# Disable maintenance
./bin/occ maintenance:mode --off
```
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
POD_NAME=$(kubectl get pods -n nextcloud -l app=nextcloud -o jsonpath="{.items[0].metadata.name}")
kubectl -n nextcloud exec -it $POD_NAME -- /bin/su -s /bin/bash www-data -c "/var/www/html/occ $*"
+2 -2
View File
@@ -6,12 +6,12 @@ locals {
wordpress_sql_backup_cron_schedule = "0 2 * * *" wordpress_sql_backup_cron_schedule = "0 2 * * *"
wordpress_files_backup_cron_schedule = "10 2 * * *" wordpress_files_backup_cron_schedule = "10 2 * * *"
gitea_version = "1.21.3" gitea_version = "1.22.2"
gitea_fqdn = "code.alexpires.me" gitea_fqdn = "code.alexpires.me"
gitea_sql_backup_cron_schedule = "20 2 * * *" gitea_sql_backup_cron_schedule = "20 2 * * *"
gitea_files_backup_cron_schedule = "30 2 * * *" gitea_files_backup_cron_schedule = "30 2 * * *"
nextcloud_version = "28.0.7-apache" nextcloud_version = "30.0.0-apache"
nextcloud_fqdn = "cloud.alexpires.me" nextcloud_fqdn = "cloud.alexpires.me"
nextcloud_sql_backup_cron_schedule = "40 2 * * *" nextcloud_sql_backup_cron_schedule = "40 2 * * *"
nextcloud_files_backup_cron_schedule = "50 2 * * *" nextcloud_files_backup_cron_schedule = "50 2 * * *"
+34 -8
View File
@@ -29,6 +29,9 @@ locals {
OVERWRITEHOST = local.nextcloud_fqdn OVERWRITEHOST = local.nextcloud_fqdn
OVERWRITEPROTOCOL = "https" OVERWRITEPROTOCOL = "https"
OVERWRITECLIURL = "https://${local.nextcloud_fqdn}" OVERWRITECLIURL = "https://${local.nextcloud_fqdn}"
# PHP
PHP_MEMORY_LIMIT = "512M"
} }
nextcloud_secrets = { nextcloud_secrets = {
@@ -134,6 +137,18 @@ resource "kubernetes_secret" "nextcloud_admin_credentials" {
type = "Opaque" type = "Opaque"
} }
resource "kubernetes_config_map" "nextcloud_apache_config" {
metadata {
name = "nextcloud-apache-config"
namespace = kubernetes_namespace.nextcloud.metadata[0].name
}
data = {
"99-nextcloudworkers.conf" = file("${path.module}/resources/apache2/99-nextcloudworkers.conf")
"99-compression.conf" = file("${path.module}/resources/apache2/99-compression.conf")
}
}
# #
# Setup MariaDB database # Setup MariaDB database
# #
@@ -291,14 +306,6 @@ resource "kubernetes_deployment" "nextcloud_redis" {
name = "redis" name = "redis"
image = "redis:latest" image = "redis:latest"
resources {
requests = {
memory = "20Mi"
}
limits = {
memory = "50Mi"
}
}
security_context { security_context {
allow_privilege_escalation = false allow_privilege_escalation = false
} }
@@ -428,6 +435,19 @@ resource "kubernetes_deployment" "nextcloud_apache" {
mount_path = "/var/www/html" mount_path = "/var/www/html"
name = "persistent-storage" name = "persistent-storage"
} }
volume_mount {
mount_path = "/etc/apache2/conf-enabled/99-nextcloudworkers.conf"
name = "apache-config"
sub_path = "99-nextcloudworkers.conf"
read_only = true
}
volume_mount {
mount_path = "/etc/apache2/conf-enabled/99-compression.conf"
name = "apache-config"
sub_path = "99-compression.conf"
read_only = true
}
} }
volume { volume {
name = "persistent-storage" name = "persistent-storage"
@@ -435,6 +455,12 @@ resource "kubernetes_deployment" "nextcloud_apache" {
path = local.nextcloud_path path = local.nextcloud_path
} }
} }
volume {
name = "apache-config"
config_map {
name = kubernetes_config_map.nextcloud_apache_config.metadata[0].name
}
}
} }
} }
} }
@@ -0,0 +1,14 @@
<IfModule mod_deflate.c>
# Enable compression for the following content types
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/xml
</IfModule>
# Do not compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|webp|woff|woff2)$ no-gzip
@@ -0,0 +1 @@
MaxRequestWorkers 10