Add upgrade script

This commit is contained in:
Micke Nordin 2023-04-03 09:46:00 +02:00
parent 3fe3331add
commit 274a4597bb
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
2 changed files with 19 additions and 1 deletions

View file

@ -171,3 +171,12 @@ data:
),
);
nc-upgrade.sh: |
#!/bin/bash
sed "s/config_is_read_only\(.\) => true,/config_is_read_only\1 => false,/" /var/www/html/config/config.php > /var/www/html/config/config.php.tmp
mv /var/www/html/config/config.php.tmp /var/www/html/config/config.php
php -d apc.enable_cli=1 -d memory_limit=-1 /var/www/html/occ upgrade
php -d apc.enable_cli=1 -d memory_limit=-1 /var/www/html/occ maintenance:repair
php -d apc.enable_cli=1 -d memory_limit=-1 /var/www/html/occ maintenance:mode --off
sed "s/config_is_read_only\(.\) => false,/config_is_read_only\1 => true,/" /var/www/html/config/config.php > /var/www/html/config/config.php.tmp
mv /var/www/html/config/config.php.tmp /var/www/html/config/config.php

View file

@ -39,6 +39,8 @@ spec:
subPath: 000-default.conf
- name: hugepage
mountPath: /dev/hugepages
- name: nc-upgrade
mountPath: /usr/local/bin/nc-upgrade
resources:
limits:
cpu: 1500m
@ -66,7 +68,7 @@ spec:
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "php -d apc.enable_cli=1 -d memory_limit=-1 /var/www/html/occ upgrade"]
command: ["/bin/bash", "-c", "/usr/local/bin/nc-upgrade"]
initContainers:
- image: docker.sunet.se/sunet/docker-jinja:latest
name: init-config
@ -173,6 +175,13 @@ spec:
items:
- key: "config.php"
path: "config.php"
- name: nc-upgrade
configMap:
name: nextcloud-configmap
items:
- key: "nc-upgrade.sh"
path: "nc-upgrade.sh"
defaultMode: 0744
- name: default-config
configMap:
name: nextcloud-configmap