Fix issue where initial credentials are not working

This commit is contained in:
Girish Ramakrishnan 2023-07-11 09:25:21 +05:30
parent c91051c145
commit 73730f82fe

View file

@ -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