aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/docker
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-07 18:39:42 +0200
committerChocobozzz <me@florianbigard.com>2018-05-07 18:41:10 +0200
commitfd5e57bbe2accbdb16b6aa65337c5ef44b5bd8fb (patch)
tree7865c16ce0f4be446d0e54174ef5c210917c7f46 /support/docker
parentd9c1882dd050f4a867a4bbfc3667424e41694ae1 (diff)
downloadPeerTube-fd5e57bbe2accbdb16b6aa65337c5ef44b5bd8fb.tar.gz
PeerTube-fd5e57bbe2accbdb16b6aa65337c5ef44b5bd8fb.tar.zst
PeerTube-fd5e57bbe2accbdb16b6aa65337c5ef44b5bd8fb.zip
Docker config directory as volume
Diffstat (limited to 'support/docker')
-rw-r--r--support/docker/production/Dockerfile.stretch12
-rw-r--r--support/docker/production/config/custom-environment-variables.yaml6
-rw-r--r--support/docker/production/docker-compose.yml15
-rwxr-xr-xsupport/docker/production/docker-entrypoint.sh7
-rw-r--r--support/docker/production/swarm-stack.sample.yml52
5 files changed, 25 insertions, 67 deletions
diff --git a/support/docker/production/Dockerfile.stretch b/support/docker/production/Dockerfile.stretch
index a8c3d62ce..6edd33546 100644
--- a/support/docker/production/Dockerfile.stretch
+++ b/support/docker/production/Dockerfile.stretch
@@ -57,14 +57,16 @@ USER peertube
57RUN yarn install --pure-lockfile \ 57RUN yarn install --pure-lockfile \
58 && npm run build 58 && npm run build
59 59
60# Configure PeerTube 60USER root
61RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml 61
62RUN mkdir /data /config
63RUN chown -R peertube:peertube /data /config
64
62ENV NODE_ENV production 65ENV NODE_ENV production
63ENV NODE_CONFIG_DIR /app/support/docker/production/config 66ENV NODE_CONFIG_DIR /config
64 67
65USER root
66RUN mkdir /data && chown peertube:peertube /data
67VOLUME /data 68VOLUME /data
69VOLUME /config
68 70
69COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh 71COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
70ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 72ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
diff --git a/support/docker/production/config/custom-environment-variables.yaml b/support/docker/production/config/custom-environment-variables.yaml
index bcae32079..e157aaea9 100644
--- a/support/docker/production/config/custom-environment-variables.yaml
+++ b/support/docker/production/config/custom-environment-variables.yaml
@@ -1,10 +1,10 @@
1webserver: 1webserver:
2 hostname: "PEERTUBE_HOSTNAME" 2 hostname: "PEERTUBE_WEBSERVER_HOSTNAME"
3 port: 3 port:
4 __name: "PEERTUBE_PORT" 4 __name: "PEERTUBE_WEBSERVER_PORT"
5 __format: "json" 5 __format: "json"
6 https: 6 https:
7 __name: "PEERTUBE_HTTPS" 7 __name: "PEERTUBE_WEBSERVER_HTTPS"
8 __format: "json" 8 __format: "json"
9 9
10database: 10database:
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml
index ee1d29853..eefd6e5bb 100644
--- a/support/docker/production/docker-compose.yml
+++ b/support/docker/production/docker-compose.yml
@@ -9,9 +9,9 @@ services:
9 # dockerfile: ./support/docker/production/Dockerfile.stretch 9 # dockerfile: ./support/docker/production/Dockerfile.stretch
10 image: chocobozzz/peertube:production-stretch 10 image: chocobozzz/peertube:production-stretch
11 environment: 11 environment:
12 PEERTUBE_HOSTNAME: my.domain.tld 12 PEERTUBE_WEBSERVER_HOSTNAME: my.domain.tld
13 PEERTUBE_PORT: 443 13 PEERTUBE_WEBSERVER_PORT: 443
14 PEERTUBE_HTTPS: "true" 14 PEERTUBE_WEBSERVER_HTTPS: "true"
15 PEERTUBE_ADMIN_EMAIL: admin@domain.tld 15 PEERTUBE_ADMIN_EMAIL: admin@domain.tld
16 PEERTUBE_DB_HOSTNAME: postgres 16 PEERTUBE_DB_HOSTNAME: postgres
17 PEERTUBE_DB_USERNAME: postgres_user 17 PEERTUBE_DB_USERNAME: postgres_user
@@ -27,13 +27,14 @@ services:
27 # remove them if you are using another reverse proxy. 27 # remove them if you are using another reverse proxy.
28 labels: 28 labels:
29 traefik.enable: "true" 29 traefik.enable: "true"
30 traefik.frontend.rule: "Host:${PEERTUBE_HOSTNAME}" 30 traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}"
31 traefik.port: "9000" 31 traefik.port: "9000"
32 # If you don't want to use a reverse proxy (not suitable for production!) 32 # If you don't want to use a reverse proxy (not suitable for production!)
33 # ports: 33 # ports:
34 # - "80:9000" 34 # - "80:9000"
35 volumes: 35 volumes:
36 - ./data:/data 36 - ./docker-volume/data:/data
37 - ./docker-volume/config:/config
37 depends_on: 38 depends_on:
38 - postgres 39 - postgres
39 - redis 40 - redis
@@ -46,11 +47,11 @@ services:
46 POSTGRES_PASSWORD: postgres_password 47 POSTGRES_PASSWORD: postgres_password
47 POSTGRES_DB: peertube 48 POSTGRES_DB: peertube
48 volumes: 49 volumes:
49 - ./db:/var/lib/postgresql/data 50 - ./docker-volume/db:/var/lib/postgresql/data
50 restart: "always" 51 restart: "always"
51 52
52 redis: 53 redis:
53 image: redis:4-alpine 54 image: redis:4-alpine
54 volumes: 55 volumes:
55 - ./redis:/data 56 - ./docker-volume/redis:/data
56 restart: "always" 57 restart: "always"
diff --git a/support/docker/production/docker-entrypoint.sh b/support/docker/production/docker-entrypoint.sh
index ba9fcfed5..8ee968b3d 100755
--- a/support/docker/production/docker-entrypoint.sh
+++ b/support/docker/production/docker-entrypoint.sh
@@ -1,6 +1,13 @@
1#!/bin/sh 1#!/bin/sh
2set -e 2set -e
3 3
4# Populate config directory
5if [ -z "$(ls -A /config)" ]; then
6 cp /app/support/docker/production/config/* /config
7 cp /app/config/default.yaml /config
8 chown -R peertube:peertube /config
9fi
10
4# first arg is `-f` or `--some-option` 11# first arg is `-f` or `--some-option`
5# or first arg is `something.conf` 12# or first arg is `something.conf`
6if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then 13if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
diff --git a/support/docker/production/swarm-stack.sample.yml b/support/docker/production/swarm-stack.sample.yml
deleted file mode 100644
index 794f44753..000000000
--- a/support/docker/production/swarm-stack.sample.yml
+++ /dev/null
@@ -1,52 +0,0 @@
1version: "3.3"
2
3services:
4 app:
5 image: peertube:stretch
6 environment:
7 PEERTUBE_HOSTNAME: my.domain.tld
8 PEERTUBE_PORT: 443
9 PEERTUBE_HTTPS: true
10 PEERTUBE_ADMIN_EMAIL: admin@domain.tld
11 PEERTUBE_DB_USERNAME: user
12 PEERTUBE_DB_PASSWORD: password
13 PEERTUBE_SIGNUP_ENABLED: true
14 PEERTUBE_TRANSCODING_ENABLED: true
15 labels: &labels
16 traefik.frontend.rule: "Host:my.domain.tld"
17 traefik.docker.network: traefik
18 traefik.port: "9000"
19 volumes:
20 - app_data:/usr/src/app/data
21 networks:
22 - traefik
23 - backend
24 depends_on:
25 - db
26 deploy:
27 labels: *labels
28 placement:
29 constraints:
30 - node.labels.peertube == 1
31
32 db:
33 image: postgres:10
34 environment:
35 POSTGRES_DB: peertube_prod
36 volumes:
37 - db_data:/var/lib/postgresql/data
38 networks:
39 - backend
40 deploy:
41 placement:
42 constraints:
43 - node.labels.peertube == 1
44
45volumes:
46 app_data:
47 db_data:
48
49networks:
50 backend:
51 traefik:
52 external: true