Skip to content

Commit

Permalink
Environment variables for Docker Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentPoinsaut authored and Chocobozzz committed Jun 5, 2018
1 parent f8b4475 commit f83e339
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 29 deletions.
29 changes: 17 additions & 12 deletions support/doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,60 @@ 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
production, you can use a `docker-compose` setup.

```bash
```shell
$ cd /your/peertube/directory
$ 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
$ 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:

```
```shell
$ vim ./docker-volume/traefik/traefik.toml
```

Tweak the `docker-compose.yml` file there according to your needs:

```
```shell
$ vim ./docker-compose.yaml
```

You can use the regular `up` command to set it up, with possible overrides of
the environment variables:
Then tweak the `.env` file to change the enviromnent variables:

```bash
$ PEERTUBE_WEBSERVER_HOSTNAME="domain.tld" docker-compose up
```shell
$ vim ./.env
```

Other environment variables are used in
`support/docker/production/config/custom-environment-variables.yaml` and can be
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
program output, so check out your logs to find them.

### Upgrade

Pull the latest images and rerun PeerTube:

```
```shell
$ cd /your/peertube/directory
$ docker-compose down
$ docker-compose pull
$ PEERTUBE_WEBSERVER_HOSTNAME="domain.tld" docker-compose up -d
$ docker-compose up -d
```


## Build your own Docker image

```bash
```shell
$ git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
$ cd /tmp/peertube
$ docker build . -f ./support/docker/production/Dockerfile.stretch
Expand All @@ -69,4 +74,4 @@ $ docker build . -f ./support/docker/production/Dockerfile.stretch
## 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)
for more information on how you can hack PeerTube!
for more information on how you can hack PeerTube!
15 changes: 15 additions & 0 deletions support/docker/production/.env
Original file line number Diff line number Diff line change
@@ -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=[email protected]
PEERTUBE_SMTP_TLS="true"
PEERTUBE_ADMIN_EMAIL=[email protected]
PEERTUBE_SIGNUP_ENABLED="true"
PEERTUBE_TRANSCODING_ENABLED="true"
34 changes: 17 additions & 17 deletions support/docker/production/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ services:
# dockerfile: ./support/docker/production/Dockerfile.stretch
image: chocobozzz/peertube:production-stretch
environment:
PEERTUBE_WEBSERVER_HOSTNAME: my.domain.tld
PEERTUBE_WEBSERVER_PORT: 443
PEERTUBE_WEBSERVER_HTTPS: "true"
PEERTUBE_WEBSERVER_HOSTNAME: ${PEERTUBE_WEBSERVER_HOSTNAME}
PEERTUBE_WEBSERVER_PORT: ${PEERTUBE_WEBSERVER_PORT}
PEERTUBE_WEBSERVER_HTTPS: ${PEERTUBE_WEBSERVER_HTTPS}
PEERTUBE_DB_HOSTNAME: postgres
PEERTUBE_DB_USERNAME: postgres_user
PEERTUBE_DB_PASSWORD: postgres_password
PEERTUBE_DB_USERNAME: ${DB_USERNAME}
PEERTUBE_DB_PASSWORD: ${DB_PASSWORD}
PEERTUBE_REDIS_HOSTNAME: redis
PEERTUBE_SMTP_USERNAME: null
PEERTUBE_SMTP_PASSWORD: null
PEERTUBE_SMTP_HOSTNAME: null
PEERTUBE_SMTP_PORT: 25
PEERTUBE_SMTP_FROM: [email protected]
PEERTUBE_SMTP_TLS: "true"
PEERTUBE_SMTP_USERNAME: ${PEERTUBE_SMTP_USERNAME}
PEERTUBE_SMTP_PASSWORD: ${PEERTUBE_SMTP_PASSWORD}
PEERTUBE_SMTP_HOSTNAME: ${PEERTUBE_SMTP_HOSTNAME}
PEERTUBE_SMTP_PORT: ${PEERTUBE_SMTP_PORT}
PEERTUBE_SMTP_FROM: ${PEERTUBE_SMTP_FROM}
PEERTUBE_SMTP_TLS: ${PEERTUBE_SMTP_TLS}
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\
# PEERTUBE_ADMIN_EMAIL: [email protected]
# PEERTUBE_SIGNUP_ENABLED: "true"
# PEERTUBE_TRANSCODING_ENABLED: "true"
# PEERTUBE_ADMIN_EMAIL: ${PEERTUBE_ADMIN_EMAIL}
# PEERTUBE_SIGNUP_ENABLED: ${PEERTUBE_SIGNUP_ENABLED}
# PEERTUBE_TRANSCODING_ENABLED: ${PEERTUBE_TRANSCODING_ENABLED}
# Traefik labels are suggested as an example for people using Traefik,
# remove them if you are using another reverse proxy.
labels:
Expand All @@ -59,8 +59,8 @@ services:
postgres:
image: postgres:10-alpine
environment:
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres_password
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: peertube
volumes:
- ./docker-volume/db:/var/lib/postgresql/data
Expand All @@ -74,4 +74,4 @@ services:
- ./docker-volume/redis:/data
restart: "always"
labels:
traefik.enable: "false"
traefik.enable: "false"

0 comments on commit f83e339

Please sign in to comment.