Commit be382970 authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Enable automated prod deploy on push to main

Re-enables the deploy_prod job (and its stage) that's been fully built
and ready since the read-only-rootfs fix, just deliberately left off
until now. Fires automatically once the test job passes on main; deploy.sh
itself handles the rest (bootstrap or update, migrations, systemd
restart, health check).
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent 12603c89
Pipeline #1170 passed with stage
in 14 minutes and 16 seconds
stages: stages:
- test - test
# - deploy # re-enable (and uncomment deploy_prod below) once we're ready to cut a beta/1.0 - deploy
variables: variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
...@@ -12,9 +12,8 @@ cache: ...@@ -12,9 +12,8 @@ cache:
- .cache/pip/ - .cache/pip/
- .cache/ffmpeg-static/ - .cache/ffmpeg-static/
# Runs on every push to dev or main. Auto-deploy-on-merge-to-main is deliberately disabled # Runs on every push to dev or main. deploy_prod below fires automatically once this passes on
# right now (see deploy_prod below, commented out) - only deploy manually until we reach a # main.
# beta/1.0 we actually want live.
test: test:
stage: test stage: test
image: python:3.10-slim image: python:3.10-slim
...@@ -52,44 +51,41 @@ test: ...@@ -52,44 +51,41 @@ test:
- dev - dev
- main - main
# DISABLED until we're ready to cut a beta/1.0 - merges to main no longer auto-deploy to prod.
# To re-enable: uncomment this whole job plus the `- deploy` stage above.
#
# Only ever runs on main, and fires automatically once the test job above passes. Copies the # Only ever runs on main, and fires automatically once the test job above passes. Copies the
# repo's current deploy.sh onto prod and runs it there over SSH - deploy.sh itself handles # repo's current deploy.sh onto prod and runs it there over SSH - deploy.sh itself handles
# everything else (bootstrapping a bare box, or updating an already-deployed one). # everything else (bootstrapping a bare box, or updating an already-deployed one).
# deploy_prod: deploy_prod:
# stage: deploy stage: deploy
# image: python:3.10-slim image: python:3.10-slim
# variables: variables:
# STAX_DEPLOY_DIR: "/root/stax_backend_api" STAX_DEPLOY_DIR: "/root/stax_backend_api"
# before_script: before_script:
# - apt-get update -qq && apt-get install -y -qq --no-install-recommends openssh-client - apt-get update -qq && apt-get install -y -qq --no-install-recommends openssh-client
# # This runner's job containers have a read-only root filesystem (confirmed: writing to # This runner's job containers have a read-only root filesystem (confirmed: writing to
# # ~/.ssh / /root/.ssh fails with "Read-only file system") - /tmp is the one path that's # ~/.ssh / /root/.ssh fails with "Read-only file system") - /tmp is the one path that's
# # reliably writable regardless, so everything SSH-related lives there instead. # reliably writable regardless, so everything SSH-related lives there instead.
# # PROD_SSH_PRIVATE_KEY is a "Variable"-type CI/CD var (raw key text), not "File"-type # PROD_SSH_PRIVATE_KEY is a "Variable"-type CI/CD var (raw key text), not "File"-type
# # (which would give us a path) - write it out ourselves so this doesn't depend on that # (which would give us a path) - write it out ourselves so this doesn't depend on that
# # GitLab dropdown being set exactly right. # GitLab dropdown being set exactly right.
# - echo "$PROD_SSH_PRIVATE_KEY" > /tmp/prod_deploy_key - echo "$PROD_SSH_PRIVATE_KEY" > /tmp/prod_deploy_key
# - chmod 600 /tmp/prod_deploy_key - chmod 600 /tmp/prod_deploy_key
# - ssh-keyscan -p "${PROD_SSH_PORT:-22}" "$PROD_SERVER_IP" > /tmp/known_hosts 2>/dev/null || true - ssh-keyscan -p "${PROD_SSH_PORT:-22}" "$PROD_SERVER_IP" > /tmp/known_hosts 2>/dev/null || true
# script: script:
# - echo "Deploying $CI_COMMIT_SHORT_SHA to production..." - echo "Deploying $CI_COMMIT_SHORT_SHA to production..."
# - > - >
# scp -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/tmp/known_hosts -i /tmp/prod_deploy_key -P "${PROD_SSH_PORT:-22}" scp -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/tmp/known_hosts -i /tmp/prod_deploy_key -P "${PROD_SSH_PORT:-22}"
# deploy/scripts/deploy.sh root@"$PROD_SERVER_IP":/root/stax_deploy_bootstrap.sh deploy/scripts/deploy.sh root@"$PROD_SERVER_IP":/root/stax_deploy_bootstrap.sh
# - > - >
# ssh -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/tmp/known_hosts -i /tmp/prod_deploy_key -p "${PROD_SSH_PORT:-22}" ssh -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/tmp/known_hosts -i /tmp/prod_deploy_key -p "${PROD_SSH_PORT:-22}"
# root@"$PROD_SERVER_IP" root@"$PROD_SERVER_IP"
# "STAX_DEPLOY_DIR='${STAX_DEPLOY_DIR}' "STAX_DEPLOY_DIR='${STAX_DEPLOY_DIR}'
# STAX_PROD_JWT_SECRET='${STAX_PROD_JWT_SECRET}' STAX_PROD_JWT_SECRET='${STAX_PROD_JWT_SECRET}'
# STAX_PROD_ACOUSTID_API_KEY='${STAX_PROD_ACOUSTID_API_KEY}' STAX_PROD_ACOUSTID_API_KEY='${STAX_PROD_ACOUSTID_API_KEY}'
# STAX_PROD_GEMINI_API_KEY='${STAX_PROD_GEMINI_API_KEY}' STAX_PROD_GEMINI_API_KEY='${STAX_PROD_GEMINI_API_KEY}'
# STAX_PROD_DOCS_USERNAME='${STAX_PROD_DOCS_USERNAME}' STAX_PROD_DOCS_USERNAME='${STAX_PROD_DOCS_USERNAME}'
# STAX_PROD_DOCS_PASSWORD='${STAX_PROD_DOCS_PASSWORD}' STAX_PROD_DOCS_PASSWORD='${STAX_PROD_DOCS_PASSWORD}'
# STAX_PROD_TELEGRAM_BOT_TOKEN='${STAX_PROD_TELEGRAM_BOT_TOKEN:-}' STAX_PROD_TELEGRAM_BOT_TOKEN='${STAX_PROD_TELEGRAM_BOT_TOKEN:-}'
# STAX_PROD_LALAL_API_KEY='${STAX_PROD_LALAL_API_KEY:-}' STAX_PROD_LALAL_API_KEY='${STAX_PROD_LALAL_API_KEY:-}'
# bash /root/stax_deploy_bootstrap.sh" bash /root/stax_deploy_bootstrap.sh"
# only: only:
# - main - main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment