Skip to content

Commit

Permalink
Docker config directory as volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed May 7, 2018
1 parent d9c1882 commit fd5e57b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 68 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
/previews/
/logs/
/server/tools/import-mediacore.ts
/docker-volume/
2 changes: 1 addition & 1 deletion support/doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_ADMIN_EMAIL=test@example.com \
PEERTUBE_TRANSCODING_ENABLED=true \
PEERTUBE_SIGNUP_ENABLED=true \
Expand Down
12 changes: 7 additions & 5 deletions support/docker/production/Dockerfile.stretch
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
15 changes: 8 additions & 7 deletions support/docker/production/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: admin@domain.tld
PEERTUBE_DB_HOSTNAME: postgres
PEERTUBE_DB_USERNAME: postgres_user
Expand All @@ -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
Expand All @@ -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"
7 changes: 7 additions & 0 deletions support/docker/production/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
52 changes: 0 additions & 52 deletions support/docker/production/swarm-stack.sample.yml

This file was deleted.

0 comments on commit fd5e57b

Please sign in to comment.