From 57c5a7db615cf2eed6fceb73e4a1e49d1e19cfc2 Mon Sep 17 00:00:00 2001 From: red Date: Wed, 9 Apr 2025 11:42:12 -0400 Subject: [PATCH] update init procedure --- manifests/pleroma/deployment.yaml.template | 17 ++--------------- pleroma/Dockerfile | 1 + pleroma/init-pleroma.sh | 4 ++++ 3 files changed, 7 insertions(+), 15 deletions(-) create mode 100644 pleroma/init-pleroma.sh diff --git a/manifests/pleroma/deployment.yaml.template b/manifests/pleroma/deployment.yaml.template index a6c7c0e..daf2cb8 100644 --- a/manifests/pleroma/deployment.yaml.template +++ b/manifests/pleroma/deployment.yaml.template @@ -17,22 +17,9 @@ spec: imagePullSecrets: - name: registry-credentials initContainers: - - name: pleroma-static-files + - name: pleroma-init image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA} - command: [ "sh", "-c", "mkdir -p ${DATA}/uploads && mkdir -p ${DATA}/static && cp -rf /static-files/* ${DATA}/static && chown -R 1000:1000 /var/lib/pleroma" ] - - name: pleroma-database-wait - image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA} - command: [ "sh", "-c", "while ! pg_isready -U ${DB_USER} -d postgres://${DB_HOST}:${DB_PORT}/${DB_NAME} -t 1; do sleep 1s; done;" ] - env: - - name: DB_HOST - value: postgres - - name: DB_NAME - value: pleroma - - name: DB_USER - value: pleroma - - name: pleroma-migrate - image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA} - command: [ "sh", "-c", "exec", "${HOME}/bin/pleroma_ctl migrate" ] + command: [ "/init-pleroma.sh" ] containers: - name: pleroma image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA} diff --git a/pleroma/Dockerfile b/pleroma/Dockerfile index 008a8de..e8baf6b 100644 --- a/pleroma/Dockerfile +++ b/pleroma/Dockerfile @@ -25,6 +25,7 @@ RUN rm -r /tmp/release RUN rm /tmp/pleroma.zip COPY --chmod=0764 --chown=pleroma:pleroma ./static-files/ /static-files/ +COPY --chmod=0755 --chown=pleroma:pleroma ./init-pleroma.sh / COPY --chmod=0755 --chown=pleroma:pleroma ./docker-entrypoint.sh ${HOME} EXPOSE 4000 diff --git a/pleroma/init-pleroma.sh b/pleroma/init-pleroma.sh new file mode 100644 index 0000000..1ecae95 --- /dev/null +++ b/pleroma/init-pleroma.sh @@ -0,0 +1,4 @@ +#!/bin/sh +while ! pg_isready -U ${DB_USER} -d postgres://${DB_HOST}:${DB_PORT}/${DB_NAME} -t 1; do sleep 1s; done; +mkdir -p ${DATA}/uploads && mkdir -p ${DATA}/static && cp -rf /static-files/* ${DATA}/static && chown -R 1000:1000 ${DATA} +exec "${HOME}/bin/pleroma_ctl migrate" \ No newline at end of file