docs: update deploy examples
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# Copy this file to .env, fill real values, then run:
|
||||
# docker compose up -d
|
||||
|
||||
COMPOSE_PROJECT_NAME=remnawave-minishop
|
||||
IMAGE_TAG=latest
|
||||
|
||||
# Public hostnames. nginx.conf.template uses the same values.
|
||||
WEBHOOK_HOST=webhooks.example.com
|
||||
MINIAPP_HOST=app.example.com
|
||||
|
||||
# Optional bind addresses for Nginx.
|
||||
HTTP_BIND=0.0.0.0:80
|
||||
HTTPS_BIND=0.0.0.0:443
|
||||
|
||||
# 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
|
||||
|
||||
# Nginx 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,42 @@
|
||||
# Запуск с Nginx
|
||||
|
||||
Этот пример поднимает Nginx в той же Docker-сети, что и приложение:
|
||||
|
||||
- `WEBHOOK_HOST` проксируется в `backend:8080`;
|
||||
- `MINIAPP_HOST` проксируется в `frontend:80`;
|
||||
- `frontend` сам проксирует внутренние `/api`, `/auth` и ассеты тем в `backend:8081`.
|
||||
|
||||
## Подготовка
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
nano .env
|
||||
```
|
||||
|
||||
Положите TLS-сертификаты в `ssl/`:
|
||||
|
||||
```text
|
||||
ssl/
|
||||
webhooks.example.com/
|
||||
fullchain.pem
|
||||
privkey.pem
|
||||
app.example.com/
|
||||
fullchain.pem
|
||||
privkey.pem
|
||||
```
|
||||
|
||||
Имена папок должны совпадать с `WEBHOOK_HOST` и `MINIAPP_HOST` в `.env`.
|
||||
|
||||
## Запуск
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
docker compose logs -f nginx backend worker frontend
|
||||
```
|
||||
|
||||
Если нужно поменять заголовки, лимиты или TLS-настройки, правьте `nginx.conf.template` рядом с compose и перезапускайте Nginx:
|
||||
|
||||
```bash
|
||||
docker compose up -d --force-recreate nginx
|
||||
```
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
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
|
||||
|
||||
nginx:
|
||||
image: nginx:1.27-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
WEBHOOK_HOST: ${WEBHOOK_HOST:?set WEBHOOK_HOST in .env}
|
||||
MINIAPP_HOST: ${MINIAPP_HOST:?set MINIAPP_HOST in .env}
|
||||
ports:
|
||||
- "${HTTP_BIND:-0.0.0.0:80}:80"
|
||||
- "${HTTPS_BIND:-0.0.0.0:443}:443"
|
||||
volumes:
|
||||
- ./nginx.conf.template:/etc/nginx/templates/default.conf.template:ro
|
||||
- ./ssl:/etc/nginx/ssl:ro
|
||||
networks:
|
||||
- remnawave-shop
|
||||
depends_on:
|
||||
frontend:
|
||||
condition: service_healthy
|
||||
backend:
|
||||
condition: service_healthy
|
||||
|
||||
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
|
||||
@@ -0,0 +1,62 @@
|
||||
upstream remnawave_backend_webhooks {
|
||||
server backend:8080;
|
||||
keepalive 16;
|
||||
}
|
||||
|
||||
upstream remnawave_frontend {
|
||||
server frontend:80;
|
||||
keepalive 16;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ${WEBHOOK_HOST} ${MINIAPP_HOST};
|
||||
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
# WEBHOOK_BASE_URL: Telegram, payment providers and Remnawave webhooks.
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name ${WEBHOOK_HOST};
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/${WEBHOOK_HOST}/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/${WEBHOOK_HOST}/privkey.pem;
|
||||
|
||||
client_max_body_size 20m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://remnawave_backend_webhooks;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# SUBSCRIPTION_MINI_APP_URL: static Mini App frontend.
|
||||
# The frontend container proxies /api, /auth and theme/logo assets to backend:8081.
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name ${MINIAPP_HOST};
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/${MINIAPP_HOST}/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/${MINIAPP_HOST}/privkey.pem;
|
||||
|
||||
client_max_body_size 20m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://remnawave_frontend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# TLS-сертификаты для Nginx
|
||||
|
||||
Положите сюда сертификаты для доменов из `.env`.
|
||||
|
||||
Пример структуры:
|
||||
|
||||
```text
|
||||
ssl/
|
||||
webhooks.example.com/
|
||||
fullchain.pem
|
||||
privkey.pem
|
||||
app.example.com/
|
||||
fullchain.pem
|
||||
privkey.pem
|
||||
```
|
||||
|
||||
Если используете wildcard-сертификат, можно положить одинаковые `fullchain.pem` и `privkey.pem` в обе папки.
|
||||
|
||||
Reference in New Issue
Block a user