aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc
diff options
context:
space:
mode:
Diffstat (limited to 'support/doc')
-rw-r--r--support/doc/production.md43
1 files changed, 23 insertions, 20 deletions
diff --git a/support/doc/production.md b/support/doc/production.md
index ee8bf2647..606f13c9b 100644
--- a/support/doc/production.md
+++ b/support/doc/production.md
@@ -8,10 +8,10 @@ Follow the steps of the [dependencies guide](dependencies.md).
8 8
9### PeerTube user 9### PeerTube user
10 10
11Create a `peertube` user with `/home/peertube` home: 11Create a `peertube` user with `/var/www/peertube` home:
12 12
13``` 13```
14$ sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube 14$ sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
15``` 15```
16 16
17Set its password: 17Set its password:
@@ -34,19 +34,22 @@ Fetch the latest tagged version of Peertube
34``` 34```
35$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Peertube version is $VERSION" 35$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Peertube version is $VERSION"
36``` 36```
37
37Open the peertube directory, create a few required directories 38Open the peertube directory, create a few required directories
38``` 39```
39 cd /home/peertube && sudo -u peertube mkdir config storage versions && cd versions 40cd /var/www/peertube && sudo -u peertube mkdir config storage versions && cd versions
40``` 41```
42
41Download the latest version of the Peertube client, unzip it and remove the zip 43Download the latest version of the Peertube client, unzip it and remove the zip
42``` 44```
43 sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \ 45sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \
44 sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip 46sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip
45``` 47```
48
46Install Peertube 49Install Peertube
47``` 50```
48 cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \ 51cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \
49 cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile 52cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile
50``` 53```
51 54
52### PeerTube configuration 55### PeerTube configuration
@@ -54,7 +57,7 @@ Install Peertube
54Copy example configuration: 57Copy example configuration:
55 58
56``` 59```
57$ cd /home/peertube && sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml 60$ cd /var/www/peertube && sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml
58``` 61```
59 62
60Then edit the `config/production.yaml` file according to your webserver 63Then edit the `config/production.yaml` file according to your webserver
@@ -65,7 +68,7 @@ configuration.
65Copy the nginx configuration template: 68Copy the nginx configuration template:
66 69
67``` 70```
68$ sudo cp /home/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube 71$ sudo cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube
69``` 72```
70 73
71Then modify the webserver configuration file. Please pay attention to the `alias` keys of the static locations. 74Then modify the webserver configuration file. Please pay attention to the `alias` keys of the static locations.
@@ -112,13 +115,13 @@ server {
112 location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ { 115 location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ {
113 add_header Cache-Control "public, max-age=31536000, immutable"; 116 add_header Cache-Control "public, max-age=31536000, immutable";
114 117
115 alias /home/peertube/peertube-latest/client/dist/$1; 118 alias /var/www/peertube/peertube-latest/client/dist/$1;
116 } 119 }
117 120
118 location ~ ^/static/(thumbnails|avatars)/(.*)$ { 121 location ~ ^/static/(thumbnails|avatars)/(.*)$ {
119 add_header Cache-Control "public, max-age=31536000, immutable"; 122 add_header Cache-Control "public, max-age=31536000, immutable";
120 123
121 alias /home/peertube/storage/$1/$2; 124 alias /var/www/peertube/storage/$1/$2;
122 } 125 }
123 126
124 location / { 127 location / {
@@ -156,7 +159,7 @@ server {
156 access_log off; 159 access_log off;
157 } 160 }
158 161
159 alias /home/peertube/storage/videos; 162 alias /var/www/peertube/storage/videos;
160 } 163 }
161 164
162 # Websocket tracker 165 # Websocket tracker
@@ -187,7 +190,7 @@ $ sudo systemctl reload nginx
187Copy the nginx configuration template: 190Copy the nginx configuration template:
188 191
189``` 192```
190$ sudo cp /home/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/ 193$ sudo cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/
191``` 194```
192 195
193Update the service file: 196Update the service file:
@@ -206,11 +209,11 @@ After=network.target
206[Service] 209[Service]
207Type=simple 210Type=simple
208Environment=NODE_ENV=production 211Environment=NODE_ENV=production
209Environment=NODE_CONFIG_DIR=/home/peertube/config 212Environment=NODE_CONFIG_DIR=/var/www/peertube/config
210User=peertube 213User=peertube
211Group=peertube 214Group=peertube
212ExecStart=/usr/bin/npm start 215ExecStart=/usr/bin/npm start
213WorkingDirectory=/home/peertube/peertube-latest 216WorkingDirectory=/var/www/peertube/peertube-latest
214StandardOutput=syslog 217StandardOutput=syslog
215StandardError=syslog 218StandardError=syslog
216SyslogIdentifier=peertube 219SyslogIdentifier=peertube
@@ -246,7 +249,7 @@ The administrator password is automatically generated and can be found in the
246logs. You can set another password with: 249logs. You can set another password with:
247 250
248``` 251```
249$ cd /home/peertube/peertube-latest && NODE_CONFIG_DIR=/home/peertube/config NODE_ENV=production npm run reset-password -- -u root 252$ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root
250``` 253```
251 254
252## Upgrade 255## Upgrade
@@ -255,21 +258,21 @@ Make a SQL backup:
255 258
256``` 259```
257$ SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \ 260$ SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \
258 cd /home/peertube && sudo -u peertube mkdir -p backup && \ 261 cd /var/www/peertube && sudo -u peertube mkdir -p backup && \
259 sudo pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" 262 sudo pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH"
260``` 263```
261 264
262Update your configuration file. **If some keys are missing, your upgraded PeerTube won't start!** 265Update your configuration file. **If some keys are missing, your upgraded PeerTube won't start!**
263 266
264``` 267```
265$ diff <(curl -s https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/config/production.yaml.example) /home/peertube/config/production.yaml 268$ diff <(curl -s https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/config/production.yaml.example) /var/www/peertube/config/production.yaml
266``` 269```
267 270
268Upgrade PeerTube: 271Upgrade PeerTube:
269 272
270``` 273```
271$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && \ 274$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && \
272 cd /home/peertube/versions && \ 275 cd /var/www/peertube/versions && \
273 sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \ 276 sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \
274 sudo -u peertube unzip -o peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip && \ 277 sudo -u peertube unzip -o peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip && \
275 cd ../ && sudo rm ./peertube-latest && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \ 278 cd ../ && sudo rm ./peertube-latest && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \
@@ -281,7 +284,7 @@ Things went wrong? Change `peertube-latest` destination to the previous version
281 284
282``` 285```
283$ OLD_VERSION="v0.42.42" && SQL_BACKUP_PATH="backup/sql-peertube_prod-2018-01-19T10:18+01:00.bak" && \ 286$ OLD_VERSION="v0.42.42" && SQL_BACKUP_PATH="backup/sql-peertube_prod-2018-01-19T10:18+01:00.bak" && \
284 cd /home/peertube && rm ./peertube-latest && \ 287 cd /var/www/peertube && rm ./peertube-latest && \
285 sudo -u peertube ln -s "versions/peertube-$OLD_VERSION" peertube-latest && \ 288 sudo -u peertube ln -s "versions/peertube-$OLD_VERSION" peertube-latest && \
286 pg_restore -U peertube -c -d peertube_prod "$SQL_BACKUP_PATH" 289 pg_restore -U peertube -c -d peertube_prod "$SQL_BACKUP_PATH"
287 sudo systemctl restart peertube 290 sudo systemctl restart peertube