diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-23 09:00:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-23 09:00:23 +0100 |
commit | 59c48d49c5f06a46c342b4e7f86fbd1ed9894bd6 (patch) | |
tree | 84bae36b9953b0369946a686faac1ed6cb5f82da /support | |
parent | e5203ffa1260ee03f0f84ef6b65d57ccad5ee695 (diff) | |
download | PeerTube-59c48d49c5f06a46c342b4e7f86fbd1ed9894bd6.tar.gz PeerTube-59c48d49c5f06a46c342b4e7f86fbd1ed9894bd6.tar.zst PeerTube-59c48d49c5f06a46c342b4e7f86fbd1ed9894bd6.zip |
Peertube home in /var/www instead of /home
Diffstat (limited to 'support')
-rw-r--r-- | support/doc/production.md | 43 | ||||
-rw-r--r-- | support/nginx/peertube | 6 | ||||
-rw-r--r-- | support/systemd/peertube.service | 4 |
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 | ||
11 | Create a `peertube` user with `/home/peertube` home: | 11 | Create 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 | ||
17 | Set its password: | 17 | Set 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 | |||
37 | Open the peertube directory, create a few required directories | 38 | Open the peertube directory, create a few required directories |
38 | ``` | 39 | ``` |
39 | cd /home/peertube && sudo -u peertube mkdir config storage versions && cd versions | 40 | cd /var/www/peertube && sudo -u peertube mkdir config storage versions && cd versions |
40 | ``` | 41 | ``` |
42 | |||
41 | Download the latest version of the Peertube client, unzip it and remove the zip | 43 | Download 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" && \ | 45 | sudo -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 | 46 | sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip |
45 | ``` | 47 | ``` |
48 | |||
46 | Install Peertube | 49 | Install Peertube |
47 | ``` | 50 | ``` |
48 | cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \ | 51 | cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \ |
49 | cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile | 52 | cd ./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 | |||
54 | Copy example configuration: | 57 | Copy 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 | ||
60 | Then edit the `config/production.yaml` file according to your webserver | 63 | Then edit the `config/production.yaml` file according to your webserver |
@@ -65,7 +68,7 @@ configuration. | |||
65 | Copy the nginx configuration template: | 68 | Copy 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 | ||
71 | Then modify the webserver configuration file. Please pay attention to the `alias` keys of the static locations. | 74 | Then 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 | |||
187 | Copy the nginx configuration template: | 190 | Copy 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 | ||
193 | Update the service file: | 196 | Update the service file: |
@@ -206,11 +209,11 @@ After=network.target | |||
206 | [Service] | 209 | [Service] |
207 | Type=simple | 210 | Type=simple |
208 | Environment=NODE_ENV=production | 211 | Environment=NODE_ENV=production |
209 | Environment=NODE_CONFIG_DIR=/home/peertube/config | 212 | Environment=NODE_CONFIG_DIR=/var/www/peertube/config |
210 | User=peertube | 213 | User=peertube |
211 | Group=peertube | 214 | Group=peertube |
212 | ExecStart=/usr/bin/npm start | 215 | ExecStart=/usr/bin/npm start |
213 | WorkingDirectory=/home/peertube/peertube-latest | 216 | WorkingDirectory=/var/www/peertube/peertube-latest |
214 | StandardOutput=syslog | 217 | StandardOutput=syslog |
215 | StandardError=syslog | 218 | StandardError=syslog |
216 | SyslogIdentifier=peertube | 219 | SyslogIdentifier=peertube |
@@ -246,7 +249,7 @@ The administrator password is automatically generated and can be found in the | |||
246 | logs. You can set another password with: | 249 | logs. 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 | ||
262 | Update your configuration file. **If some keys are missing, your upgraded PeerTube won't start!** | 265 | Update 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 | ||
268 | Upgrade PeerTube: | 271 | Upgrade 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] |
6 | Type=simple | 6 | Type=simple |
7 | Environment=NODE_ENV=production | 7 | Environment=NODE_ENV=production |
8 | Environment=NODE_CONFIG_DIR=/home/peertube/config | 8 | Environment=NODE_CONFIG_DIR=/var/www/peertube/config |
9 | User=peertube | 9 | User=peertube |
10 | Group=peertube | 10 | Group=peertube |
11 | ExecStart=/usr/bin/npm start | 11 | ExecStart=/usr/bin/npm start |
12 | WorkingDirectory=/home/peertube/peertube-latest | 12 | WorkingDirectory=/var/www/peertube/peertube-latest |
13 | StandardOutput=syslog | 13 | StandardOutput=syslog |
14 | StandardError=syslog | 14 | StandardError=syslog |
15 | SyslogIdentifier=peertube | 15 | SyslogIdentifier=peertube |