Remove traefik docker support
This commit is contained in:
parent
83d4aba676
commit
afd4ee86dd
|
@ -56,14 +56,33 @@ Other environment variables are used in
|
||||||
[/support/docker/production/config/custom-environment-variables.yaml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/config/custom-environment-variables.yaml) and can be
|
[/support/docker/production/config/custom-environment-variables.yaml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/config/custom-environment-variables.yaml) and can be
|
||||||
intuited from usage.
|
intuited from usage.
|
||||||
|
|
||||||
#### Testing local Docker setup
|
#### Webserver
|
||||||
|
|
||||||
To test locally your Docker setup, you must add your domain (`<MY DOMAIN>`) in `/etc/hosts`:
|
*The docker compose file includes a configured web server. You can skip this part and comment the appropriate section in the docker compose if you use another webserver/proxy.*
|
||||||
```
|
|
||||||
127.0.0.1 localhost mydomain.tld
|
Install the template that the nginx container will use.
|
||||||
|
The container will generate the configuration by replacing `${WEBSERVER_HOST}` and `${PEERTUBE_HOST}` using your docker compose env file.
|
||||||
|
|
||||||
|
It will also generate a TLS certificate at startup and schedule a renew
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mkdir -p docker-volume/nginx
|
||||||
|
curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/nginx/peertube > docker-volume/nginx/peertube
|
||||||
```
|
```
|
||||||
|
|
||||||
#### You can use the regular `up` command to set it up
|
You need to manually generate the first SSL/TLS certificate using Let's Encrypt:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mkdir -p docker-volume/certbot
|
||||||
|
docker run -it --rm --name certbot -p 80:80 -v "$(pwd)/docker-volume/certbot/conf:/etc/letsencrypt" certbot/certbot certonly --standalone
|
||||||
|
```
|
||||||
|
|
||||||
|
The docker-compose will automatically renew this certificate and reload nginx.
|
||||||
|
|
||||||
|
|
||||||
|
#### Test your setup
|
||||||
|
|
||||||
|
Run your containers:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker-compose up
|
docker-compose up
|
||||||
|
|
|
@ -41,12 +41,6 @@ OPENDKIM_DOMAINS=<MY DOMAIN>=peertube
|
||||||
# see https://github.com/wader/postfix-relay/pull/18
|
# see https://github.com/wader/postfix-relay/pull/18
|
||||||
OPENDKIM_RequireSafeKeys=no
|
OPENDKIM_RequireSafeKeys=no
|
||||||
|
|
||||||
# Let's Encrypt service configuration
|
|
||||||
TRAEFIK_ACME_EMAIL=<MY EMAIL ADDRESS>
|
|
||||||
# If you need to obtain ACME certificates for more than one DOMAIN
|
|
||||||
# pass them as a comma separated string
|
|
||||||
TRAEFIK_ACME_DOMAINS=<MY DOMAIN>
|
|
||||||
|
|
||||||
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\
|
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\
|
||||||
#PEERTUBE_SIGNUP_ENABLED=true
|
#PEERTUBE_SIGNUP_ENABLED=true
|
||||||
#PEERTUBE_TRANSCODING_ENABLED=true
|
#PEERTUBE_TRANSCODING_ENABLED=true
|
||||||
|
|
|
@ -3,6 +3,6 @@ FROM nginx:alpine
|
||||||
COPY entrypoint.nginx.sh .
|
COPY entrypoint.nginx.sh .
|
||||||
RUN chmod +x entrypoint.nginx.sh
|
RUN chmod +x entrypoint.nginx.sh
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80 443
|
||||||
ENTRYPOINT []
|
ENTRYPOINT []
|
||||||
CMD ["/bin/sh", "entrypoint.nginx.sh"]
|
CMD ["/bin/sh", "entrypoint.nginx.sh"]
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
# Uncomment this line in order to enable debugging through logs
|
|
||||||
# debug = true
|
|
||||||
defaultEntryPoints = ["http", "https"]
|
|
||||||
|
|
||||||
[entryPoints]
|
|
||||||
[entryPoints.http]
|
|
||||||
address = ":80"
|
|
||||||
[entryPoints.http.redirect]
|
|
||||||
entryPoint = "https"
|
|
||||||
[entryPoints.https]
|
|
||||||
address = ":443"
|
|
||||||
[entryPoints.https.tls]
|
|
||||||
MinVersion = "VersionTLS12"
|
|
||||||
CurvePreferences = [
|
|
||||||
"CurveP521",
|
|
||||||
"CurveP384",
|
|
||||||
"CurveP256"
|
|
||||||
]
|
|
||||||
PreferServerCipherSuites = true
|
|
||||||
CipherSuites = [
|
|
||||||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
|
|
||||||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
|
|
||||||
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
|
|
||||||
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
||||||
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
|
|
||||||
"TLS_RSA_WITH_AES_256_GCM_SHA384",
|
|
||||||
"TLS_RSA_WITH_AES_256_CBC_SHA"
|
|
||||||
]
|
|
||||||
FrameDeny = false # here we don't want to deny frames since we have an embed
|
|
||||||
STSIncludeSubdomains = true
|
|
||||||
STSSeconds = 315360000
|
|
||||||
STSPreload = true
|
|
||||||
ContentTypeNosniff = true
|
|
||||||
BrowserXssFilter = true
|
|
||||||
|
|
||||||
|
|
||||||
# Enable ACME (Let's Encrypt): automatic SSL.
|
|
||||||
[acme]
|
|
||||||
|
|
||||||
# File or key used for certificates storage.
|
|
||||||
#
|
|
||||||
# Required
|
|
||||||
#
|
|
||||||
storage = "/etc/acme.json"
|
|
||||||
# or `storage = "traefik/acme/account"` if using KV store.
|
|
||||||
|
|
||||||
# Entrypoint to proxy acme apply certificates to.
|
|
||||||
# WARNING, if the TLS-SNI-01 challenge is used, it must point to an entrypoint on port 443
|
|
||||||
#
|
|
||||||
# Required
|
|
||||||
#
|
|
||||||
entryPoint = "https"
|
|
||||||
|
|
||||||
# Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge
|
|
||||||
#
|
|
||||||
# Optional but recommend
|
|
||||||
#
|
|
||||||
[acme.httpChallenge]
|
|
||||||
|
|
||||||
# EntryPoint to use for the challenges.
|
|
||||||
#
|
|
||||||
# Required
|
|
||||||
#
|
|
||||||
entryPoint = "http"
|
|
||||||
|
|
||||||
[docker]
|
|
||||||
exposedByDefault = false
|
|
|
@ -1,27 +0,0 @@
|
||||||
version: "3.3"
|
|
||||||
|
|
||||||
services:
|
|
||||||
|
|
||||||
# The reverse-proxy only does SSL termination and automatic certificate generation. You can
|
|
||||||
# replace it with any other reverse-proxy, in which case you can remove 'traefik.*' labels.
|
|
||||||
reverse-proxy:
|
|
||||||
image: traefik:v1.7
|
|
||||||
network_mode: "host"
|
|
||||||
command:
|
|
||||||
- "--docker" # Tells Træfik to listen to docker
|
|
||||||
- "--acme.email=${TRAEFIK_ACME_EMAIL}" # Let's Encrypt ACME email
|
|
||||||
- "--acme.domains=${TRAEFIK_ACME_DOMAINS}" # Let's Encrypt ACME domain list
|
|
||||||
ports:
|
|
||||||
- "80:80" # serving HTTP
|
|
||||||
- "443:443" # serving HTTPS
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock # So that Træfik can listen to the Docker events
|
|
||||||
- ./docker-volume/traefik/acme.json:/etc/acme.json
|
|
||||||
- ./docker-volume/traefik/traefik.toml:/traefik.toml
|
|
||||||
restart: "always"
|
|
||||||
|
|
||||||
webserver:
|
|
||||||
labels:
|
|
||||||
traefik.enable: "true"
|
|
||||||
traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}"
|
|
||||||
traefik.port: "80"
|
|
|
@ -2,19 +2,18 @@ version: "3.3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
# The webserver is not required, but recommended since a lot of optimizations went to its
|
# You can comment this webserver section if you want to use another webserver/proxy
|
||||||
# nginx configuration file. It runs the default nginx configuration without HTTPS nor SSL,
|
|
||||||
# so use it in production in tandem with an SSL-terminating reverse-proxy.
|
|
||||||
webserver:
|
webserver:
|
||||||
image: chocobozzz/peertube:webserver
|
image: chocobozzz/peertube-webserver:latest
|
||||||
build:
|
# If you don't want to use the official image and build one from sources:
|
||||||
context: .
|
# build:
|
||||||
dockerfile: Dockerfile.nginx
|
# context: .
|
||||||
|
# dockerfile: Dockerfile.nginx
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
# If you provide your own reverse-proxy, otherwise not suitable for production:
|
ports:
|
||||||
#ports:
|
- "80:80"
|
||||||
# - "9000:80" # serving HTTP
|
- "443:443"
|
||||||
volumes:
|
volumes:
|
||||||
- type: bind
|
- type: bind
|
||||||
# Switch sources if you downloaded the whole repository
|
# Switch sources if you downloaded the whole repository
|
||||||
|
@ -23,15 +22,29 @@ services:
|
||||||
target: /etc/nginx/conf.d/peertube.template
|
target: /etc/nginx/conf.d/peertube.template
|
||||||
- assets:/var/www/peertube/peertube-latest/client/dist:ro
|
- assets:/var/www/peertube/peertube-latest/client/dist:ro
|
||||||
- ./docker-volume/data:/var/www/peertube/storage
|
- ./docker-volume/data:/var/www/peertube/storage
|
||||||
|
- certbot-www:/var/www/certbot
|
||||||
|
- ./docker-volume/certbot/conf:/etc/letsencrypt
|
||||||
depends_on:
|
depends_on:
|
||||||
- peertube
|
- peertube
|
||||||
restart: "always"
|
restart: "always"
|
||||||
|
|
||||||
|
# You can comment this certbot section if you want to use another webserver/proxy
|
||||||
|
certbot:
|
||||||
|
container_name: certbot
|
||||||
|
image: certbot/certbot
|
||||||
|
volumes:
|
||||||
|
- ./docker-volume/certbot/conf:/etc/letsencrypt
|
||||||
|
- certbot-www:/var/www/certbot
|
||||||
|
restart: unless-stopped
|
||||||
|
entrypoint: /bin/sh -c "trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;"
|
||||||
|
depends_on:
|
||||||
|
- webserver
|
||||||
|
|
||||||
peertube:
|
peertube:
|
||||||
# If you don't want to use the official image and build one from sources:
|
# If you don't want to use the official image and build one from sources:
|
||||||
#build:
|
# build:
|
||||||
# context: .
|
# context: .
|
||||||
# dockerfile: ./support/docker/production/Dockerfile.buster
|
# dockerfile: ./support/docker/production/Dockerfile.buster
|
||||||
image: chocobozzz/peertube:production-buster
|
image: chocobozzz/peertube:production-buster
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
@ -79,3 +92,4 @@ networks:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
assets:
|
assets:
|
||||||
|
certbot-www:
|
||||||
|
|
|
@ -4,12 +4,14 @@ set -e
|
||||||
# Process the nginx template
|
# Process the nginx template
|
||||||
SOURCE_FILE="/etc/nginx/conf.d/peertube.template"
|
SOURCE_FILE="/etc/nginx/conf.d/peertube.template"
|
||||||
TARGET_FILE="/etc/nginx/conf.d/default.conf"
|
TARGET_FILE="/etc/nginx/conf.d/default.conf"
|
||||||
export WEBSERVER_HOST="default_server"
|
export WEBSERVER_HOST="$PEERTUBE_WEBSERVER_HOSTNAME"
|
||||||
export PEERTUBE_HOST="peertube:9000"
|
export PEERTUBE_HOST="peertube:9000"
|
||||||
|
|
||||||
envsubst '${WEBSERVER_HOST} ${PEERTUBE_HOST}' < $SOURCE_FILE > $TARGET_FILE
|
envsubst '${WEBSERVER_HOST} ${PEERTUBE_HOST}' < $SOURCE_FILE > $TARGET_FILE
|
||||||
|
|
||||||
# Remove HTTPS/SSL from nginx conf since this image is meant as a webserver _behind_ a reverse-proxy doing TLS termination itself
|
while :; do
|
||||||
sed -i 's/443 ssl http2/80/g;/ssl_/d' $TARGET_FILE
|
sleep 12h & wait $!;
|
||||||
|
nginx -s reload;
|
||||||
|
done &
|
||||||
|
|
||||||
nginx -g "daemon off;"
|
nginx -g 'daemon off;'
|
||||||
|
|
|
@ -4,18 +4,17 @@
|
||||||
# OPTIONAL HTTP MODULES: Gzip, Headers, HTTP/2, Log, Real IP, SSL, Thread Pool, Upstream.
|
# OPTIONAL HTTP MODULES: Gzip, Headers, HTTP/2, Log, Real IP, SSL, Thread Pool, Upstream.
|
||||||
# THIRD PARTY MODULES: None.
|
# THIRD PARTY MODULES: None.
|
||||||
|
|
||||||
# Uncomment in production to redirect HTTP to HTTPS. Leave commented for docker-compose.
|
server {
|
||||||
#server {
|
listen 80;
|
||||||
# listen 80;
|
listen [::]:80;
|
||||||
# listen [::]:80;
|
server_name ${WEBSERVER_HOST};
|
||||||
# server_name ${WEBSERVER_HOST};
|
|
||||||
#
|
location /.well-known/acme-challenge/ {
|
||||||
# location /.well-known/acme-challenge/ {
|
default_type "text/plain";
|
||||||
# default_type "text/plain";
|
root /var/www/certbot;
|
||||||
# root /var/www/certbot;
|
}
|
||||||
# }
|
location / { return 301 https://$host$request_uri; }
|
||||||
# location / { return 301 https://$host$request_uri; }
|
}
|
||||||
#}
|
|
||||||
|
|
||||||
upstream backend {
|
upstream backend {
|
||||||
server ${PEERTUBE_HOST};
|
server ${PEERTUBE_HOST};
|
||||||
|
@ -33,8 +32,8 @@ server {
|
||||||
# Certificates
|
# Certificates
|
||||||
# you need a certificate to run in production. see https://letsencrypt.org/
|
# you need a certificate to run in production. see https://letsencrypt.org/
|
||||||
##
|
##
|
||||||
ssl_certificate /etc/letsencrypt/live/peertube/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/${WEBSERVER_HOST}/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/peertube/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/${WEBSERVER_HOST}/privkey.pem;
|
||||||
|
|
||||||
location ^~ '/.well-known/acme-challenge' {
|
location ^~ '/.well-known/acme-challenge' {
|
||||||
default_type "text/plain";
|
default_type "text/plain";
|
||||||
|
|
Loading…
Reference in New Issue