Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Docker config directory as volume

Chocobozzzfd5e57bbe2ac
diff --git a/.gitignore b/.gitignore
index bc0756609b..5b50250441 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,4 @@
/previews/
/logs/
/server/tools/import-mediacore.ts
+/docker-volume/
diff --git a/support/doc/docker.md b/support/doc/docker.md
index 093d7124ed..ae2b0f9c05 100644
--- a/support/doc/docker.md
+++ b/support/doc/docker.md
@@ -30,7 +30,7 @@ you can use the regular `up` command to set it up, with possible overrides of
the environment variables:
```bash
-$ PEERTUBE_HOSTNAME=peertube.lvh.me \
+$ PEERTUBE_WEBSERVER_HOSTNAME=peertube.lvh.me \
PEERTUBE_TRANSCODING_ENABLED=true \
PEERTUBE_SIGNUP_ENABLED=true \
diff --git a/support/docker/production/Dockerfile.stretch b/support/docker/production/Dockerfile.stretch
index a8c3d62cef..6edd33546c 100644
--- a/support/docker/production/Dockerfile.stretch
+++ b/support/docker/production/Dockerfile.stretch
@@ -57,14 +57,16 @@ USER peertube
RUN yarn install --pure-lockfile \
&& npm run build
-# Configure PeerTube
-RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml
+USER root
+
+RUN mkdir /data /config
+RUN chown -R peertube:peertube /data /config
+
ENV NODE_ENV production
-ENV NODE_CONFIG_DIR /app/support/docker/production/config
+ENV NODE_CONFIG_DIR /config
-USER root
-RUN mkdir /data && chown peertube:peertube /data
VOLUME /data
+VOLUME /config
COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
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 bcae32079a..e157aaea9a 100644
--- a/support/docker/production/config/custom-environment-variables.yaml
+++ b/support/docker/production/config/custom-environment-variables.yaml
@@ -1,10 +1,10 @@
webserver:
- hostname: "PEERTUBE_HOSTNAME"
+ hostname: "PEERTUBE_WEBSERVER_HOSTNAME"
port:
- __name: "PEERTUBE_PORT"
+ __name: "PEERTUBE_WEBSERVER_PORT"
__format: "json"
https:
- __name: "PEERTUBE_HTTPS"
+ __name: "PEERTUBE_WEBSERVER_HTTPS"
__format: "json"
database:
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml
index ee1d298530..eefd6e5bbf 100644
--- a/support/docker/production/docker-compose.yml
+++ b/support/docker/production/docker-compose.yml
@@ -9,9 +9,9 @@ services:
# dockerfile: ./support/docker/production/Dockerfile.stretch
image: chocobozzz/peertube:production-stretch
environment:
- PEERTUBE_HOSTNAME: my.domain.tld
- PEERTUBE_PORT: 443
- PEERTUBE_HTTPS: "true"
+ PEERTUBE_WEBSERVER_HOSTNAME: my.domain.tld
+ PEERTUBE_WEBSERVER_PORT: 443
+ PEERTUBE_WEBSERVER_HTTPS: "true"
PEERTUBE_ADMIN_EMAIL: [email protected]
PEERTUBE_DB_HOSTNAME: postgres
PEERTUBE_DB_USERNAME: postgres_user
@@ -27,13 +27,14 @@ services:
# remove them if you are using another reverse proxy.
labels:
traefik.enable: "true"
- traefik.frontend.rule: "Host:${PEERTUBE_HOSTNAME}"
+ traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}"
traefik.port: "9000"
# If you don't want to use a reverse proxy (not suitable for production!)
# ports:
# - "80:9000"
volumes:
- - ./data:/data
+ - ./docker-volume/data:/data
+ - ./docker-volume/config:/config
depends_on:
- postgres
- redis
@@ -46,11 +47,11 @@ services:
POSTGRES_PASSWORD: postgres_password
POSTGRES_DB: peertube
volumes:
- - ./db:/var/lib/postgresql/data
+ - ./docker-volume/db:/var/lib/postgresql/data
restart: "always"
redis:
image: redis:4-alpine
volumes:
- - ./redis:/data
+ - ./docker-volume/redis:/data
restart: "always"
diff --git a/support/docker/production/docker-entrypoint.sh b/support/docker/production/docker-entrypoint.sh
index ba9fcfed5b..8ee968b3da 100755
--- a/support/docker/production/docker-entrypoint.sh
+++ b/support/docker/production/docker-entrypoint.sh
@@ -1,6 +1,13 @@
#!/bin/sh
set -e
+# Populate config directory
+if [ -z "$(ls -A /config)" ]; then
+ cp /app/support/docker/production/config/* /config
+ cp /app/config/default.yaml /config
+ chown -R peertube:peertube /config
+fi
+
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
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 794f447536..0000000000
--- a/support/docker/production/swarm-stack.sample.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-version: "3.3"
-
-services:
- app:
- image: peertube:stretch
- environment:
- PEERTUBE_HOSTNAME: my.domain.tld
- PEERTUBE_PORT: 443
- PEERTUBE_HTTPS: true
- PEERTUBE_ADMIN_EMAIL: [email protected]
- PEERTUBE_DB_USERNAME: user
- PEERTUBE_DB_PASSWORD: password
- PEERTUBE_SIGNUP_ENABLED: true
- PEERTUBE_TRANSCODING_ENABLED: true
- labels: &labels
- traefik.frontend.rule: "Host:my.domain.tld"
- traefik.docker.network: traefik
- traefik.port: "9000"
- volumes:
- - app_data:/usr/src/app/data
- networks:
- - traefik
- - backend
- depends_on:
- - db
- deploy:
- labels: *labels
- placement:
- constraints:
- - node.labels.peertube == 1
-
- db:
- image: postgres:10
- environment:
- POSTGRES_DB: peertube_prod
- volumes:
- - db_data:/var/lib/postgresql/data
- networks:
- - backend
- deploy:
- placement:
- constraints:
- - node.labels.peertube == 1
-
-volumes:
- app_data:
- db_data:
-
-networks:
- backend:
- traefik:
- external: true