aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBenjamin Bouvier <public@benj.me>2018-03-15 14:39:04 +0100
committerChocobozzz <me@florianbigard.com>2018-03-15 14:39:04 +0100
commitef48a0d50aec99472340fa0995e1739113190147 (patch)
tree7b08df1fffa3863e62f789939ceb4eee39d654a0
parent2e3a0215d051dca1f7c8ef423564c8d37a255f77 (diff)
downloadPeerTube-ef48a0d50aec99472340fa0995e1739113190147.tar.gz
PeerTube-ef48a0d50aec99472340fa0995e1739113190147.tar.zst
PeerTube-ef48a0d50aec99472340fa0995e1739113190147.zip
[docker] Update production guidelines and docker-compose file; (#341)
-rw-r--r--support/doc/docker.md65
-rw-r--r--support/docker/production/config/custom-environment-variables.yaml2
-rw-r--r--support/docker/production/config/production.yaml4
-rw-r--r--support/docker/production/docker-compose.yml41
4 files changed, 84 insertions, 28 deletions
diff --git a/support/doc/docker.md b/support/doc/docker.md
index 2249d14c4..e0c03a1dc 100644
--- a/support/doc/docker.md
+++ b/support/doc/docker.md
@@ -1,26 +1,61 @@
1# Docker guide 1# Docker guide
2 2
3## Test/Development 3You can quickly get a server running using Docker. You need to have
4[docker](https://www.docker.com/community-edition) and
5[docker-compose](https://docs.docker.com/compose/install/) installed.
4 6
5You can quickly get a server running using Docker. You need to have [docker](https://www.docker.com/community-edition) and [docker-compose](https://docs.docker.com/compose/install/) installed. 7## Production
8
9### Build your own Docker image
10
11```bash
12$ git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
13$ cd /tmp/peertube
14$ docker build . -f ./support/docker/production/Dockerfile.stretch
15```
6 16
7For this example configuration, you should also run a reverse proxy. The example 17### Run a preconfigured setup with all dependencies
8Docker Compose file provides example labels for the Traefik load balancer,
9though any HTTP reverse proxy is compatible.
10 18
11Example for running a PeerTube server locally: 19PeerTube needs a PostgreSQL and a Redis instance to work correctly. If you want
20to quickly set up a full environment, either for trying the service or in
21production, you can use a `docker-compose` setup.
12 22
13```bash 23```bash
14$ wget https://github.com/chocobozzz/PeerTube/raw/develop/support/docker/production/docker-compose.yml 24$ git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
15$ sudo \ 25$ cd /tmp/peertube/support/docker/production
16 PEERTUBE_HOSTNAME=peertube.lvh.me \
17 PEERTUBE_ADMIN_EMAIL=test@example.com \
18 PEERTUBE_TRANSCODING_ENABLED=true \
19 docker-compose up app
20``` 26```
21 27
22(Get the initial root user password from the program output.) 28Then tweak the `docker-compose.yml` file there according to your needs. Then
29you can use the regular `up` command to set it up, with possible overrides of
30the environment variables:
23 31
24## Production 32```bash
33$ PEERTUBE_HOSTNAME=peertube.lvh.me \
34 PEERTUBE_ADMIN_EMAIL=test@example.com \
35 PEERTUBE_TRANSCODING_ENABLED=true \
36 PEERTUBE_SIGNUP_ENABLED=true \
37 PEERTUBE_SMTP_HOST=mail.lvh.me \
38 PEERTUBE_SMTP_PORT=1025 \
39 PEERTUBE_SMTP_FROM=noreply@peertube.lvh.me \
40 docker-compose up
41```
42
43Other environment variables are used in
44`support/docker/production/config/custom-environment-variables.yaml` and can be
45intuited from usage.
46
47For this example configuration, a reverse proxy is quite recommended. The
48example Docker Compose file provides example labels for a Traefik load
49balancer, although any HTTP reverse proxy will work fine. See the example
50Nginx configuration `support/nginx/peertube` file to get an idea of
51recommendations and requirements to run PeerTube the most efficiently.
52
53**Important**: note that you'll get the initial `root` user password from the
54program output, so check out your logs to find them.
55
56## Development
25 57
26PR welcome! 58The Docker image that's preconfigured in `support/docker/dev` contains all the
59services embedded in one image, so as to work correctly on
60[Janitor](https://janitor.technology). It is much not advised to use it in
61production.
diff --git a/support/docker/production/config/custom-environment-variables.yaml b/support/docker/production/config/custom-environment-variables.yaml
index 9139125a5..b53405c46 100644
--- a/support/docker/production/config/custom-environment-variables.yaml
+++ b/support/docker/production/config/custom-environment-variables.yaml
@@ -33,7 +33,7 @@ smtp:
33 tls: 33 tls:
34 __name: "PEERTUBE_SMTP_TLS" 34 __name: "PEERTUBE_SMTP_TLS"
35 __format: "json" 35 __format: "json"
36 form_address: "PEERTUBE_ADMIN_EMAIL" 36 from_address: "PEERTUBE_SMTP_FROM"
37 37
38admin: 38admin:
39 email: "PEERTUBE_ADMIN_EMAIL" 39 email: "PEERTUBE_ADMIN_EMAIL"
diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml
index 3cc72e573..c00cf7510 100644
--- a/support/docker/production/config/production.yaml
+++ b/support/docker/production/config/production.yaml
@@ -78,3 +78,7 @@ instance:
78 name: 'PeerTube' 78 name: 'PeerTube'
79 description: '' # Support markdown 79 description: '' # Support markdown
80 terms: '' # Support markdown 80 terms: '' # Support markdown
81 default_client_route: '/videos/trending'
82 customizations:
83 javascript: '' # Directly your JavaScript code (without <script> tags). Will be eval at runtime
84 css: '' # Directly your CSS code (without <style> tags). Will be injected at runtime
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml
index db1c7d587..b08cace76 100644
--- a/support/docker/production/docker-compose.yml
+++ b/support/docker/production/docker-compose.yml
@@ -1,19 +1,27 @@
1version: "3.3" 1version: "3.3"
2 2
3services: 3services:
4 peertube:
5 4
6 build: . 5 peertube:
6 build:
7 context: ../../../
8 dockerfile: ./support/docker/production/Dockerfile.stretch
7 image: peertube:stretch 9 image: peertube:stretch
8 environment: 10 environment:
9 PEERTUBE_HOSTNAME: my.domain.tld 11 PEERTUBE_HOSTNAME: my.domain.tld
10 PEERTUBE_PORT: 443 12 PEERTUBE_PORT: 443
11 PEERTUBE_HTTPS: true 13 PEERTUBE_HTTPS: "true"
12 PEERTUBE_ADMIN_EMAIL: admin@domain.tld 14 PEERTUBE_ADMIN_EMAIL: admin@domain.tld
13 PEERTUBE_DB_USERNAME: user 15 PEERTUBE_DB_HOSTNAME: postgres
14 PEERTUBE_DB_PASSWORD: password 16 PEERTUBE_DB_USERNAME: postgres_user
15 PEERTUBE_SIGNUP_ENABLED: true 17 PEERTUBE_DB_PASSWORD: postgres_password
16 PEERTUBE_TRANSCODING_ENABLED: true 18 PEERTUBE_SIGNUP_ENABLED: "true"
19 PEERTUBE_TRANSCODING_ENABLED: "true"
20 PEERTUBE_REDIS_HOSTNAME: redis
21 PEERTUBE_SMTP_HOSTNAME: mail.domain.tld
22 PEERTUBE_SMTP_PORT: 25
23 PEERTUBE_SMTP_FROM: noreply@peertube.domain.tld
24 PEERTUBE_SMTP_TLS: "true"
17 # Traefik labels are suggested as an example for people using Traefik, 25 # Traefik labels are suggested as an example for people using Traefik,
18 # remove them if you are using another reverse proxy. 26 # remove them if you are using another reverse proxy.
19 labels: 27 labels:
@@ -23,13 +31,22 @@ services:
23 volumes: 31 volumes:
24 - ./data:/usr/src/app/data 32 - ./data:/usr/src/app/data
25 depends_on: 33 depends_on:
26 - db 34 - postgres
35 - redis
36 restart: "always"
27 37
28 db: 38 postgres:
29 image: postgres:10 39 image: postgres:10
30 environment: 40 environment:
31 POSTGRES_USERNAME: user 41 POSTGRES_USER: postgres_user
32 POSTGRES_PASSWORD: password 42 POSTGRES_PASSWORD: postgres_password
33 POSTGRES_DB: peertube_prod 43 POSTGRES_DB: peertube
34 volumes: 44 volumes:
35 - ./db:/var/lib/postgresql/data 45 - ./db:/var/lib/postgresql/data
46 restart: "always"
47
48 redis:
49 image: redis
50 volumes:
51 - ./redis:/data
52 restart: "always"