1
0
Fork 0

Environment variables for Docker Compose

This commit is contained in:
Florent Poinsaut 2018-06-02 08:36:49 +02:00 committed by Chocobozzz
parent f8b4475386
commit f83e339b82
3 changed files with 49 additions and 29 deletions

View file

@ -12,37 +12,42 @@ PeerTube needs a PostgreSQL and a Redis instance to work correctly. If you want
to quickly set up a full environment, either for trying the service or in to quickly set up a full environment, either for trying the service or in
production, you can use a `docker-compose` setup. production, you can use a `docker-compose` setup.
```bash ```shell
$ cd /your/peertube/directory $ cd /your/peertube/directory
$ mkdir ./docker-volume && mkdir ./docker-volume/traefik $ mkdir ./docker-volume && mkdir ./docker-volume/traefik
$ curl "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/config/traefik.toml" > ./docker-volume/traefik/traefik.toml $ curl "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/config/traefik.toml" > ./docker-volume/traefik/traefik.toml
$ touch ./docker-volume/traefik/acme.json && chmod 600 ./docker-volume/traefik/acme.json $ touch ./docker-volume/traefik/acme.json && chmod 600 ./docker-volume/traefik/acme.json
$ curl -s "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml" > ./docker-compose.yml $ curl -s "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml" -o docker-compose.yml "https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env" -o .env
``` ```
Update the reverse proxy configuration: Update the reverse proxy configuration:
``` ```shell
$ vim ./docker-volume/traefik/traefik.toml $ vim ./docker-volume/traefik/traefik.toml
``` ```
Tweak the `docker-compose.yml` file there according to your needs: Tweak the `docker-compose.yml` file there according to your needs:
``` ```shell
$ vim ./docker-compose.yaml $ vim ./docker-compose.yaml
``` ```
You can use the regular `up` command to set it up, with possible overrides of Then tweak the `.env` file to change the enviromnent variables:
the environment variables:
```bash ```shell
$ PEERTUBE_WEBSERVER_HOSTNAME="domain.tld" docker-compose up $ vim ./.env
``` ```
Other environment variables are used in Other environment variables are used in
`support/docker/production/config/custom-environment-variables.yaml` and can be `support/docker/production/config/custom-environment-variables.yaml` and can be
intuited from usage. intuited from usage.
You can use the regular `up` command to set it up:
```shell
$ docker-compose up
```
**Important**: note that you'll get the initial `root` user password from the **Important**: note that you'll get the initial `root` user password from the
program output, so check out your logs to find them. program output, so check out your logs to find them.
@ -50,17 +55,17 @@ program output, so check out your logs to find them.
Pull the latest images and rerun PeerTube: Pull the latest images and rerun PeerTube:
``` ```shell
$ cd /your/peertube/directory $ cd /your/peertube/directory
$ docker-compose down $ docker-compose down
$ docker-compose pull $ docker-compose pull
$ PEERTUBE_WEBSERVER_HOSTNAME="domain.tld" docker-compose up -d $ docker-compose up -d
``` ```
## Build your own Docker image ## Build your own Docker image
```bash ```shell
$ git clone https://github.com/chocobozzz/PeerTube /tmp/peertube $ git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
$ cd /tmp/peertube $ cd /tmp/peertube
$ docker build . -f ./support/docker/production/Dockerfile.stretch $ docker build . -f ./support/docker/production/Dockerfile.stretch
@ -69,4 +74,4 @@ $ docker build . -f ./support/docker/production/Dockerfile.stretch
## Development ## Development
We don't have a Docker image for development. See [the CONTRIBUTING guide](https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#develop) We don't have a Docker image for development. See [the CONTRIBUTING guide](https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#develop)
for more information on how you can hack PeerTube! for more information on how you can hack PeerTube!

View file

@ -0,0 +1,15 @@
DB_USERNAME=postgres_user
DB_PASSWORD=postgres_password
PEERTUBE_WEBSERVER_HOSTNAME=my.domain.tld
PEERTUBE_WEBSERVER_PORT=443
PEERTUBE_WEBSERVER_HTTPS="true"
PEERTUBE_REDIS_HOSTNAME=redis
PEERTUBE_SMTP_USERNAME=null
PEERTUBE_SMTP_PASSWORD=null
PEERTUBE_SMTP_HOSTNAME=null
PEERTUBE_SMTP_PORT=25
PEERTUBE_SMTP_FROM=noreply@peertube.domain.tld
PEERTUBE_SMTP_TLS="true"
PEERTUBE_ADMIN_EMAIL=admin@domain.tld
PEERTUBE_SIGNUP_ENABLED="true"
PEERTUBE_TRANSCODING_ENABLED="true"

View file

@ -22,23 +22,23 @@ 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_WEBSERVER_HOSTNAME: my.domain.tld PEERTUBE_WEBSERVER_HOSTNAME: ${PEERTUBE_WEBSERVER_HOSTNAME}
PEERTUBE_WEBSERVER_PORT: 443 PEERTUBE_WEBSERVER_PORT: ${PEERTUBE_WEBSERVER_PORT}
PEERTUBE_WEBSERVER_HTTPS: "true" PEERTUBE_WEBSERVER_HTTPS: ${PEERTUBE_WEBSERVER_HTTPS}
PEERTUBE_DB_HOSTNAME: postgres PEERTUBE_DB_HOSTNAME: postgres
PEERTUBE_DB_USERNAME: postgres_user PEERTUBE_DB_USERNAME: ${DB_USERNAME}
PEERTUBE_DB_PASSWORD: postgres_password PEERTUBE_DB_PASSWORD: ${DB_PASSWORD}
PEERTUBE_REDIS_HOSTNAME: redis PEERTUBE_REDIS_HOSTNAME: redis
PEERTUBE_SMTP_USERNAME: null PEERTUBE_SMTP_USERNAME: ${PEERTUBE_SMTP_USERNAME}
PEERTUBE_SMTP_PASSWORD: null PEERTUBE_SMTP_PASSWORD: ${PEERTUBE_SMTP_PASSWORD}
PEERTUBE_SMTP_HOSTNAME: null PEERTUBE_SMTP_HOSTNAME: ${PEERTUBE_SMTP_HOSTNAME}
PEERTUBE_SMTP_PORT: 25 PEERTUBE_SMTP_PORT: ${PEERTUBE_SMTP_PORT}
PEERTUBE_SMTP_FROM: noreply@peertube.domain.tld PEERTUBE_SMTP_FROM: ${PEERTUBE_SMTP_FROM}
PEERTUBE_SMTP_TLS: "true" PEERTUBE_SMTP_TLS: ${PEERTUBE_SMTP_TLS}
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\ # /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\
# PEERTUBE_ADMIN_EMAIL: admin@domain.tld # PEERTUBE_ADMIN_EMAIL: ${PEERTUBE_ADMIN_EMAIL}
# PEERTUBE_SIGNUP_ENABLED: "true" # PEERTUBE_SIGNUP_ENABLED: ${PEERTUBE_SIGNUP_ENABLED}
# PEERTUBE_TRANSCODING_ENABLED: "true" # PEERTUBE_TRANSCODING_ENABLED: ${PEERTUBE_TRANSCODING_ENABLED}
# Traefik labels are suggested as an example for people using Traefik, # Traefik labels are suggested as an example for people using Traefik,
# remove them if you are using another reverse proxy. # remove them if you are using another reverse proxy.
labels: labels:
@ -59,8 +59,8 @@ services:
postgres: postgres:
image: postgres:10-alpine image: postgres:10-alpine
environment: environment:
POSTGRES_USER: postgres_user POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: postgres_password POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: peertube POSTGRES_DB: peertube
volumes: volumes:
- ./docker-volume/db:/var/lib/postgresql/data - ./docker-volume/db:/var/lib/postgresql/data
@ -74,4 +74,4 @@ services:
- ./docker-volume/redis:/data - ./docker-volume/redis:/data
restart: "always" restart: "always"
labels: labels:
traefik.enable: "false" traefik.enable: "false"