chore: Update docker-compose files and configurations

This commit is contained in:
Peifan Li
2025-12-26 13:55:38 -05:00
parent 5be5334df9
commit 33fa09045b
7 changed files with 243 additions and 104 deletions

View File

@@ -22,9 +22,9 @@ cd mytube-deploy
Create a file named `docker-compose.yml` inside your folder and paste the following content.
**Note:** This version uses standard relative paths (`./data`, `./uploads`) instead of the QNAP-specific paths found in the original repository.
**Note:** This version uses standard relative paths (`./data`, `./uploads`) instead of the QNAP-specific paths found in the original repository.
```
```yaml
version: '3.8'
services:
@@ -35,6 +35,8 @@ services:
restart: unless-stopped
ports:
- "5551:5551"
networks:
- mytube-network
environment:
- PORT=5551
# Optional: Set a custom upload directory inside container if needed
@@ -42,8 +44,10 @@ services:
volumes:
- ./uploads:/app/uploads
- ./data:/app/data
networks:
- mytube-network
# For OpenWrt/iStoreOS systems where bridge network cannot access internet,
# uncomment the following lines to use host network mode:
# network_mode: host
# Then set NGINX_BACKEND_URL=http://localhost:5551 for frontend service
frontend:
image: franklioxygen/mytube:frontend-latest
@@ -52,19 +56,31 @@ services:
restart: unless-stopped
ports:
- "5556:5556"
depends_on:
- backend
networks:
- mytube-network
environment:
# Internal Docker networking URLs (Browser -> Frontend -> Backend)
# In most setups, these defaults work fine.
- VITE_API_URL=/api
- VITE_BACKEND_URL=
depends_on:
- backend
networks:
- mytube-network
# For host network mode (when backend uses network_mode: host), set:
# - NGINX_BACKEND_URL=http://localhost:5551
# If backend uses host network mode, uncomment the following:
# network_mode: host
# And remove the ports mapping above
networks:
mytube-network:
driver: bridge
# DNS configuration to help with network connectivity issues on OpenWrt/iStoreOS
# If you still have issues accessing internet from containers, try:
# 1. Add your router's DNS servers: dns: [8.8.8.8, 8.8.4.4]
# 2. Or use host network mode for backend (see comments above)
driver_opts:
com.docker.network.bridge.enable_ip_masquerade: "true"
com.docker.network.bridge.enable_icc: "true"
```
### 3. Start the Application
@@ -107,6 +123,7 @@ You can customize the deployment by adding a `.env` file or modifying the `en
|`VITE_API_URL`|Frontend|API endpoint path|`/api`|
|`API_HOST`|Frontend|**Advanced:** Force a specific backend IP|_(Auto-detected)_|
|`API_PORT`|Frontend|**Advanced:** Force a specific backend Port|`5551`|
|`NGINX_BACKEND_URL`|Frontend|**Advanced:** Override Nginx backend upstream URL|`http://backend:5551`|
## 🛠️ Advanced Networking (Remote/NAS Deployment)
@@ -190,4 +207,14 @@ If you prefer to build the images yourself (e.g., to modify code), follow these
```
docker rm -f mytube-backend mytube-frontend
docker-compose up -d
```
```
### 4. Connection Refused / No Internet (OpenWrt/iStoreOS)
- **Cause:** Docker bridge network compatibility issues on some router OS versions.
- **Fix:** We added `driver_opts` to the default network configuration to address this. If issues persist:
1. Edit `docker-compose.yml`.
2. Uncomment `network_mode: host` for both `backend` and `frontend`.
3. Remove (or comment out) the `ports` and `networks` sections for both services.
4. Set `NGINX_BACKEND_URL=http://localhost:5551` in the `frontend` environment variables.
5. Restart containers: `docker-compose up -d`