forked from m3ue/m3u-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.proxy.yml
More file actions
178 lines (160 loc) · 5.61 KB
/
docker-compose.proxy.yml
File metadata and controls
178 lines (160 loc) · 5.61 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# M3U Editor with External M3U Proxy and Redis
# This is the recommended production setup for optimal performance
#
# Features:
# - PostgreSQL database for data persistence
# - External m3u-proxy container for streaming
# - Redis for stream pooling and caching
# - Secure token-based authentication
#
# Setup:
# 1. Copy this file to your project directory as docker-compose.yml
# 2. Create a .env file with the variables below (or set in environment section)
# 3. Run: docker-compose up -d
# 4. Access m3u-editor at http://localhost:36400
#
# Required Environment Variables (create .env file):
# M3U_PROXY_TOKEN=<generate with: openssl rand -hex 32>
# PG_PASSWORD=<generate with: openssl rand -base64 32>
# APP_URL=http://localhost # or your domain
services:
m3u-editor:
image: sparkison/m3u-editor:${IMAGE_TAG:-latest}
container_name: m3u-editor
environment:
# Timezone
- TZ=Etc/UTC
# Application URL (change to your domain or IP)
- APP_URL=${APP_URL:-http://localhost}
- APP_PORT=${APP_PORT:-36400}
# Web Server Configuration
# - NGINX_ENABLED=true # Set to false to disable embedded NGINX and use your own service
# - FPMPORT=9000 # Default FPM port
# Postgres Configuration
- ENABLE_POSTGRES=true # Use embedded Postgres, disable to use your own Postgres service
- PG_DATABASE=${PG_DATABASE:-m3ue}
- PG_USER=${PG_USER:-m3ue}
- PG_PASSWORD=${PG_PASSWORD:-changeme}
- PG_PORT=${PG_PORT:-5432}
# Database Connection (m3u-editor)
- DB_CONNECTION=pgsql
- DB_HOST=localhost
- DB_PORT=${PG_PORT:-5432}
- DB_DATABASE=${PG_DATABASE:-m3ue}
- DB_USERNAME=${PG_USER:-m3ue}
- DB_PASSWORD=${PG_PASSWORD:-changeme}
# Redis configuration
- REDIS_ENABLED=false # Disable embedded Redis
- REDIS_SERVER_PORT=${REDIS_PORT:-6379}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PASSWORD=${REDIS_PASSWORD:-changeme}
# M3U Proxy Configuration (External)
- M3U_PROXY_ENABLED=false # Disable embedded and use external m3u-proxy
- M3U_PROXY_PORT=${M3U_PROXY_PORT:-38085}
- M3U_PROXY_HOST=${M3U_PROXY_HOST:-m3u-proxy} # Internal network hostname of m3u-proxy container
- M3U_PROXY_TOKEN=${M3U_PROXY_TOKEN:-changeme}
volumes:
# Persistent configuration data
- ./data:/var/www/config
# PostgreSQL data persistence
- pgdata:/var/lib/postgresql/data
# User-uploaded assets (logos, images, etc.)
# Without this, uploaded assets are lost on container recreation
- ./storage:/var/www/html/storage/app/public
restart: unless-stopped
ports:
- "${APP_PORT:-36400}:${APP_PORT:-36400}" # Main application port
# - "${PG_PORT:-5432}:${PG_PORT:-5432}" # Uncomment to expose PostgreSQL
networks:
- m3u-network
depends_on:
m3u-proxy:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:${APP_PORT:-36400}/up"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
m3u-proxy:
image: sparkison/m3u-proxy:${IMAGE_TAG:-latest}
container_name: m3u-proxy
environment:
# API Authentication Token (must match M3U_PROXY_TOKEN above)
- API_TOKEN=${M3U_PROXY_TOKEN:-changeme}
- PORT=${M3U_PROXY_PORT:-38085}
# Redis Configuration (for stream pooling)
- REDIS_ENABLED=true
- REDIS_PORT=${REDIS_PORT:-6379}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PASSWORD=${REDIS_PASSWORD:-changeme}
- REDIS_DB=6 # 1-5 used by m3u-editor, so use 6 for m3u-proxy
- ENABLE_REDIS_POOLING=true
# Logging
- LOG_LEVEL=INFO
# Note: ROOT_PATH=/m3u-proxy is now the default, no need to set it explicitly
# Only set ROOT_PATH= (empty) if you need to use the root path instead
# Optional: Additional configuration
# - REDIS_POOL_MAX_CONNECTIONS=50
# - STREAM_TIMEOUT=300
# - CLEANUP_INTERVAL=60
restart: unless-stopped
# Don't expose port externally - only accessible via internal network
# ports:
# - "${PROXY_PORT:-38085}:${PROXY_PORT:-38085}" # Uncomment only if you need direct external access
networks:
- m3u-network
depends_on:
redis:
condition: service_healthy
#devices:
# - /dev/dri:/dev/dri
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:${PROXY_PORT:-38085}/health?api_token=${M3U_PROXY_TOKEN:-changeme}"]
interval: 30s
timeout: 2s
retries: 12
start_period: 10s
# Optional: Resource limits
# deploy:
# resources:
# limits:
# cpus: '2.0'
# memory: 2G
# reservations:
# cpus: '0.5'
# memory: 512M
redis:
image: redis:alpine3.22
container_name: m3u-redis
volumes:
- redis-data:/data
restart: unless-stopped
command: redis-server --port ${REDIS_PORT:-6379} --requirepass ${REDIS_PASSWORD:-changeme} --appendonly no --save "" --maxmemory 256mb --maxmemory-policy allkeys-lru
networks:
- m3u-network
healthcheck:
test: ["CMD", "redis-cli", "-p", "${REDIS_PORT:-6379}", "-a", "${REDIS_PASSWORD:-changeme}", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
# Optional: Resource limits
# deploy:
# resources:
# limits:
# cpus: '1.0'
# memory: 512M
# reservations:
# cpus: '0.25'
# memory: 128M
networks:
m3u-network:
driver: bridge
volumes:
pgdata:
driver: local
redis-data:
driver: local