aboutsummaryrefslogtreecommitdiffhomepage
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/doc/production.md43
-rw-r--r--support/nginx/peertube6
-rw-r--r--support/systemd/peertube.service4
3 files changed, 28 insertions, 25 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
diff --git a/support/nginx/peertube b/support/nginx/peertube
index 098818e57..5261cddb4 100644
--- a/support/nginx/peertube
+++ b/support/nginx/peertube
@@ -26,13 +26,13 @@ server {
26 location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ { 26 location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ {
27 add_header Cache-Control "public, max-age=31536000, immutable"; 27 add_header Cache-Control "public, max-age=31536000, immutable";
28 28
29 alias /home/peertube/peertube-latest/client/dist/$1; 29 alias /var/www/peertube/peertube-latest/client/dist/$1;
30 } 30 }
31 31
32 location ~ ^/static/(thumbnails|avatars)/(.*)$ { 32 location ~ ^/static/(thumbnails|avatars)/(.*)$ {
33 add_header Cache-Control "public, max-age=31536000, immutable"; 33 add_header Cache-Control "public, max-age=31536000, immutable";
34 34
35 alias /home/peertube/storage/$1/$2; 35 alias /var/www/peertube/storage/$1/$2;
36 } 36 }
37 37
38 location / { 38 location / {
@@ -72,7 +72,7 @@ server {
72 access_log off; 72 access_log off;
73 } 73 }
74 74
75 alias /home/peertube/storage/videos; 75 alias /var/www/peertube/storage/videos;
76 } 76 }
77 77
78 # Websocket tracker 78 # Websocket tracker
diff --git a/support/systemd/peertube.service b/support/systemd/peertube.service
index 03ead9fbd..047ce7e56 100644
--- a/support/systemd/peertube.service
+++ b/support/systemd/peertube.service
@@ -5,11 +5,11 @@ After=network.target
5[Service] 5[Service]
6Type=simple 6Type=simple
7Environment=NODE_ENV=production 7Environment=NODE_ENV=production
8Environment=NODE_CONFIG_DIR=/home/peertube/config 8Environment=NODE_CONFIG_DIR=/var/www/peertube/config
9User=peertube 9User=peertube
10Group=peertube 10Group=peertube
11ExecStart=/usr/bin/npm start 11ExecStart=/usr/bin/npm start
12WorkingDirectory=/home/peertube/peertube-latest 12WorkingDirectory=/var/www/peertube/peertube-latest
13StandardOutput=syslog 13StandardOutput=syslog
14StandardError=syslog 14StandardError=syslog
15SyslogIdentifier=peertube 15SyslogIdentifier=peertube