Browse Source

fix: [nextcloud] move nextcloud php config files towards datastore

This makes sense as it is modifiable by the web interface, and holds
unique information we want to backup and we can't regenerate.
upd
Valentin Lab 3 months ago
parent
commit
03a869b0a0
  1. 7
      nextcloud/actions/upgrade
  2. 22
      nextcloud/hooks/init
  3. 5
      nextcloud/lib/common
  4. 2
      nextcloud/metadata.yml

7
nextcloud/actions/upgrade

@ -56,7 +56,12 @@ while [ "$1" ]; do
done
nextcloud:config:version() {
cat "$SERVICE_CONFIGSTORE/var/www/html/config/config.php" |
for f in {"$SERVICE_CONFIGSTORE","$SERVICE_DATASTORE"}/var/www/html/config/config.php; do
if [ -e "$f" ]; then
cat "$f"
break
fi
done |
grep "'version' =>" |
cut -f 4 -d \' |
cut -f 1-3 -d .

22
nextcloud/hooks/init

@ -19,6 +19,28 @@ admin_user=$(options-get admin.user 2>&1) || {
admin_user="admin"
}
OLD_CONFIGDIR="$SERVICE_CONFIGSTORE/var/www/html/config"
if [ -d "$OLD_CONFIGDIR" ]; then
info "Old config directory found"
if [ -d "$CONFIGDIR" ]; then
if ! dir_is_empty "$CONFIGDIR"; then
err "Both old and new config directories found"
exit 1
fi
rmdir "$CONFIGDIR" || {
err "Failed to remove new (empty) config directory"
exit 1
}
fi
mkdir -p "${CONFIGDIR%/*}" || exit 1
mv -v "$OLD_CONFIGDIR" "$CONFIGDIR" || {
err "Failed to move old config directory to new location"
exit 1
}
fi
first_run=0
read-0 current_user current_password < <(get_admin_user_password) || {
info "Probably no admin user and password set before."

5
nextcloud/lib/common

@ -8,7 +8,8 @@ PASSWORD_FILE="$SERVICE_CONFIGSTORE/etc/$SERVICE_NAME/pass"
## Used to check existence and make direct changes when 'occ' command
## can't do it properly.
CONFIGFILE="$SERVICE_CONFIGSTORE/var/www/html/config/config.php"
CONFIGDIR="$SERVICE_DATASTORE/var/www/html/config"
CONFIGFILE="$CONFIGDIR/config.php"
has_user() {
@ -145,7 +146,7 @@ nextcloud:config:simple:add() {
local key="$1" value="$2"
create_occ_if_not_exists || return 1
if ![ -e "$CONFIGFILE" ]; then
if ! [ -e "$CONFIGFILE" ]; then
err "Config file '$CONFIGFILE' does not exist."
return 1
fi

2
nextcloud/metadata.yml

@ -2,8 +2,6 @@ docker-image: docker.0k.io/nextcloud:18.0.1-myc
data-resources:
- /var/www/html
- /var/lib/nextcloud/data
config-resources:
- /var/www/html/config
provides:
nextcloud-app:
uses:

Loading…
Cancel
Save