Docker config directory as volume
This commit is contained in:
parent
d9c1882dd0
commit
fd5e57bbe2
7 changed files with 28 additions and 69 deletions
.gitignore
support
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,3 +24,4 @@
|
||||||
/previews/
|
/previews/
|
||||||
/logs/
|
/logs/
|
||||||
/server/tools/import-mediacore.ts
|
/server/tools/import-mediacore.ts
|
||||||
|
/docker-volume/
|
||||||
|
|
|
@ -30,7 +30,7 @@ you can use the regular `up` command to set it up, with possible overrides of
|
||||||
the environment variables:
|
the environment variables:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ PEERTUBE_HOSTNAME=peertube.lvh.me \
|
$ PEERTUBE_WEBSERVER_HOSTNAME=peertube.lvh.me \
|
||||||
PEERTUBE_ADMIN_EMAIL=test@example.com \
|
PEERTUBE_ADMIN_EMAIL=test@example.com \
|
||||||
PEERTUBE_TRANSCODING_ENABLED=true \
|
PEERTUBE_TRANSCODING_ENABLED=true \
|
||||||
PEERTUBE_SIGNUP_ENABLED=true \
|
PEERTUBE_SIGNUP_ENABLED=true \
|
||||||
|
|
|
@ -57,14 +57,16 @@ USER peertube
|
||||||
RUN yarn install --pure-lockfile \
|
RUN yarn install --pure-lockfile \
|
||||||
&& npm run build
|
&& npm run build
|
||||||
|
|
||||||
# Configure PeerTube
|
|
||||||
RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml
|
|
||||||
ENV NODE_ENV production
|
|
||||||
ENV NODE_CONFIG_DIR /app/support/docker/production/config
|
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
RUN mkdir /data && chown peertube:peertube /data
|
|
||||||
|
RUN mkdir /data /config
|
||||||
|
RUN chown -R peertube:peertube /data /config
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
ENV NODE_CONFIG_DIR /config
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
|
VOLUME /config
|
||||||
|
|
||||||
COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
webserver:
|
webserver:
|
||||||
hostname: "PEERTUBE_HOSTNAME"
|
hostname: "PEERTUBE_WEBSERVER_HOSTNAME"
|
||||||
port:
|
port:
|
||||||
__name: "PEERTUBE_PORT"
|
__name: "PEERTUBE_WEBSERVER_PORT"
|
||||||
__format: "json"
|
__format: "json"
|
||||||
https:
|
https:
|
||||||
__name: "PEERTUBE_HTTPS"
|
__name: "PEERTUBE_WEBSERVER_HTTPS"
|
||||||
__format: "json"
|
__format: "json"
|
||||||
|
|
||||||
database:
|
database:
|
||||||
|
|
|
@ -9,9 +9,9 @@ services:
|
||||||
# dockerfile: ./support/docker/production/Dockerfile.stretch
|
# dockerfile: ./support/docker/production/Dockerfile.stretch
|
||||||
image: chocobozzz/peertube:production-stretch
|
image: chocobozzz/peertube:production-stretch
|
||||||
environment:
|
environment:
|
||||||
PEERTUBE_HOSTNAME: my.domain.tld
|
PEERTUBE_WEBSERVER_HOSTNAME: my.domain.tld
|
||||||
PEERTUBE_PORT: 443
|
PEERTUBE_WEBSERVER_PORT: 443
|
||||||
PEERTUBE_HTTPS: "true"
|
PEERTUBE_WEBSERVER_HTTPS: "true"
|
||||||
PEERTUBE_ADMIN_EMAIL: admin@domain.tld
|
PEERTUBE_ADMIN_EMAIL: admin@domain.tld
|
||||||
PEERTUBE_DB_HOSTNAME: postgres
|
PEERTUBE_DB_HOSTNAME: postgres
|
||||||
PEERTUBE_DB_USERNAME: postgres_user
|
PEERTUBE_DB_USERNAME: postgres_user
|
||||||
|
@ -27,13 +27,14 @@ services:
|
||||||
# remove them if you are using another reverse proxy.
|
# remove them if you are using another reverse proxy.
|
||||||
labels:
|
labels:
|
||||||
traefik.enable: "true"
|
traefik.enable: "true"
|
||||||
traefik.frontend.rule: "Host:${PEERTUBE_HOSTNAME}"
|
traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}"
|
||||||
traefik.port: "9000"
|
traefik.port: "9000"
|
||||||
# If you don't want to use a reverse proxy (not suitable for production!)
|
# If you don't want to use a reverse proxy (not suitable for production!)
|
||||||
# ports:
|
# ports:
|
||||||
# - "80:9000"
|
# - "80:9000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./docker-volume/data:/data
|
||||||
|
- ./docker-volume/config:/config
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
|
@ -46,11 +47,11 @@ services:
|
||||||
POSTGRES_PASSWORD: postgres_password
|
POSTGRES_PASSWORD: postgres_password
|
||||||
POSTGRES_DB: peertube
|
POSTGRES_DB: peertube
|
||||||
volumes:
|
volumes:
|
||||||
- ./db:/var/lib/postgresql/data
|
- ./docker-volume/db:/var/lib/postgresql/data
|
||||||
restart: "always"
|
restart: "always"
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:4-alpine
|
image: redis:4-alpine
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis:/data
|
- ./docker-volume/redis:/data
|
||||||
restart: "always"
|
restart: "always"
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
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`
|
# first arg is `-f` or `--some-option`
|
||||||
# or first arg is `something.conf`
|
# or first arg is `something.conf`
|
||||||
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
|
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
|
||||||
|
|
|
@ -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: admin@domain.tld
|
|
||||||
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
|
|
Loading…
Add table
Reference in a new issue