Files
pipu-music/deploy/compose.yaml
T
mrleo1nidandClaude Opus 5.5 4fa1add80d
ci / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 48s
ci / api (push) Successful in 51s
ci / recommender (push) Canceled after 2s
ci / ts (packages + web) (push) Canceled after 0s
ci / docker (образы собираются — их сервер собирает сам при обновлении) (apps/web/Dockerfile, web, ) (push) Canceled after 0s
ci / docker (образы собираются — их сервер собирает сам при обновлении) (services/api/Dockerfile, api, api) (push) Canceled after 0s
ci / docker (образы собираются — их сервер собирает сам при обновлении) (services/api/Dockerfile, storage-agent, storage-agent) (push) Canceled after 0s
ci / docker (образы собираются — их сервер собирает сам при обновлении) (services/recommender/Dockerfile, recommender, ) (push) Canceled after 0s
ci / mobile (Metro-бандл Android) (push) Canceled after 0s
fix: address project review findings
Security and robustness:
- storage-agent rejects an empty INTERNAL_TOKEN (config notEmpty + middleware)
- api takes the client IP only from X-Real-IP (chi RealIP trusted True-Client-IP)
- /readyz reports ok/fail and logs the cause; checks run in parallel with a timeout
- storage-agent shuts down gracefully; shared httpx.NewServer/Serve with IdleTimeout
- goose migrations take a Postgres advisory lock
- recommender readyz: per-check timeout, redis socket timeouts

Clients:
- Android release allows cleartext HTTP for LAN servers (expo-build-properties)
- checkServer times out after 10s; connect button is disabled while checking

Deploy and CI:
- install.sh hands cache/uploads/updates/models to the non-root service users
- update.sh refuses downgrades unless PIPU_ALLOW_DOWNGRADE=1
- recommender/analyzer get only the env they need; required secrets fail fast
- nginx security headers and CSP; strip True-Client-IP
- dev compose binds ports to 127.0.0.1; postgres/redis images pinned
- version.mjs fails on a malformed explicit tag instead of releasing 0.0.0-dev
- contract check catches untracked generated files
- final releases fail without a release keystore; changelog skips rc tags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:46:46 +03:00

136 lines
4.1 KiB
YAML

# Продакшен-развёртывание (docs/install-guide.md). Образы собираются на сервере из клонированного репозитория.
# Перед первым запуском: sudo ./install.sh. Установка / обновление: ./update.sh [vX.Y.Z]
name: pipu
x-version: &version
VERSION: ${PIPU_VERSION:-0.0.0-dev}
x-build-rec: &build-rec
context: ..
dockerfile: services/recommender/Dockerfile
args: *version
x-library-ro: &library-ro
type: bind
source: ${PIPU_DATA:-/srv/pipu}/library
target: /library
read_only: true
bind: { propagation: rslave }
x-restart: &restart
restart: unless-stopped
services:
nginx:
<<: *restart
image: pipu-music-web:${PIPU_VERSION:-dev}
build:
context: ..
dockerfile: apps/web/Dockerfile
args: *version
ports: ["${HTTP_PORT:-80}:80"]
volumes:
- *library-ro
- ${PIPU_DATA:-/srv/pipu}/cache:/cache:ro
- ${PIPU_DATA:-/srv/pipu}/uploads:/uploads:ro
depends_on: [api]
api:
<<: *restart
image: pipu-music-api:${PIPU_VERSION:-dev}
build:
context: ..
dockerfile: services/api/Dockerfile
target: api
args: *version
env_file: .env
environment: &db-env
DATABASE_URL: postgres://pipu:${POSTGRES_PASSWORD:?заполните POSTGRES_PASSWORD в .env (sudo ./install.sh)}@postgres:5432/pipu?sslmode=disable
volumes:
- *library-ro
- ${PIPU_DATA:-/srv/pipu}/cache:/cache
- ${PIPU_DATA:-/srv/pipu}/updates:/updates
- ${PIPU_DATA:-/srv/pipu}/uploads:/uploads
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_started }
storage-agent: { condition: service_started }
storage-agent:
<<: *restart
image: pipu-music-storage-agent:${PIPU_VERSION:-dev}
build:
context: ..
dockerfile: services/api/Dockerfile
target: storage-agent
args: *version
cap_add: [SYS_ADMIN]
security_opt: ["apparmor:unconfined"]
environment:
INTERNAL_TOKEN: ${INTERNAL_TOKEN:?заполните INTERNAL_TOKEN в .env (sudo ./install.sh)}
LIBRARY_ROOT: /library
LOG_LEVEL: ${LOG_LEVEL:-info}
volumes:
- type: bind
source: ${PIPU_DATA:-/srv/pipu}/library
target: /library
bind: { propagation: rshared }
- ${PIPU_DATA:-/srv/pipu}/uploads:/uploads:ro
recommender:
<<: *restart
image: pipu-music-recommender:${PIPU_VERSION:-dev}
build: *build-rec
command: ["serve"]
# только нужные переменные, а не весь .env с секретами Meilisearch и Gitea
environment:
<<: *db-env
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
INTERNAL_TOKEN: ${INTERNAL_TOKEN:?заполните INTERNAL_TOKEN в .env (sudo ./install.sh)}
LOG_LEVEL: ${LOG_LEVEL:-info}
depends_on:
postgres: { condition: service_healthy }
analyzer:
<<: *restart
image: pipu-music-recommender:${PIPU_VERSION:-dev}
build: *build-rec
command: ["analyze", "--workers", "4"]
environment:
<<: *db-env
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
LOG_LEVEL: ${LOG_LEVEL:-info}
volumes:
- *library-ro
- ${PIPU_DATA:-/srv/pipu}/models:/models
deploy: { resources: { limits: { cpus: "4" } } }
depends_on:
postgres: { condition: service_healthy }
postgres:
<<: *restart
image: pgvector/pgvector:0.8.7-pg17
environment:
POSTGRES_USER: pipu
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: pipu
volumes: [ "${PIPU_DATA:-/srv/pipu}/postgres:/var/lib/postgresql/data" ]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pipu -d pipu"]
interval: 5s
retries: 20
redis:
<<: *restart
image: redis:7.4-alpine
command: ["redis-server", "--appendonly", "yes"]
volumes: [ "${PIPU_DATA:-/srv/pipu}/redis:/data" ]
meilisearch:
<<: *restart
image: getmeili/meilisearch:v1.11
environment:
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
MEILI_ENV: production
volumes: [ "${PIPU_DATA:-/srv/pipu}/meili:/meili_data" ]