From a7033a8dc385da9bb87836d3c440f3a5e755a172 Mon Sep 17 00:00:00 2001 From: Yera All Date: Sat, 4 Apr 2026 02:58:40 +0500 Subject: [PATCH] Add source-based production deploy fallback --- .gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c3bae4..7b9e344 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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