diff options
Diffstat (limited to 'support/docker')
-rw-r--r-- | support/docker/production/Dockerfile.stretch | 12 | ||||
-rw-r--r-- | support/docker/production/config/custom-environment-variables.yaml | 6 | ||||
-rw-r--r-- | support/docker/production/docker-compose.yml | 15 | ||||
-rwxr-xr-x | support/docker/production/docker-entrypoint.sh | 7 | ||||
-rw-r--r-- | support/docker/production/swarm-stack.sample.yml | 52 |
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 | |||
57 | RUN yarn install --pure-lockfile \ | 57 | RUN yarn install --pure-lockfile \ |
58 | && npm run build | 58 | && npm run build |
59 | 59 | ||
60 | # Configure PeerTube | 60 | USER root |
61 | RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml | 61 | |
62 | RUN mkdir /data /config | ||
63 | RUN chown -R peertube:peertube /data /config | ||
64 | |||
62 | ENV NODE_ENV production | 65 | ENV NODE_ENV production |
63 | ENV NODE_CONFIG_DIR /app/support/docker/production/config | 66 | ENV NODE_CONFIG_DIR /config |
64 | 67 | ||
65 | USER root | ||
66 | RUN mkdir /data && chown peertube:peertube /data | ||
67 | VOLUME /data | 68 | VOLUME /data |
69 | VOLUME /config | ||
68 | 70 | ||
69 | COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | 71 | COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh |
70 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] | 72 | ENTRYPOINT ["/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 @@ | |||
1 | webserver: | 1 | webserver: |
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 | ||
10 | database: | 10 | database: |
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 |
2 | set -e | 2 | set -e |
3 | 3 | ||
4 | # Populate config directory | ||
5 | if [ -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 | ||
9 | fi | ||
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` |
6 | if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then | 13 | if [ "${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 @@ | |||
1 | version: "3.3" | ||
2 | |||
3 | services: | ||
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 | |||
45 | volumes: | ||
46 | app_data: | ||
47 | db_data: | ||
48 | |||
49 | networks: | ||
50 | backend: | ||
51 | traefik: | ||
52 | external: true | ||