]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/docker.md
Improve responsive on medium destkop screens
[github/Chocobozzz/PeerTube.git] / support / doc / docker.md
CommitLineData
4df6a1b8
C
1# Docker guide
2
b8f3e6b0 3This guide requires [docker](https://www.docker.com/community-edition) and
3f9f1bce
C
4[docker-compose V2](https://docs.docker.com/compose/install/).
5
6```shell
7docker compose version # Must be > 2.x.x
8```
4df6a1b8 9
f930450a 10## Install
4df6a1b8 11
83d4aba6 12**PeerTube does not support webserver host change**. Keep in mind your domain
b8f3e6b0 13name is definitive after your first PeerTube start.
4df6a1b8 14
a30995fc
RK
15#### Go to your workdir
16
3f9f1bce
C
17:::info
18The guide that follows assumes an empty workdir, but you can also clone the repository, use the master branch and `cd support/docker/production`.
19:::
b44a9630 20
e962e1c3 21```shell
b8f3e6b0 22cd /your/peertube/directory
e962e1c3
K
23```
24
25#### Get the latest Compose file
26
27```shell
c9595426 28curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml > docker-compose.yml
e962e1c3
K
29```
30
c9595426 31View the source of the file you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/docker-compose.yml)
e962e1c3 32
e962e1c3
K
33#### Get the latest env_file
34
35```shell
c9595426 36curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env > .env
e962e1c3
K
37```
38
c9595426 39View the source of the file you're about to download: [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env)
e962e1c3 40
e962e1c3
K
41#### Tweak the `docker-compose.yml` file there according to your needs
42
43```shell
85ae7291 44sudo nano docker-compose.yml
e962e1c3
K
45```
46
a30995fc 47#### Then tweak the `.env` file to change the environment variables settings
e962e1c3
K
48
49```shell
85ae7291 50sudo nano .env
e962e1c3 51```
b8f3e6b0 52
c9595426 53In the downloaded example [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env), you must replace:
e962e1c3
K
54- `<MY POSTGRES USERNAME>`
55- `<MY POSTGRES PASSWORD>`
e962e1c3
K
56- `<MY DOMAIN>` without 'https://'
57- `<MY EMAIL ADDRESS>`
1ea868a9 58- `<MY PEERTUBE SECRET>`
ef48a0d5
BB
59
60Other environment variables are used in
c9595426 61[/support/docker/production/config/custom-environment-variables.yaml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/config/custom-environment-variables.yaml) and can be
ef48a0d5
BB
62intuited from usage.
63
afd4ee86 64#### Webserver
e962e1c3 65
3f9f1bce 66::: info
77666e34
C
67The docker compose file includes a configured web server. You can skip this part and comment the appropriate section in the docker compose if you use another webserver/proxy.
68:::
afd4ee86
C
69
70Install the template that the nginx container will use.
71The container will generate the configuration by replacing `${WEBSERVER_HOST}` and `${PEERTUBE_HOST}` using your docker compose env file.
72
afd4ee86
C
73```shell
74mkdir -p docker-volume/nginx
c9595426 75curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/nginx/peertube > docker-volume/nginx/peertube
e962e1c3 76```
afd4ee86
C
77
78You need to manually generate the first SSL/TLS certificate using Let's Encrypt:
79
80```shell
81mkdir -p docker-volume/certbot
82docker run -it --rm --name certbot -p 80:80 -v "$(pwd)/docker-volume/certbot/conf:/etc/letsencrypt" certbot/certbot certonly --standalone
e962e1c3
K
83```
84
0a0e0d08 85A dedicated container in the docker-compose will automatically renew this certificate and reload nginx.
afd4ee86
C
86
87
88#### Test your setup
89
85ae7291 90_note_: Newer versions of compose are called with `docker compose` instead of `docker-compose`, so remove the dash in all steps that use this command if you are getting errors.
91
afd4ee86 92Run your containers:
f83e339b
FP
93
94```shell
77666e34 95docker compose up
f83e339b 96```
b8f3e6b0 97
f930450a 98#### Obtaining your automatically-generated admin credentials
b8f3e6b0 99
85ae7291 100You can change the automatically created password for user root by running this command from peertube's root directory:
101```shell
77666e34 102docker compose exec -u peertube peertube npm run reset-password -- -u root
85ae7291 103```
104
105You can also grep your peertube container's logs for the default `root` password. You're going to want to run `docker-compose logs peertube | grep -A1 root` to search the log output for your new PeerTube's instance admin credentials which will look something like this.
b8f3e6b0
RK
106
107```bash
77666e34 108docker compose logs peertube | grep -A1 root
76d5770b
L
109
110peertube_1 | [example.com:443] 2019-11-16 04:26:06.082 info: Username: root
111peertube_1 | [example.com:443] 2019-11-16 04:26:06.083 info: User password: abcdefghijklmnop
112```
ef48a0d5 113
f930450a 114#### Obtaining Your Automatically Generated DKIM DNS TXT Record
b8f3e6b0 115
cd7ec86f 116[DKIM](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail) signature sending and RSA keys generation are enabled by the default Postfix image `mwader/postfix-relay` with [OpenDKIM](http://www.opendkim.org/).
b8f3e6b0 117
83d4aba6 118Run `cat ./docker-volume/opendkim/keys/*/*.txt` to display your DKIM DNS TXT Record containing the public key to configure to your domain :
b8f3e6b0
RK
119
120```bash
00ee545c 121cat ./docker-volume/opendkim/keys/*/*.txt
cd7ec86f 122
123peertube._domainkey.mydomain.tld. IN TXT ( "v=DKIM1; h=sha256; k=rsa; "
124 "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Dx7wLGPFVaxVQ4TGym/eF89aQ8oMxS9v5BCc26Hij91t2Ci8Fl12DHNVqZoIPGm+9tTIoDVDFEFrlPhMOZl8i4jU9pcFjjaIISaV2+qTa8uV1j3MyByogG8pu4o5Ill7zaySYFsYB++cHJ9pjbFSC42dddCYMfuVgrBsLNrvEi3dLDMjJF5l92Uu8YeswFe26PuHX3Avr261n"
125 "j5joTnYwat4387VEUyGUnZ0aZxCERi+ndXv2/wMJ0tizq+a9+EgqIb+7lkUc2XciQPNuTujM25GhrQBEKznvHyPA6fHsFheymOuB763QpkmnQQLCxyLygAY9mE/5RY+5Q6J9oDOQIDAQAB" ) ; ----- DKIM key peertube for mydomain.tld
126```
127
f930450a 128#### Administrator password
23cbb0f3 129
f44cd95c 130See the production guide ["Administrator" section](https://docs.joinpeertube.org/install/any-os#administrator)
23cbb0f3 131
f930450a 132#### What now?
57c36b27 133
f44cd95c 134See the production guide ["What now" section](https://docs.joinpeertube.org/install/any-os#what-now).
57c36b27 135
f930450a 136## Upgrade
b44a9630 137
3f9f1bce
C
138::: warning
139Check the changelog (in particular the *IMPORTANT NOTES* section):** https://github.com/Chocobozzz/PeerTube/blob/develop/CHANGELOG.md
140:::
e359e88b 141
b826b339 142Pull the latest images:
b44a9630 143
f83e339b 144```shell
00ee545c 145cd /your/peertube/directory
77666e34 146docker compose pull
14d3bb9c 147```
b826b339
C
148
149Stop, delete the containers and internal volumes (to invalidate static client files shared by `peertube` and `webserver` containers):
150
151```shell
77666e34 152docker compose down -v
b826b339
C
153```
154
155Rerun PeerTube:
156
157```shell
77666e34 158docker compose up -d
b44a9630
C
159```
160
f930450a
C
161## Build
162
163### Production
b44a9630 164
f83e339b 165```shell
00ee545c
C
166git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
167cd /tmp/peertube
168docker build . -f ./support/docker/production/Dockerfile.bullseye
b44a9630
C
169```
170
f930450a 171### Development
4df6a1b8 172
83d4aba6 173We 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!