From 867fc4e9e477acfcbc24123107816b11fef97eb0 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 7 Mar 2022 21:08:39 -0800 Subject: [PATCH] rework how plugins are installed --- Dockerfile | 3 +-- start.sh | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3245518..fbd5bed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,7 @@ ARG VERSION=4.1.0 # the transcoding patch is at https://github.com/Chocobozzz/PeerTube/pull/3198 RUN curl -sL https://github.com/Chocobozzz/PeerTube/releases/download/v${VERSION}/peertube-v${VERSION}.tar.xz | tar --strip-components 1 -Jxvf - && \ yarn install --production --pure-lockfile && \ - sed -e 's/niceness: constants_1.FFMPEG_NICE.TRANSCODING/niceness: constants_1.FFMPEG_NICE.TRANSCODING, cwd: config_1.CONFIG.STORAGE.TMP_DIR/' -i /app/code/server/dist/server/helpers/ffmpeg-utils.js && \ - chown -R cloudron:cloudron /app/code/server + sed -e 's/niceness: constants_1.FFMPEG_NICE.TRANSCODING/niceness: constants_1.FFMPEG_NICE.TRANSCODING, cwd: config_1.CONFIG.STORAGE.TMP_DIR/' -i /app/code/server/dist/server/helpers/ffmpeg-utils.js RUN mkdir /app/code/cli && \ curl -L https://github.com/Chocobozzz/PeerTube/archive/v${VERSION}.tar.gz | tar -zxvf - --strip-components=1 -C /app/code/cli && \ diff --git a/start.sh b/start.sh index 51245ac..6ad486b 100755 --- a/start.sh +++ b/start.sh @@ -15,19 +15,25 @@ 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 + peertube_pid=$! sleep 10 while ! curl --silent --output /dev/null --fail http://localhost:9000/; do - echo "==> (reset root password) Waiting for peertube to initialize..." + echo "==> Waiting for peertube" sleep 5 done + kill -SIGTERM ${peertube_pid} # this kills the process group + echo "==> Reset root password" echo "changeme" | npm run reset-password -- -u root + # 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" - cd /app/code/cli && node dist/server/tools/peertube.js plugins install -n peertube-plugin-auth-ldap --url "${CLOUDRON_APP_ORIGIN}" --username root --password changeme + npm run plugin:install -- -n peertube-plugin-auth-ldap -v 0.0.10 update_ldap fi } @@ -68,7 +74,7 @@ if [[ ! -f "/app/data/production.yaml" ]]; then cp /app/pkg/production.yaml.example /app/data/production.yaml update_config - first_time_setup & + first_time_setup else update_config