]>
Commit | Line | Data |
---|---|---|
4df6a1b8 C |
1 | # Docker guide |
2 | ||
b8f3e6b0 | 3 | This 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 | |
7 | docker 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 | 13 | name is definitive after your first PeerTube start. |
4df6a1b8 | 14 | |
a30995fc RK |
15 | #### Go to your workdir |
16 | ||
3f9f1bce C |
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 | ::: | |
b44a9630 | 20 | |
e962e1c3 | 21 | ```shell |
b8f3e6b0 | 22 | cd /your/peertube/directory |
e962e1c3 K |
23 | ``` |
24 | ||
25 | #### Get the latest Compose file | |
26 | ||
27 | ```shell | |
c9595426 | 28 | curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml > docker-compose.yml |
e962e1c3 K |
29 | ``` |
30 | ||
c9595426 | 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) |
e962e1c3 | 32 | |
e962e1c3 K |
33 | #### Get the latest env_file |
34 | ||
35 | ```shell | |
c9595426 | 36 | curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env > .env |
e962e1c3 K |
37 | ``` |
38 | ||
c9595426 | 39 | View 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 | 44 | sudo 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 | 50 | sudo nano .env |
e962e1c3 | 51 | ``` |
b8f3e6b0 | 52 | |
c9595426 | 53 | In 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 | |
60 | Other 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 |
62 | intuited from usage. |
63 | ||
afd4ee86 | 64 | #### Webserver |
e962e1c3 | 65 | |
3f9f1bce C |
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.::: | |
afd4ee86 C |
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 | ||
afd4ee86 C |
72 | ```shell |
73 | mkdir -p docker-volume/nginx | |
c9595426 | 74 | curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/nginx/peertube > docker-volume/nginx/peertube |
e962e1c3 | 75 | ``` |
afd4ee86 C |
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 | |
e962e1c3 K |
82 | ``` |
83 | ||
0a0e0d08 | 84 | A dedicated container in the docker-compose will automatically renew this certificate and reload nginx. |
afd4ee86 C |
85 | |
86 | ||
87 | #### Test your setup | |
88 | ||
85ae7291 | 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 | ||
afd4ee86 | 91 | Run your containers: |
f83e339b FP |
92 | |
93 | ```shell | |
e962e1c3 | 94 | docker-compose up |
f83e339b | 95 | ``` |
b8f3e6b0 | 96 | |
f930450a | 97 | #### Obtaining your automatically-generated admin credentials |
b8f3e6b0 | 98 | |
85ae7291 | 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. | |
b8f3e6b0 RK |
105 | |
106 | ```bash | |
00ee545c | 107 | docker-compose logs peertube | grep -A1 root |
76d5770b L |
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 | ``` | |
ef48a0d5 | 112 | |
f930450a | 113 | #### Obtaining Your Automatically Generated DKIM DNS TXT Record |
b8f3e6b0 | 114 | |
cd7ec86f | 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/). |
b8f3e6b0 | 116 | |
83d4aba6 | 117 | Run `cat ./docker-volume/opendkim/keys/*/*.txt` to display your DKIM DNS TXT Record containing the public key to configure to your domain : |
b8f3e6b0 RK |
118 | |
119 | ```bash | |
00ee545c | 120 | cat ./docker-volume/opendkim/keys/*/*.txt |
cd7ec86f | 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 | ||
f930450a | 127 | #### Administrator password |
23cbb0f3 | 128 | |
f44cd95c | 129 | See the production guide ["Administrator" section](https://docs.joinpeertube.org/install/any-os#administrator) |
23cbb0f3 | 130 | |
f930450a | 131 | #### What now? |
57c36b27 | 132 | |
f44cd95c | 133 | See the production guide ["What now" section](https://docs.joinpeertube.org/install/any-os#what-now). |
57c36b27 | 134 | |
f930450a | 135 | ## Upgrade |
b44a9630 | 136 | |
3f9f1bce C |
137 | ::: warning |
138 | Check the changelog (in particular the *IMPORTANT NOTES* section):** https://github.com/Chocobozzz/PeerTube/blob/develop/CHANGELOG.md | |
139 | ::: | |
e359e88b | 140 | |
b826b339 | 141 | Pull the latest images: |
b44a9630 | 142 | |
f83e339b | 143 | ```shell |
00ee545c C |
144 | cd /your/peertube/directory |
145 | docker-compose pull | |
14d3bb9c | 146 | ``` |
b826b339 C |
147 | |
148 | Stop, delete the containers and internal volumes (to invalidate static client files shared by `peertube` and `webserver` containers): | |
149 | ||
150 | ```shell | |
00ee545c | 151 | docker-compose down -v |
b826b339 C |
152 | ``` |
153 | ||
154 | Rerun PeerTube: | |
155 | ||
156 | ```shell | |
00ee545c | 157 | docker-compose up -d |
b44a9630 C |
158 | ``` |
159 | ||
f930450a C |
160 | ## Build |
161 | ||
162 | ### Production | |
b44a9630 | 163 | |
f83e339b | 164 | ```shell |
00ee545c C |
165 | git clone https://github.com/chocobozzz/PeerTube /tmp/peertube |
166 | cd /tmp/peertube | |
167 | docker build . -f ./support/docker/production/Dockerfile.bullseye | |
b44a9630 C |
168 | ``` |
169 | ||
f930450a | 170 | ### Development |
4df6a1b8 | 171 | |
83d4aba6 | 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! |