docs: update deploy examples
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# Copy this file to .env, fill real values, then run:
|
||||
# docker compose up -d
|
||||
|
||||
COMPOSE_PROJECT_NAME=remnawave-minishop
|
||||
IMAGE_TAG=latest
|
||||
|
||||
# Public hostnames configured as Pangolin resources.
|
||||
WEBHOOK_HOST=webhooks.example.com
|
||||
MINIAPP_HOST=app.example.com
|
||||
|
||||
# Newt credentials from Pangolin site settings.
|
||||
PANGOLIN_ENDPOINT=https://pangolin.example.com
|
||||
NEWT_ID=change_me
|
||||
NEWT_SECRET=change_me
|
||||
|
||||
# Telegram bot token from @BotFather.
|
||||
BOT_TOKEN=your_bot_token_here
|
||||
|
||||
# Telegram numeric user IDs allowed to open the admin panel.
|
||||
ADMIN_IDS=123456789
|
||||
|
||||
# PostgreSQL credentials created by Docker Compose.
|
||||
POSTGRES_USER=remnawave_minishop
|
||||
POSTGRES_PASSWORD=change_me_to_a_long_random_password
|
||||
POSTGRES_DB=remnawave_minishop
|
||||
|
||||
# Keep Web App enabled for the first setup.
|
||||
WEBAPP_ENABLED=True
|
||||
|
||||
# Stable secrets. Generate with:
|
||||
# openssl rand -hex 32
|
||||
WEBAPP_SESSION_SECRET=change_me_to_64_hex_chars
|
||||
WEBHOOK_SECRET_TOKEN=change_me_to_64_hex_chars
|
||||
|
||||
# Remnawave panel integration.
|
||||
PANEL_API_URL=https://panel.example.com/api
|
||||
PANEL_API_KEY=change_me
|
||||
PANEL_WEBHOOK_SECRET=change_me
|
||||
|
||||
# Pangolin/Newt and Docker network ranges that may set X-Forwarded-For.
|
||||
TRUSTED_PROXIES=127.0.0.1,::1,172.16.0.0/12
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# Запуск через Newt / Pangolin
|
||||
|
||||
Этот вариант не открывает входящие порты на сервере приложения. Newt подключается к Pangolin, а публичные домены настраиваются ресурсами в панели Pangolin.
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
nano .env
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
В `.env` заполните:
|
||||
|
||||
- `WEBHOOK_HOST` и `MINIAPP_HOST` - публичные домены ресурсов в Pangolin;
|
||||
- `PANGOLIN_ENDPOINT`, `NEWT_ID`, `NEWT_SECRET` - значения из настроек site/client в Pangolin;
|
||||
- обычные переменные приложения: `BOT_TOKEN`, `ADMIN_IDS`, `POSTGRES_PASSWORD`, секреты и доступ к Remnawave.
|
||||
|
||||
Официальная инструкция Pangolin по установке Newt site: <https://docs.pangolin.net/manage/sites/install-site>.
|
||||
|
||||
В Pangolin создайте два HTTP-ресурса для этого Newt site:
|
||||
|
||||
| Публичный домен | Upstream |
|
||||
| --- | --- |
|
||||
| `https://webhooks.example.com` | `http://backend:8080` |
|
||||
| `https://app.example.com` | `http://frontend:80` |
|
||||
|
||||
Домены в Pangolin должны совпадать с `WEBHOOK_HOST` и `MINIAPP_HOST`.
|
||||
|
||||
Проверка:
|
||||
|
||||
```bash
|
||||
docker compose ps
|
||||
docker compose logs -f newt backend worker frontend
|
||||
```
|
||||
@@ -0,0 +1,146 @@
|
||||
x-app-env-file: &app_env_file
|
||||
- ${APP_ENV_FILE:-.env}
|
||||
|
||||
x-app-environment: &app_environment
|
||||
IMAGE_TAG: ${IMAGE_TAG:-latest}
|
||||
POSTGRES_HOST: postgres
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
WEBHOOK_BASE_URL: https://${WEBHOOK_HOST:?set WEBHOOK_HOST in .env}
|
||||
SUBSCRIPTION_MINI_APP_URL: https://${MINIAPP_HOST:?set MINIAPP_HOST in .env}/
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:?set POSTGRES_USER in .env}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
|
||||
POSTGRES_DB: ${POSTGRES_DB:?set POSTGRES_DB in .env}
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- remnawave-shop
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
command: ["redis-server", "--appendonly", "yes"]
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
networks:
|
||||
- remnawave-shop
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
migrate:
|
||||
image: ghcr.io/3252a8/remnawave-minishop-backend:${IMAGE_TAG:-latest}
|
||||
restart: "no"
|
||||
command: ["python", "backend/main_migrate.py"]
|
||||
env_file: *app_env_file
|
||||
environment:
|
||||
<<: *app_environment
|
||||
volumes:
|
||||
- shop-data:/app/data
|
||||
networks:
|
||||
- remnawave-shop
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
backend:
|
||||
image: ghcr.io/3252a8/remnawave-minishop-backend:${IMAGE_TAG:-latest}
|
||||
restart: unless-stopped
|
||||
env_file: *app_env_file
|
||||
environment:
|
||||
<<: *app_environment
|
||||
WEBAPP_ENABLED: ${WEBAPP_ENABLED:-true}
|
||||
TRUSTED_PROXIES: ${TRUSTED_PROXIES:-127.0.0.1,::1,172.16.0.0/12}
|
||||
volumes:
|
||||
- shop-data:/app/data
|
||||
networks:
|
||||
- remnawave-shop
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=3).read()\""]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
worker:
|
||||
image: ghcr.io/3252a8/remnawave-minishop-worker:${IMAGE_TAG:-latest}
|
||||
restart: unless-stopped
|
||||
env_file: *app_env_file
|
||||
environment:
|
||||
<<: *app_environment
|
||||
volumes:
|
||||
- shop-data:/app/data
|
||||
networks:
|
||||
- remnawave-shop
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
|
||||
frontend:
|
||||
image: ghcr.io/3252a8/remnawave-minishop-frontend:${IMAGE_TAG:-latest}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
IMAGE_TAG: ${IMAGE_TAG:-latest}
|
||||
FRONTEND_PUBLIC: https://${MINIAPP_HOST:?set MINIAPP_HOST in .env}/
|
||||
networks:
|
||||
- remnawave-shop
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/health | grep -q ok"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
newt:
|
||||
image: fosrl/newt:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PANGOLIN_ENDPOINT: ${PANGOLIN_ENDPOINT:?set PANGOLIN_ENDPOINT in .env}
|
||||
NEWT_ID: ${NEWT_ID:?set NEWT_ID in .env}
|
||||
NEWT_SECRET: ${NEWT_SECRET:?set NEWT_SECRET in .env}
|
||||
HEALTH_FILE: /tmp/healthy
|
||||
networks:
|
||||
- remnawave-shop
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "test -f /tmp/healthy"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
networks:
|
||||
remnawave-shop:
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
name: remnawave-minishop-db-data
|
||||
redis-data:
|
||||
name: remnawave-minishop-redis-data
|
||||
shop-data:
|
||||
name: remnawave-minishop-shop-data
|
||||
Reference in New Issue
Block a user