diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-03-03 00:29:52 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-11-11 16:45:46 +0100 |
commit | 1a9b141d835cf3bfe9bdca67f881b520975f9058 (patch) | |
tree | 444b35656c7093250181121ccfadb870c5046be4 /support/docker/production/docker-compose.yml | |
parent | 8e98e6124d2b006ba9f616b0dfce7369fa7b2684 (diff) | |
download | PeerTube-1a9b141d835cf3bfe9bdca67f881b520975f9058.tar.gz PeerTube-1a9b141d835cf3bfe9bdca67f881b520975f9058.tar.zst PeerTube-1a9b141d835cf3bfe9bdca67f881b520975f9058.zip |
Add nginx behind traefik in docker-compose + image updates
- support/docker/production/docker-compose.yml: addition of a nginx
image reusing support/nginx/peertube nginx conf to improve performance,
and lessen setup differences between the docker-compose install and the
typical production install.
- support/docker/production/docker-compose.yml: postgres 10 -> postgres
12, redis 4 -> redis 5. Postgres major updates implies manual upgrade.
- support/nginx/peertube: HTTP -> HTTPS redirection is now commented
by default, to allow its reuse in support/docker/production/docker-compose.yml.
Diffstat (limited to 'support/docker/production/docker-compose.yml')
-rw-r--r-- | support/docker/production/docker-compose.yml | 72 |
1 files changed, 49 insertions, 23 deletions
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml index e937c8b9c..62be02467 100644 --- a/support/docker/production/docker-compose.yml +++ b/support/docker/production/docker-compose.yml | |||
@@ -2,44 +2,65 @@ version: "3.3" | |||
2 | 2 | ||
3 | services: | 3 | services: |
4 | 4 | ||
5 | # The reverse-proxy only does SSL termination and automatic certificate generation. You can | ||
6 | # replace it with any other reverse-proxy, in which case you can remove 'traefik.*' labels. | ||
5 | reverse-proxy: | 7 | reverse-proxy: |
6 | image: traefik:v1.7 | 8 | image: traefik:v1.7 |
7 | network_mode: "host" | 9 | network_mode: "host" |
8 | command: | 10 | command: |
9 | - "--docker" # Tells Træfik to listen to docker | 11 | - "--docker" # Tells Træfik to listen to docker |
10 | - "--acme.email=${TRAEFIK_ACME_EMAIL}" # Let's Encrypt ACME email | 12 | - "--acme.email=${TRAEFIK_ACME_EMAIL}" # Let's Encrypt ACME email |
11 | - "--acme.domains=${TRAEFIK_ACME_DOMAINS}" # Let's Encrypt ACME domain list | 13 | - "--acme.domains=${TRAEFIK_ACME_DOMAINS}" # Let's Encrypt ACME domain list |
12 | ports: | 14 | ports: |
13 | - "80:80" # The HTTP port | 15 | - "80:80" # The HTTP port |
14 | - "443:443" # The HTTPS port | 16 | - "443:443" # The HTTPS port |
15 | volumes: | 17 | volumes: |
16 | - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events | 18 | - /var/run/docker.sock:/var/run/docker.sock # So that Træfik can listen to the Docker events |
17 | - ./docker-volume/traefik/acme.json:/etc/acme.json | 19 | - ./docker-volume/traefik/acme.json:/etc/acme.json |
18 | - ./docker-volume/traefik/traefik.toml:/traefik.toml | 20 | - ./docker-volume/traefik/traefik.toml:/traefik.toml |
19 | restart: "always" | 21 | restart: "always" |
20 | # If you want to use the Traefik dashboard, you should expose it on a | ||
21 | # subdomain with HTTPS and authentification: | ||
22 | # https://medium.com/@xavier.priour/secure-traefik-dashboard-with-https-and-password-in-docker-5b657e2aa15f | ||
23 | # https://github.com/containous/traefik/issues/880#issuecomment-310301168 | ||
24 | 22 | ||
25 | peertube: | 23 | # The webserver is not required, but recommended since a lot of optimizations went to its |
26 | # If you don't want to use the official image and build one from sources | 24 | # nginx configuration file. It runs the default nginx configuration without HTTPS nor SSL, |
27 | # build: | 25 | # so use it in production in tandem with an SSL-terminating reverse-proxy like above. |
28 | # context: . | 26 | webserver: |
29 | # dockerfile: ./support/docker/production/Dockerfile.buster | 27 | build: |
30 | image: chocobozzz/peertube:production-buster | 28 | context: . |
29 | dockerfile: Dockerfile.nginx | ||
31 | env_file: | 30 | env_file: |
32 | - .env | 31 | - .env |
33 | # Traefik labels are suggested as an example for people using Traefik, | 32 | # If you provide your own reverse-proxy, otherwise not suitable for production: |
34 | # remove them if you are using another reverse proxy. | 33 | #ports: |
34 | # - "80:80" | ||
35 | volumes: | ||
36 | - type: bind | ||
37 | # Switch sources if you downloaded the nginx configuration without the whole repository | ||
38 | #source: ./peertube | ||
39 | source: ../../nginx/peertube | ||
40 | target: /etc/nginx/conf.d/peertube.template | ||
41 | - assets:/var/www/peertube/peertube-latest/client/dist:ro | ||
42 | - ./docker-volume/data:/var/www/peertube/storage | ||
43 | depends_on: | ||
44 | - peertube | ||
45 | restart: "always" | ||
35 | labels: | 46 | labels: |
36 | traefik.enable: "true" | 47 | traefik.enable: "true" |
37 | traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}" | 48 | traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}" |
38 | traefik.port: "9000" | 49 | traefik.port: "80" |
39 | # If you don't want to use a reverse proxy (not suitable for production!) | 50 | |
40 | # ports: | 51 | peertube: |
41 | # - "80:9000" | 52 | # If you don't want to use the official image and build one from sources: |
53 | #build: | ||
54 | # context: . | ||
55 | # dockerfile: ./support/docker/production/Dockerfile.buster | ||
56 | image: chocobozzz/peertube:production-buster | ||
57 | env_file: | ||
58 | - .env | ||
59 | # If you provide your own webserver and reverse-proxy, otherwise not suitable for production: | ||
60 | #ports: | ||
61 | # - "80:9000" | ||
42 | volumes: | 62 | volumes: |
63 | - assets:/app/client/dist | ||
43 | - ./docker-volume/data:/data | 64 | - ./docker-volume/data:/data |
44 | - ./docker-volume/config:/config | 65 | - ./docker-volume/config:/config |
45 | depends_on: | 66 | depends_on: |
@@ -47,6 +68,8 @@ services: | |||
47 | - redis | 68 | - redis |
48 | - postfix | 69 | - postfix |
49 | restart: "always" | 70 | restart: "always" |
71 | labels: | ||
72 | traefik.enable: "false" | ||
50 | 73 | ||
51 | postgres: | 74 | postgres: |
52 | image: postgres:10-alpine | 75 | image: postgres:10-alpine |
@@ -59,7 +82,7 @@ services: | |||
59 | traefik.enable: "false" | 82 | traefik.enable: "false" |
60 | 83 | ||
61 | redis: | 84 | redis: |
62 | image: redis:4-alpine | 85 | image: redis:5-alpine |
63 | volumes: | 86 | volumes: |
64 | - ./docker-volume/redis:/data | 87 | - ./docker-volume/redis:/data |
65 | restart: "always" | 88 | restart: "always" |
@@ -82,3 +105,6 @@ networks: | |||
82 | driver: default | 105 | driver: default |
83 | config: | 106 | config: |
84 | - subnet: 172.18.0.0/16 | 107 | - subnet: 172.18.0.0/16 |
108 | |||
109 | volumes: | ||
110 | assets: | ||