-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
73 lines (70 loc) · 2.43 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
version: "3.9"
services:
3x-ui:
image: ghcr.io/mhsanaei/3x-ui:v1.7.8
container_name: 3x-ui
labels:
- "traefik.enable=true"
- "traefik.http.routers.3x-ui.rule=Host(`${XUI_HOSTNAME}`)"
- "traefik.http.routers.3x-ui.tls.certresolver=myresolver"
- "traefik.http.services.3x-ui.loadbalancer.server.port=2053"
environment:
XRAY_VMESS_AEAD_FORCED: "false"
XUI_USERNAME: ${XUI_USERNAME}
XUI_PASSWORD: ${XUI_PASSWORD}
XUI_PANEL_PORT: ${XUI_PANEL_PORT}
XUI_HOSTNAME: ${XUI_HOSTNAME}
XUI_EMAIL: ${XUI_EMAIL}
TGTOKEN: ${TGTOKEN}
ADMINID: ${ADMINID}
volumes:
- "$PWD/cert/:/root/cert/"
- "$PWD/db/:/etc/x-ui/"
ports:
- "2096:2096"
- "443:443"
tty: true
restart: unless-stopped
reverse-proxy:
image: traefik:v2.4
container_name: traefik
command:
- "--api.insecure=false"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:20657"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=${XUI_EMAIL}"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
labels:
# Middleware for HTTP to HTTPS redirection
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.port=${XUI_PANEL_PORT}"
# Apply middleware to the main router for HTTP
- "traefik.http.routers.redirect.rule=Host(`${XUI_HOSTNAME}`)"
- "traefik.http.routers.redirect.entrypoints=web"
- "traefik.http.routers.redirect.middlewares=redirect-to-https"
ports:
- "${XUI_PANEL_PORT}:20657"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "$PWD/letsencrypt:/letsencrypt"
depends_on:
- 3x-ui
restart: unless-stopped
backend:
build:
context: .
dockerfile: Dockerfile
environment:
XUI_LOGIN: ${XUI_USERNAME}
XUI_PASS: ${XUI_PASSWORD}
ADMIN_TELEGRAM_ID: ${ADMINID}
TELEGRAM_API_TOKEN: ${TGTOKEN}
XUI_HOSTNAME: ${XUI_HOSTNAME}
XUI_URL: "http://3x-ui:2053"
volumes:
- "$PWD/db/:/db/"