From b249cf2000126cedc012f86af6f51bfac8755741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joe=20K=C3=BCng?= Date: Wed, 11 Feb 2026 15:21:41 +0100 Subject: [PATCH] feat(deploy): fix deploy ports --- .gitea/workflows/cicd.yaml | 18 ++++++++++++++---- deploy/envs/dev.env | 2 +- deploy/envs/int.env | 2 +- deploy/envs/prod.env | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/cicd.yaml b/.gitea/workflows/cicd.yaml index f6216b3..f764cb7 100644 --- a/.gitea/workflows/cicd.yaml +++ b/.gitea/workflows/cicd.yaml @@ -132,9 +132,13 @@ jobs: ssh-keyscan -H "${{ secrets.SERVER_HOST }}" >> ~/.ssh/known_hosts 2>/dev/null - - name: Write DB env on server + - name: Write env to server shell: bash run: | + # 1. Start with the static env file content + cat "deploy/envs/${{ env.ENV }}.env" > /tmp/full_env.env + + # 2. Determine DB credentials if [[ "${{ env.ENV }}" == "prod" ]]; then DB_URL="${{ secrets.DB_URL_PROD }}" DB_USER="${{ secrets.DB_USERNAME_PROD }}" @@ -149,11 +153,17 @@ jobs: DB_PASS="${{ secrets.DB_PASSWORD_DEV }}" fi - printf 'DB_URL=%s\nDB_USERNAME=%s\nDB_PASSWORD=%s\n' \ - "$DB_URL" "$DB_USER" "$DB_PASS" > /tmp/pc.env + # 3. Append DB credentials + printf '\nDB_URL=%s\nDB_USERNAME=%s\nDB_PASSWORD=%s\n' \ + "$DB_URL" "$DB_USER" "$DB_PASS" >> /tmp/full_env.env + # 4. Debug: print content (for debug purposes) + echo "Preparing to send env file with variables:" + grep -v "PASSWORD" /tmp/full_env.env || true + + # 5. Send to server ssh -i ~/.ssh/id_ed25519 -o BatchMode=yes "${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}" \ - "setenv ${{ env.ENV }}" < /tmp/pc.env + "setenv ${{ env.ENV }}" < /tmp/full_env.env - name: Trigger deploy on Unraid (forced command key) shell: bash diff --git a/deploy/envs/dev.env b/deploy/envs/dev.env index b9d6a9b..882f235 100644 --- a/deploy/envs/dev.env +++ b/deploy/envs/dev.env @@ -1,5 +1,5 @@ REGISTRY_URL=git.joekung.ch -REPO_OWNER=JoeKung +REPO_OWNER=joekung ENV=dev TAG=dev diff --git a/deploy/envs/int.env b/deploy/envs/int.env index ccb53a7..a992134 100644 --- a/deploy/envs/int.env +++ b/deploy/envs/int.env @@ -1,5 +1,5 @@ REGISTRY_URL=git.joekung.ch -REPO_OWNER=JoeKung +REPO_OWNER=joekung ENV=int TAG=int diff --git a/deploy/envs/prod.env b/deploy/envs/prod.env index 41c49dd..644d444 100644 --- a/deploy/envs/prod.env +++ b/deploy/envs/prod.env @@ -1,5 +1,5 @@ REGISTRY_URL=git.joekung.ch -REPO_OWNER=JoeKung +REPO_OWNER=joekung ENV=prod TAG=prod