diff options
Diffstat (limited to 'support/doc')
-rw-r--r-- | support/doc/production.md | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/support/doc/production.md b/support/doc/production.md index a8ed2af88..77c9a086d 100644 --- a/support/doc/production.md +++ b/support/doc/production.md | |||
@@ -11,8 +11,8 @@ Follow the steps of the [dependencies guide](dependencies.md). | |||
11 | Create a `peertube` user with `/home/peertube` home: | 11 | Create a `peertube` user with `/home/peertube` home: |
12 | 12 | ||
13 | ``` | 13 | ``` |
14 | sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube | 14 | $ sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube |
15 | sudo passwd peertube | 15 | $ sudo passwd peertube |
16 | ``` | 16 | ``` |
17 | 17 | ||
18 | ### Database | 18 | ### Database |
@@ -20,20 +20,24 @@ sudo passwd peertube | |||
20 | Create production database and peertube user: | 20 | Create production database and peertube user: |
21 | 21 | ||
22 | ``` | 22 | ``` |
23 | sudo -u postgres createuser -P peertube | 23 | $ sudo -u postgres createuser -P peertube |
24 | sudo -u postgres createdb -O peertube peertube_prod | 24 | $ sudo -u postgres createdb -O peertube peertube_prod |
25 | ``` | 25 | ``` |
26 | 26 | ||
27 | ### Sources | 27 | ### Prepare PeerTube directory |
28 | 28 | ||
29 | Clone, install node dependencies and build application: | 29 | Check the latest release: https://github.com/Chocobozzz/PeerTube/releases or the release version you want. |
30 | We assume in the following commands the version is 0.42.42: | ||
30 | 31 | ||
31 | ``` | 32 | ``` |
32 | $ cd /home/peertube | 33 | $ VERSION="0.42.42" && \ |
33 | $ sudo -u peertube git clone -b master https://github.com/Chocobozzz/PeerTube | 34 | cd /home/peertube && \ |
34 | $ cd PeerTube | 35 | sudo -u peertube mkdir config storage versions && \ |
35 | $ sudo -u peertube yarn install --pure-lockfile | 36 | cd versions && \ |
36 | $ sudo -u peertube npm run build | 37 | sudo -u peertube wget "https://github.com/Chocobozzz/PeerTube/releases/download/v${VERSION}/peertube-v${VERSION}.zip" && \ |
38 | sudo -u peertube unzip peertube-v${VERSION}.zip && sudo -u peertube rm peertube-v${VERSION}.zip && \ | ||
39 | cd ../ && sudo -u peertube ln -s versions/peertube-v${VERSION} ./peertube-latest && \ | ||
40 | cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile | ||
37 | ``` | 41 | ``` |
38 | 42 | ||
39 | ### PeerTube configuration | 43 | ### PeerTube configuration |
@@ -41,19 +45,18 @@ $ sudo -u peertube npm run build | |||
41 | Copy example configuration: | 45 | Copy example configuration: |
42 | 46 | ||
43 | ``` | 47 | ``` |
44 | $ sudo -u peertube cp config/production.yaml.example config/production.yaml | 48 | $ cd /home/peertube && sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml |
45 | ``` | 49 | ``` |
46 | 50 | ||
47 | Then edit the `config/production.yaml` file according to your webserver | 51 | Then edit the `config/production.yaml` file according to your webserver |
48 | configuration. Keys set in this file will override those of | 52 | configuration. |
49 | `config/default.yml`. | ||
50 | 53 | ||
51 | ### Webserver | 54 | ### Webserver |
52 | 55 | ||
53 | Copy the nginx configuration template: | 56 | Copy the nginx configuration template: |
54 | 57 | ||
55 | ``` | 58 | ``` |
56 | $ sudo cp /home/peertube/PeerTube/support/nginx/peertube-https /etc/nginx/sites-available/peertube | 59 | $ sudo cp /home/peertube/PeerTube/support/nginx/peertube /etc/nginx/sites-available/peertube |
57 | ``` | 60 | ``` |
58 | 61 | ||
59 | Then modify the webserver configuration file. Please pay attention to the `alias` key of `/static/webseed` location. | 62 | Then modify the webserver configuration file. Please pay attention to the `alias` key of `/static/webseed` location. |
@@ -129,7 +132,7 @@ server { | |||
129 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | 132 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; |
130 | } | 133 | } |
131 | 134 | ||
132 | alias /var/www/PeerTube/videos; | 135 | alias /home/peertube/storage/videos; |
133 | } | 136 | } |
134 | 137 | ||
135 | # Websocket tracker | 138 | # Websocket tracker |
@@ -160,13 +163,13 @@ $ sudo systemctl reload nginx | |||
160 | Copy the nginx configuration template: | 163 | Copy the nginx configuration template: |
161 | 164 | ||
162 | ``` | 165 | ``` |
163 | sudo cp /home/peertube/PeerTube/support/systemd/peertube.service /etc/systemd/system/ | 166 | $ sudo cp /home/peertube/PeerTube/support/systemd/peertube.service /etc/systemd/system/ |
164 | ``` | 167 | ``` |
165 | 168 | ||
166 | Update the service file: | 169 | Update the service file: |
167 | 170 | ||
168 | ``` | 171 | ``` |
169 | sudo vim /etc/systemd/system/peertube.service | 172 | $ sudo vim /etc/systemd/system/peertube.service |
170 | ``` | 173 | ``` |
171 | 174 | ||
172 | It should look like this: | 175 | It should look like this: |
@@ -179,10 +182,11 @@ After=network.target | |||
179 | [Service] | 182 | [Service] |
180 | Type=simple | 183 | Type=simple |
181 | Environment=NODE_ENV=production | 184 | Environment=NODE_ENV=production |
185 | Environment=NODE_CONFIG_DIR=/home/peertube/config | ||
182 | User=peertube | 186 | User=peertube |
183 | Group=peertube | 187 | Group=peertube |
184 | ExecStart=/usr/bin/npm start | 188 | ExecStart=/usr/bin/npm start |
185 | WorkingDirectory=/home/peertube/PeerTube | 189 | WorkingDirectory=/home/peertube/peertube-latest |
186 | StandardOutput=syslog | 190 | StandardOutput=syslog |
187 | StandardError=syslog | 191 | StandardError=syslog |
188 | SyslogIdentifier=peertube | 192 | SyslogIdentifier=peertube |
@@ -196,20 +200,20 @@ WantedBy=multi-user.target | |||
196 | Tell systemd to reload its config: | 200 | Tell systemd to reload its config: |
197 | 201 | ||
198 | ``` | 202 | ``` |
199 | sudo systemctl daemon-reload | 203 | $ sudo systemctl daemon-reload |
200 | ``` | 204 | ``` |
201 | 205 | ||
202 | If you want to start PeerTube on boot: | 206 | If you want to start PeerTube on boot: |
203 | 207 | ||
204 | ``` | 208 | ``` |
205 | sudo systemctl enabled peertube | 209 | $ sudo systemctl enabled peertube |
206 | ``` | 210 | ``` |
207 | 211 | ||
208 | ### Run | 212 | ### Run |
209 | 213 | ||
210 | ``` | 214 | ``` |
211 | sudo systemctl start peertube | 215 | $ sudo systemctl start peertube |
212 | sudo journalctl -feu peertube | 216 | $ sudo journalctl -feu peertube |
213 | ``` | 217 | ``` |
214 | 218 | ||
215 | ### Administrator | 219 | ### Administrator |