From 73730f82fec3d288af14a48220fa723a19fab9ca Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 11 Jul 2023 09:25:21 +0530 Subject: [PATCH] Fix issue where initial credentials are not working --- start.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/start.sh b/start.sh index 908e0bb..bd1e7fb 100755 --- a/start.sh +++ b/start.sh @@ -16,7 +16,7 @@ update_ldap() { first_time_setup() { echo "==> Starting peertube to run migrations on first run" - npm start & # be wary of https://stackoverflow.com/questions/70738567/why-does-running-npm-run-script-as-root-switch-user + gosu cloudron:cloudron npm start & # be wary of https://stackoverflow.com/questions/70738567/why-does-running-npm-run-script-as-root-switch-user sleep 10 while ! curl --silent --output /dev/null --fail http://localhost:9000/; do @@ -28,14 +28,17 @@ first_time_setup() { sleep 5 echo "==> Reset root password" - echo "changeme" | npm run reset-password -- -u root + echo "changeme" | gosu cloudron:cloudron npm run reset-password -- -u root + sleep 5 # the above command seems to spawn a separate process to change password in background # https://docs.joinpeertube.org/maintain-tools?id=cli-wrapper . Note that we have to restart peertube when installed this way if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then echo "==> Installing LDAP plugin" - npm run plugin:install -- -n peertube-plugin-auth-ldap -v 0.0.10 + gosu cloudron:cloudron npm run plugin:install -- -n peertube-plugin-auth-ldap -v 0.0.10 update_ldap fi + + echo "==> First time setup complete" } update_config() { @@ -76,6 +79,9 @@ update_config() { yq eval ".storage.tmp_persistent = \"/app/data/storage/tmp_persistent/\"" -i /app/data/production.yaml } +echo "==> Changing ownership" +chown -R cloudron:cloudron /app/data /run/peertube /tmp/peertube + # cd /var/www/peertube/peertube-latest/scripts && sudo -H -u peertube ./upgrade.sh if [[ ! -f "/app/data/production.yaml" ]]; then echo "==> First run. creating config" @@ -89,7 +95,5 @@ else [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]] && update_ldap fi -chown -R cloudron:cloudron /app/data /run/peertube /tmp/peertube - echo "==> Starting PeerTube" exec gosu cloudron:cloudron npm start