From d29835c146c5841a1178f3cf3232c8c72e5a1b0b Mon Sep 17 00:00:00 2001 From: default Date: Fri, 5 Jun 2026 23:20:26 +0000 Subject: [PATCH] fix(deploy): seed docker-compose.yml and supabase/ into APP_DIR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same first-deploy bootstrap pattern as .env.example: 'Start Docker stack' needs docker-compose.yml at $APP_DIR for 'docker compose up', and 'Apply migrations' needs supabase/migrations/ at $APP_DIR for psql. Neither was copied there until the 'Deploy' step runs at the end of the job — so the first deploy on a fresh host fails before any runtime file is ever placed. Each step now seeds the file/dir it needs from the workspace before using it. The 'Deploy' step's later copy remains as a refresh for subsequent deploys. --- .gitea/workflows/deploy.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 2957e94..48af1c7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -28,8 +28,9 @@ jobs: run: | APP_DIR=/home/tyler/route-commerce mkdir -p $APP_DIR - # Seed .env.example into APP_DIR if missing (it lives in the repo, not in APP_DIR) + # Seed config files into APP_DIR if missing (they live in the repo, not in APP_DIR) [ -f $APP_DIR/.env.example ] || cp .env.example $APP_DIR/.env.example + [ -f $APP_DIR/docker-compose.yml ] || cp docker-compose.yml $APP_DIR/docker-compose.yml cd $APP_DIR [ -f .env ] || cp .env.example .env # Append production secrets to .env (overriding .env.example defaults) @@ -57,7 +58,11 @@ jobs: POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} POSTGRES_DB: ${{ secrets.POSTGRES_DB }} run: | - cd /home/tyler/route-commerce + APP_DIR=/home/tyler/route-commerce + # Seed supabase/ into APP_DIR if missing (the deploy step copies it after, but + # we need it here for migrations) + [ -d $APP_DIR/supabase ] || cp -r supabase $APP_DIR/supabase + cd $APP_DIR PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -f supabase/migrations/000_preflight_supabase_compat.sql || true [ -f supabase/captured_schema.sql ] && PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -f supabase/captured_schema.sql || echo "captured_schema.sql not present, skipping" for f in supabase/migrations/[0-9]*.sql; do