Commit 893240bd authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Fix deploy_prod: this runner's job containers have a read-only root fs

Confirmed via job trace: echo "\$PROD_SSH_PRIVATE_KEY" > ~/.ssh/prod_deploy_key
failed with "Read-only file system" writing to /root/.ssh. Moved the SSH
key and known_hosts to /tmp instead - reliably writable regardless of a
read-only root, unlike the home directory.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent b47fa899
Pipeline #1035 failed with stages
in 20 minutes and 27 seconds
......@@ -61,20 +61,22 @@ deploy_prod:
STAX_DEPLOY_DIR: "/root/stax_backend_api"
before_script:
- apt-get update -qq && apt-get install -y -qq --no-install-recommends openssh-client
- mkdir -p ~/.ssh
# 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
# 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
# (which would give us a path) - write it out ourselves so this doesn't depend on that
# GitLab dropdown being set exactly right.
- echo "$PROD_SSH_PRIVATE_KEY" > ~/.ssh/prod_deploy_key
- chmod 600 ~/.ssh/prod_deploy_key
- ssh-keyscan -p "${PROD_SSH_PORT:-22}" "$PROD_SERVER_IP" >> ~/.ssh/known_hosts 2>/dev/null || true
- echo "$PROD_SSH_PRIVATE_KEY" > /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
script:
- echo "Deploying $CI_COMMIT_SHORT_SHA to production..."
- >
scp -o StrictHostKeyChecking=accept-new -i ~/.ssh/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
- >
ssh -o StrictHostKeyChecking=accept-new -i ~/.ssh/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"
"STAX_DEPLOY_DIR='${STAX_DEPLOY_DIR}'
STAX_PROD_JWT_SECRET='${STAX_PROD_JWT_SECRET}'
......
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