Files
telegram-shop/docker-compose.yml
NW b1844b1acc fix(compose): tor-proxy hardcodes tg_shop_admin:3000 — onion always serves new Next.js admin
- Old .env had ADMIN_PORT=3001/SHOP_CONTAINER=telegram_shop_prod overriding compose defaults
- Tor onion was proxying to old Express admin; now hardcoded to new Next.js admin
2026-08-08 12:05:46 +01:00

106 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
telegram_shop_prod:
build:
context: .
dockerfile: ./Dockerfile
hostname: telegram_shop_prod
container_name: telegram_shop_prod
ports:
- "3001:3001"
restart: unless-stopped
environment:
- ADMIN_CHAT_URL=http://tg_shop_admin:3000/api/chat
volumes:
- ./db:/app/db/
- ./uploads:/app/uploads/
- ./.env:/app/.env:ro
cap_add:
- NET_ADMIN
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
dns:
- 8.8.8.8
- 1.1.1.1
mem_limit: 384m
cpus: "1.0"
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- default
- tor_proxy_net
# Новая Next.js админ-панель (Prisma, одна БД с ботом)
tg_shop_admin:
build:
context: ./admin-next
dockerfile: ./Dockerfile
container_name: tg_shop_admin
ports:
- "3000:3000"
restart: unless-stopped
environment:
- DATABASE_URL=file:/app/db/shop.db
- ADMIN_SECRET=${ADMIN_SECRET:-changeme}
- SUPER_ADMIN_SECRET=${SUPER_ADMIN_SECRET:-changeme_super}
# ИИ-чатбот: настройки берутся из site_settings (chatbot_*)
- CHATBOT_API_ENDPOINT=${CHATBOT_API_ENDPOINT:-https://api.openai.com/v1}
- CHATBOT_API_KEY=${CHATBOT_API_KEY:-}
volumes:
- ./db:/app/db
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 256M
healthcheck:
test: ["CMD", "node", "-e", "const http = require('http'); http.get('http://localhost:3000/api/auth/session', r => { process.exit(r.statusCode === 401 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
networks:
- default
- tor_proxy_net
tor-proxy:
build:
context: ./tor-proxy
dockerfile: Dockerfile
container_name: tor-proxy
environment:
SSH_HOST_IP: ${SSH_HOST_IP:-host.docker.internal}
# Onion-админка всегда проксируется на НОВУЮ Next.js админку (tg_shop_admin:3000)
# Жёсткие значения — .env прод содержит старые ADMIN_PORT/SHOP_CONTAINER (старая админка)
SHOP_CONTAINER: tg_shop_admin
ADMIN_PORT: "3000"
volumes:
- tor_data:/var/lib/tor
- ./tor-proxy/hosts:/onion-hosts
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- default
- tor_proxy_net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "test -s /var/lib/tor/ssh/hostname && test -s /var/lib/tor/admin/hostname"]
interval: 60s
timeout: 10s
retries: 2
start_period: 120s
networks:
tor_proxy_net:
name: tor_proxy_net
driver: bridge
attachable: true
volumes:
tor_data:
name: tor_proxy_data