Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the project README formatting to adjust spacing in the setup section before the “Project structure” header.
Changes:
- Added an extra blank line between the final setup bullet and the “## Project structure” section.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
|
||
| - При проблемах с uploads - создать директорию /uploads/avatars | ||
|
|
||
|
|
There was a problem hiding this comment.
Pull request overview
Updates deployment automation to better isolate Docker Compose stacks for staging/production and improves DB readiness handling; also includes a minor README whitespace tweak.
Changes:
- Set explicit Docker Compose project names (
-p ...) for staging and production deploys. - Add a Postgres readiness wait (
pg_isreadyloop) before DB creation/migrations. - Minor formatting change in
README.md(extra blank line).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| README.md | Adds a blank line before “Project structure” (formatting only). |
| .github/workflows/deploy.yml | Alters deploy scripts to use explicit Compose project names and wait for Postgres readiness before DB init/migrations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| set -euxo pipefail | ||
| compose_cmd='docker-compose' | ||
| compose_cmd='docker-compose -p borofone-staging' | ||
| cd /opt/borofone-chat-staging |
| script: | | ||
| set -euxo pipefail | ||
| compose_cmd='docker-compose' | ||
| compose_cmd='docker-compose -p borofone-prod' |
| rm -f deploy/docker/.env | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml rm -sf postgres redis api || true | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml up -d postgres redis | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml exec -T postgres sh -lc 'until pg_isready -U "${POSTGRES_USER:-app}" -d postgres -h 127.0.0.1; do sleep 1; done' |
| rm -f deploy/docker/.env | ||
| $compose_cmd -f deploy/docker/docker-compose.prod.yml rm -sf postgres redis api || true | ||
| $compose_cmd -f deploy/docker/docker-compose.prod.yml up -d postgres redis | ||
| $compose_cmd -f deploy/docker/docker-compose.prod.yml exec -T postgres sh -lc 'until pg_isready -U "${POSTGRES_USER:-app}" -d postgres -h 127.0.0.1; do sleep 1; done' |
Add deploy/scripts/backup-compose-data.sh to create timestamped backups (pg_dump gzipped and uploads tarball) and keep the last 10 backups per environment. Update staging and production CI steps to run the backup script before DB migrations and to perform a cleaner API rollout: stop and remove old API containers, remove lingering containers by label, then up with --force-recreate --build. Also set explicit names for volumes and networks in both docker-compose.staging.yml and docker-compose.prod.yml so persistent volumes and networks have deterministic names.
There was a problem hiding this comment.
Pull request overview
This PR updates the deployment setup by introducing an automated Docker Compose data-backup script and by making Compose resource naming explicit for staging/production, alongside a minor README formatting change.
Changes:
- Add
deploy/scripts/backup-compose-data.shto back up Postgres and the uploads Docker volume with basic retention. - Pin explicit
name:values for volumes and networks in staging/prod Compose files. - Update the GitHub Actions deploy workflow to use explicit Compose project names (
-p ...), stop systemd units, and run the new backup step before migrations.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| deploy/scripts/backup-compose-data.sh | New script to dump DB and archive uploads volume, with timestamped backups and retention cleanup. |
| deploy/docker/docker-compose.staging.yml | Explicitly names staging volumes and network. |
| deploy/docker/docker-compose.prod.yml | Explicitly names prod volumes and network. |
| .github/workflows/deploy.yml | Updates deploy logic: explicit docker-compose -p ..., stops systemd services, runs backup, and adjusts container cleanup/recreate. |
| README.md | Adds an extra blank line (formatting-only). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| name: borofone-staging_postgres_data | ||
| redis_data: | ||
| name: borofone-staging_redis_data | ||
| uploads_data: | ||
| name: borofone-staging_uploads_data |
| name: borofone-prod_postgres_data | ||
| redis_data: | ||
| name: borofone-prod_redis_data | ||
| uploads_data: | ||
| name: borofone-prod_uploads_data | ||
|
|
||
| networks: | ||
| prod_network: | ||
| name: borofone-prod_network |
| set -euxo pipefail | ||
| compose_cmd='docker-compose' | ||
| compose_cmd='docker-compose -p borofone-staging' | ||
| cd /opt/borofone-chat-staging |
| $compose_cmd -f deploy/docker/docker-compose.staging.yml up -d --no-recreate postgres redis | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml exec -T postgres sh -lc 'until pg_isready -U "${POSTGRES_USER:-app}" -d postgres -h 127.0.0.1; do sleep 1; done' |
| $compose_cmd -f deploy/docker/docker-compose.staging.yml run --rm api alembic upgrade head | ||
| docker ps -aq --filter "name=docker_api" | xargs -r docker rm -f | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml up -d --no-deps --build api | ||
| docker ps -q --filter "publish=8001" | xargs -r docker rm -f |
| if "${compose_cmd[@]}" exec -T postgres sh -lc "psql -U \"\${POSTGRES_USER:-app}\" -d postgres -tAc \"SELECT 1 FROM pg_database WHERE datname='${db_name}'\" | grep -q 1"; then | ||
| "${compose_cmd[@]}" exec -T postgres sh -lc "pg_dump -U \"\${POSTGRES_USER:-app}\" -d \"${db_name}\" --clean --if-exists --no-owner --no-privileges" | gzip -9 > "${target_dir}/${db_name}.sql.gz" |
| set -euxo pipefail | ||
| compose_cmd='docker-compose' | ||
| compose_cmd='docker-compose -p borofone-staging' | ||
| cd /opt/borofone-chat-staging | ||
| echo "[deploy] $(date -Is) start staging commit=${{ github.sha }}" | ||
| git fetch --prune origin | ||
| git checkout dev | ||
| git reset --hard origin/dev | ||
| systemctl stop borofone-staging || true | ||
| rm -f deploy/docker/.env | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml rm -sf postgres redis api || true | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml up -d postgres redis | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml up -d --no-recreate postgres redis | ||
| $compose_cmd -f deploy/docker/docker-compose.staging.yml exec -T postgres sh -lc 'until pg_isready -U "${POSTGRES_USER:-app}" -d postgres -h 127.0.0.1; do sleep 1; done' | ||
| bash deploy/scripts/backup-compose-data.sh staging borofone-staging deploy/docker/docker-compose.staging.yml borofone_staging borofone-staging_uploads_data |
| set -euxo pipefail | ||
| compose_cmd='docker-compose' | ||
| compose_cmd='docker-compose -p borofone-prod' | ||
| cd /opt/borofone-chat-prod |
| $compose_cmd -f deploy/docker/docker-compose.prod.yml up -d --no-recreate postgres redis | ||
| $compose_cmd -f deploy/docker/docker-compose.prod.yml exec -T postgres sh -lc 'until pg_isready -U "${POSTGRES_USER:-app}" -d postgres -h 127.0.0.1; do sleep 1; done' |
| $compose_cmd -f deploy/docker/docker-compose.prod.yml run --rm api alembic upgrade head | ||
| docker ps -aq --filter "name=docker_api" | xargs -r docker rm -f | ||
| $compose_cmd -f deploy/docker/docker-compose.prod.yml up -d --no-deps --build api | ||
| docker ps -q --filter "publish=8000" | xargs -r docker rm -f |
No description provided.