mirror of
https://github.com/619dev/PaperPhone.git
synced 2026-05-06 14:00:33 +08:00
109 lines
3.5 KiB
YAML
109 lines
3.5 KiB
YAML
# ─────────────────────────────────────────────────────────────────
|
|
# PaperPhone — Full-Stack Docker Compose
|
|
#
|
|
# Services:
|
|
# client — Nginx serving H5/PWA + reverse-proxy to server
|
|
# server — Node.js API + WebSocket
|
|
# mysql — Message store / user DB
|
|
# redis — Online presence & session cache
|
|
#
|
|
# File storage:
|
|
# Cloudflare R2 (configured via R2_* env vars in server/.env)
|
|
# No MinIO / S3 container needed.
|
|
#
|
|
# Images:
|
|
# docker pull facilisvelox/paperphone-client:latest
|
|
# docker pull facilisvelox/paperphone-server:latest
|
|
#
|
|
# Quick start:
|
|
# cp server/.env.example server/.env # edit secrets & R2 keys
|
|
# docker compose up -d
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
services:
|
|
|
|
# ── Frontend (Nginx) ──────────────────────────────────────────
|
|
client:
|
|
image: facilisvelox/paperphone-client:latest
|
|
ports:
|
|
- "80:80"
|
|
environment:
|
|
SERVER_URL: http://server:3000
|
|
depends_on:
|
|
server:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- paperphone
|
|
|
|
# ── Backend (Node.js) ─────────────────────────────────────────
|
|
server:
|
|
image: facilisvelox/paperphone-server:latest
|
|
env_file: ./server/.env
|
|
environment:
|
|
DB_HOST: mysql
|
|
DB_PORT: 3306
|
|
DB_USER: ${DB_USER:-paperphone}
|
|
DB_PASS: ${DB_PASS:-changeme}
|
|
DB_NAME: paperphone
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 15s
|
|
restart: unless-stopped
|
|
networks:
|
|
- paperphone
|
|
|
|
# ── MySQL 8 ───────────────────────────────────────────────────
|
|
mysql:
|
|
image: mysql:8.0
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS:-changeme}
|
|
MYSQL_DATABASE: paperphone
|
|
MYSQL_USER: ${DB_USER:-paperphone}
|
|
MYSQL_PASSWORD: ${DB_PASS:-changeme}
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
- ./server/db/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_ROOT_PASS:-changeme}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
networks:
|
|
- paperphone
|
|
|
|
# ── Redis 7 ───────────────────────────────────────────────────
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: redis-server --save 60 1 --loglevel warning ${REDIS_PASS:+--requirepass $REDIS_PASS}
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
networks:
|
|
- paperphone
|
|
|
|
volumes:
|
|
mysql_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
paperphone:
|
|
driver: bridge
|