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