This commit is contained in:
@@ -27,6 +27,7 @@ services:
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
image: ${API_IMAGE:-pokemon-inventory-api}:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.node
|
dockerfile: Dockerfile.node
|
||||||
@@ -50,6 +51,7 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
|
image: ${WORKER_IMAGE:-pokemon-inventory-worker}:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.node
|
dockerfile: Dockerfile.node
|
||||||
@@ -66,6 +68,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
web:
|
web:
|
||||||
|
image: ${WEB_IMAGE:-pokemon-inventory-web}:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.web
|
dockerfile: Dockerfile.web
|
||||||
|
|||||||
@@ -45,6 +45,31 @@ worker images share the same Node workspace image; the web image builds the Vue
|
|||||||
application and serves it through Nginx with SPA fallback and internal `/api`
|
application and serves it through Nginx with SPA fallback and internal `/api`
|
||||||
proxying.
|
proxying.
|
||||||
|
|
||||||
|
## Tagged Releases And Rollback
|
||||||
|
|
||||||
|
Use an immutable release tag for every deployment. The production Compose file
|
||||||
|
uses `IMAGE_TAG` to select matching API, worker, and web images. Deploy with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
RELEASE_TAG=2026-09-09-01 ./scripts/deploy-production.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The deploy script builds the three tagged images, starts healthy data services,
|
||||||
|
applies migrations with the tagged API image, and then switches the application
|
||||||
|
services. Keep the previous release tag and migration state with the deployment
|
||||||
|
record.
|
||||||
|
|
||||||
|
Rollback application images with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
RELEASE_TAG=2026-09-08-02 ./scripts/rollback-production.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Image rollback is safe only when the previous image understands the current
|
||||||
|
database schema. If the release included an incompatible schema change, restore
|
||||||
|
the matching PostgreSQL backup before starting the previous images. Always
|
||||||
|
verify the API and web health checks after a rollback.
|
||||||
|
|
||||||
## Health Checks
|
## Health Checks
|
||||||
|
|
||||||
Production Compose waits for healthy PostgreSQL, Redis, and API services before
|
Production Compose waits for healthy PostgreSQL, Redis, and API services before
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
: "${RELEASE_TAG:?Set RELEASE_TAG to an immutable image tag}"
|
||||||
|
|
||||||
|
compose_args='-f compose.production.yaml'
|
||||||
|
export IMAGE_TAG="$RELEASE_TAG"
|
||||||
|
|
||||||
|
docker compose $compose_args build api worker web
|
||||||
|
docker compose $compose_args up -d postgres redis
|
||||||
|
docker compose $compose_args run --rm api npm run db:migrate
|
||||||
|
docker compose $compose_args up -d api worker web
|
||||||
|
docker compose $compose_args ps
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
: "${RELEASE_TAG:?Set RELEASE_TAG to the previously deployed immutable image tag}"
|
||||||
|
|
||||||
|
export IMAGE_TAG="$RELEASE_TAG"
|
||||||
|
docker compose -f compose.production.yaml up -d api worker web
|
||||||
|
docker compose -f compose.production.yaml ps
|
||||||
Reference in New Issue
Block a user