]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Environment variables for Docker Compose
authorFlorent Poinsaut <florent@poinsaut.fr>
Sat, 2 Jun 2018 06:36:49 +0000 (08:36 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 5 Jun 2018 06:47:01 +0000 (08:47 +0200)
support/doc/docker.md
support/docker/production/.env [new file with mode: 0644]
support/docker/production/docker-compose.yml

index 7f331182702e28ea1e932e9bf9bcce96fd9314f9..1485e7e856bde6724826b6c780efd442bf3e5940 100644 (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
 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.
 
@@ -50,17 +55,17 @@ program output, so check out your logs to find them.
 
 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
@@ -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!
\ No newline at end of file
+for more information on how you can hack PeerTube!
diff --git a/support/docker/production/.env b/support/docker/production/.env
new file mode 100644 (file)
index 0000000..06cc90b
--- /dev/null
@@ -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"
index 8144502e72ee2b3b8140f66b3574897f56647030..a4a829b40be9c9242f94f4261a65e9df0423549d 100644 (file)
@@ -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: noreply@peertube.domain.tld
-      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: admin@domain.tld
-      # 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:
@@ -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
@@ -74,4 +74,4 @@ services:
       - ./docker-volume/redis:/data
     restart: "always"
     labels:
-      traefik.enable: "false"
\ No newline at end of file
+      traefik.enable: "false"