ffed10cd66
Previous attempts hardcoded 3011, but something on tyler's host is holding 3011 too. Instead of guessing ports, make the deploy probe for the first free port starting from 3011 and thread that choice through the rest of the workflow. How it works: 1. Start Docker stack frees 3001 + the previous deploy's chosen port (read from .postgrest-port) so the lowest free port can be picked back up 2. Loops from 3011 upward, checking ss -tln until it finds a free port in the 3011-30200 range 3. Writes the chosen port to .postgrest-port in the workspace 4. Sets NEXT_PUBLIC_API_URL based on that port 5. Writes POSTGREST_HOST_PORT and NEXT_PUBLIC_API_URL to the .env that docker compose reads 6. Build and Deploy steps read .postgrest-port to set their NEXT_PUBLIC_API_URL dynamically — no more hardcoded 3011
84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: route_commerce_db
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "127.0.0.1:5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
postgrest:
|
|
image: postgrest/postgrest:v12.2.3
|
|
container_name: route_commerce_postgrest
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
PGRST_DB_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
|
PGRST_DB_SCHEMA: public
|
|
PGRST_DB_ANON_ROLE: ${POSTGRES_USER}
|
|
PGRST_SERVER_PORT: 3001
|
|
PGRST_SERVER_HOST: 0.0.0.0
|
|
PGRST_OPENAPI_MODE: disabled
|
|
PGRST_DB_EXTRA_SEARCH_PATH: public,extensions
|
|
ports:
|
|
- "127.0.0.1:${POSTGREST_HOST_PORT:-3011}:3001"
|
|
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: route_commerce_minio
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
|
|
command: server /data --console-address ":9001"
|
|
volumes:
|
|
- minio_data:/data
|
|
ports:
|
|
- "127.0.0.1:9000:9000"
|
|
- "127.0.0.1:9001:9001"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
minio_init:
|
|
image: minio/mc:latest
|
|
depends_on:
|
|
minio:
|
|
condition: service_healthy
|
|
env_file:
|
|
- .env
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
command:
|
|
- |
|
|
mc alias set local http://minio:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD}
|
|
for b in brand-logos product-images contacts-imports videos water-photos; do
|
|
mc mb --ignore-existing local/$${b}
|
|
mc anonymous set download local/$${b}
|
|
done
|
|
profiles: ["init"]
|
|
|
|
volumes:
|
|
db_data:
|
|
driver: local
|
|
minio_data:
|
|
driver: local
|