Add source-based production deploy fallback

This commit is contained in:
Yera All
2026-04-04 02:58:40 +05:00
parent 0c95be6963
commit a7033a8dc3
+37
View File
@@ -190,3 +190,40 @@ deploy-production:
when: manual
- when: never
allow_failure: false
deploy-production-source:
stage: deploy
tags:
- call-center-prod
needs:
- test
environment:
name: production
before_script:
- command -v ssh >/dev/null
- command -v rsync >/dev/null
- command -v docker >/dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- printf '%s\n' "$DEPLOY_SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts
script:
- test -n "$DEPLOY_HOST"
- test -n "$DEPLOY_USER"
- test -n "$DEPLOY_PATH"
- ssh "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p '$DEPLOY_PATH'"
- rsync -av --exclude '.git/' --exclude '.tmp/' --exclude '.codex_tmp/' --exclude '.local_stack/' --exclude '.data_pg/' ./ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
- |
ssh "$DEPLOY_USER@$DEPLOY_HOST" \
"mkdir -p '$DEPLOY_PATH/.data_local/generated_ivr_yandex/ivr' '$DEPLOY_PATH/.data_local/recordings' '$DEPLOY_PATH/.asterisk_assets'"
- |
ssh "$DEPLOY_USER@$DEPLOY_HOST" \
"cd '$DEPLOY_PATH/deployment' && \
docker compose -f docker-compose.server.yml up -d --build && \
docker compose -f docker-compose.asterisk.server.yml up -d --build"
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: manual
- when: never
allow_failure: false