rework how plugins are installed

This commit is contained in:
Girish Ramakrishnan 2022-03-07 21:08:39 -08:00
parent b50103ed0d
commit 867fc4e9e4
2 changed files with 10 additions and 5 deletions

View file

@ -14,8 +14,7 @@ ARG VERSION=4.1.0
# the transcoding patch is at https://github.com/Chocobozzz/PeerTube/pull/3198 # 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 - && \ 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 && \ 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 && \ 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
RUN mkdir /app/code/cli && \ 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 && \ curl -L https://github.com/Chocobozzz/PeerTube/archive/v${VERSION}.tar.gz | tar -zxvf - --strip-components=1 -C /app/code/cli && \

View file

@ -15,19 +15,25 @@ update_ldap() {
} }
first_time_setup() { 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 sleep 10
while ! curl --silent --output /dev/null --fail http://localhost:9000/; do 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 sleep 5
done done
kill -SIGTERM ${peertube_pid} # this kills the process group
echo "==> Reset root password" echo "==> Reset root password"
echo "changeme" | npm run reset-password -- -u root 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 if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
echo "==> Installing LDAP plugin" 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 update_ldap
fi fi
} }
@ -68,7 +74,7 @@ if [[ ! -f "/app/data/production.yaml" ]]; then
cp /app/pkg/production.yaml.example /app/data/production.yaml cp /app/pkg/production.yaml.example /app/data/production.yaml
update_config update_config
first_time_setup & first_time_setup
else else
update_config update_config