Documentation example(s) for reverse-proxy with docker-compose
Is your feature request related to a problem? Please describe
I am eager to try castopod on my VPS to explore hosting a new podcast. I am fairly well-versed in Docker and have created a few multi-image projects via docker-compose and utilizing projects like linuxserver.io's fleet of images. I am trying to replicate their setup for using swag like in my other containers, but I keep getting 502 bad gateway errors.
Describe the solution you'd like
The documentation page for example Docker usage mentions the following regarding reverse-proxies:
Setup a reverse proxy for TLS (SSL/HTTPS)
TLS is mandatory for ActivityPub to work. This job can easily be handled by a reverse proxy, for example with Caddy
Would it be possible to add an example that uses caddy, swag, or another easy-to-use reverse proxy image within a docker-compose context?
Additional context
Below are my current versions of the docker-compose.yml and customized proxy configuration file used by swag (anonymized IP address and salt):
docker-compose
version: "3.7"
services:
app:
image: castopod/app:latest
container_name: "castopod-app"
volumes:
- /home/eric/docker_configs/castopod_configs/castopod-media:/opt/castopod/public/media
environment:
- MYSQL_DATABASE=castopod
- MYSQL_USER=castopod
- MYSQL_PASSWORD=mypass123**
- CP_BASEURL=http://castopod.mydomain.com
- CP_ANALYTICS_SALT=mysalt
- CP_CACHE_HANDLER=redis
- CP_REDIS_HOST=redis
- PGID=1000
- PUID=1000
#networks:
# - castopod-app
# - castopod-db
restart: unless-stopped
castopod:
image: castopod/web-server:latest
container_name: "castopod"
volumes:
- /home/eric/docker_configs/castopod_configs/castopod-media:/var/www/html/media
#networks:
# - castopod-app
ports:
- 8080:8080
environment:
- PGID=1000
- PUID=1000
restart: unless-stopped
mariadb:
image: mariadb:10.5
container_name: "castopod-mariadb"
#networks:
# - castopod-db
volumes:
- /home/eric/docker_configs/castopod_configs/castopod-db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mypass123**
- MYSQL_DATABASE=castopod
- MYSQL_USER=castopod
- MYSQL_PASSWORD=mypass123**
- PGID=1000
- PUID=1000
restart: unless-stopped
redis:
image: redis:7.0-alpine
container_name: "castopod-redis"
volumes:
- /home/eric/docker_configs/castopod_configs/castopod-cache:/data
#networks:
# - castopod-app
environment:
- PGID=1000
- PUID=1000
# this container is optional
# add this if you want to use the videoclips feature
video-clipper:
image: castopod/video-clipper:latest
container_name: "castopod-video-clipper"
volumes:
- /home/eric/docker_configs/castopod_configs/castopod-media:/opt/castopod/public/media
environment:
- MYSQL_DATABASE=castopod
- MYSQL_USER=castopod
- MYSQL_PASSWORD=mypass123**
- PGID=1000
- PUID=1000
#networks:
# - castopod-db
restart: unless-stopped
swag:
image: ghcr.io/linuxserver/swag
container_name: castopod-swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- URL=mydomain.com
- SUBDOMAINS=castopod
- VALIDATION=http
- DNSPLUGIN=cloudflare #optional
- PROPAGATION= #optional
- DUCKDNSTOKEN= #optional
- EMAIL=thercast@gmail.com
- ONLY_SUBDOMAINS=true #optional
- EXTRA_DOMAINS= #optional
- STAGING=false #optional
volumes:
- /home/eric/docker_configs/castopod_configs/swag/config:/config
ports:
- "443:443"
- "80:80"
restart: "unless-stopped"
volumes:
castopod-media:
castopod-db:
castopod-cache:
castopod.subdomain.conf
## Version 2022/09/08
# REMOVE THIS LINE BEFORE SUBMITTING: The structure of the file (all of the existing lines) should be kept as close as possible to this template.
# REMOVE THIS LINE BEFORE SUBMITTING: Look through this file for <tags> and replace them. Review other sample files to see how things are done.
# REMOVE THIS LINE BEFORE SUBMITTING: The comment lines at the top of the file (below this line) should explain any prerequisites for using the proxy such as DNS or app settings.
# make sure that your dns has a cname set for <container_name> and that your <container_name> container is not using a base url
server {
listen 443 ssl;
listen [::]:443 ssl;
#server_name <container_name>.*;
server_name castopod.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
location / {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
#set $upstream_app <container_name>;
set $upstream_app castopod;
#set $upstream_port <port_number>;
set $upstream_port 8080;
#set $upstream_proto <http or https>;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}