Example of vps deploy with infra split from business.

Keeps one mysql instance for all.
This commit is contained in:
Stefan Lazic committed 2026-08-07 19:45:56 +01:00
1 parent b41a6d0af7
commit 841ee7eb52
6 files changed
+359

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
name: next-chair-blake-heritage
# One business's app container on the shared multi-business VPS setup —
# see docker-compose.infra.yaml for the shared MySQL/Traefik this attaches
# to, and that file's header for the exact one-time setup steps (create
# this business's database, copy .env.business.example) needed before
# this file can start.
#
# docker compose -f docker-compose.blake-heritage.yaml --env-file .env.business.blake-heritage up -d --build
#
# `docker-compose.marios.yaml` is the identical shape for the second
# business — copy this file's pattern again for any future business.
services:
next-chair-blake-heritage:
build:
context: .
dockerfile: Dockerfile
# Builds the image fresh here. Once there are more than a couple of
# businesses, it's worth building once (`docker build -t
# nextchair-app:latest .`) and swapping this `build:` block for
# `image: nextchair-app:latest` in every business's file instead, so
# a code update doesn't mean rebuilding the identical image N times —
# not necessary to start with.
container_name: next-chair-blake-heritage
restart: unless-stopped
env_file:
- .env.business.blake-heritage
volumes:
- next-chair-media-blake-heritage:/app/storage/media
healthcheck:
# No curl/wget in the node:22-alpine base image — a plain Node
# request avoids adding a package just for this. See
# src/app/api/health/route.ts: healthy as soon as the database is
# reachable, even before installation completes.
test:
[
"CMD",
"node",
"-e",
"require('http').get('http://localhost:3000/api/health', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))",
]
interval: 10s
timeout: 5s
retries: 10
start_period: 20s
labels:
- "traefik.enable=true"
- "traefik.http.routers.blake-heritage.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.blake-heritage.entrypoints=websecure"
- "traefik.http.routers.blake-heritage.tls.certresolver=letsencrypt"
- "traefik.http.services.blake-heritage.loadbalancer.server.port=3000"
networks:
- next-chair-edge
volumes:
next-chair-media-blake-heritage:
name: next-chair-media-blake-heritage
networks:
next-chair-edge:
name: next-chair-edge
external: true