diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/doc/production.md | 50 | ||||
-rw-r--r-- | support/nginx/peertube (renamed from support/nginx/peertube-https) | 6 | ||||
-rw-r--r-- | support/systemd/peertube.service | 7 |
3 files changed, 35 insertions, 28 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 |
diff --git a/support/nginx/peertube-https b/support/nginx/peertube index c3465f74b..f7be64424 100644 --- a/support/nginx/peertube-https +++ b/support/nginx/peertube | |||
@@ -2,7 +2,9 @@ server { | |||
2 | listen 80; | 2 | listen 80; |
3 | # listen [::]:80; | 3 | # listen [::]:80; |
4 | server_name domain.tld; | 4 | server_name domain.tld; |
5 | rewrite ^ https://$server_name$request_uri? permanent; | 5 | |
6 | location /.well-known/acme-challenge/ { allow all; } | ||
7 | location / { return 301 https://$host$request_uri; } | ||
6 | } | 8 | } |
7 | 9 | ||
8 | server { | 10 | server { |
@@ -49,7 +51,7 @@ server { | |||
49 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | 51 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; |
50 | } | 52 | } |
51 | 53 | ||
52 | alias /your/installation/PeerTube/videos; | 54 | alias /home/peertube/storage/videos; |
53 | } | 55 | } |
54 | 56 | ||
55 | # Websocket tracker | 57 | # Websocket tracker |
diff --git a/support/systemd/peertube.service b/support/systemd/peertube.service index b9d01f235..03ead9fbd 100644 --- a/support/systemd/peertube.service +++ b/support/systemd/peertube.service | |||
@@ -5,10 +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 | User=myuser | 8 | Environment=NODE_CONFIG_DIR=/home/peertube/config |
9 | Group=myuser | 9 | User=peertube |
10 | Group=peertube | ||
10 | ExecStart=/usr/bin/npm start | 11 | ExecStart=/usr/bin/npm start |
11 | WorkingDirectory=/path/to/peertube | 12 | WorkingDirectory=/home/peertube/peertube-latest |
12 | StandardOutput=syslog | 13 | StandardOutput=syslog |
13 | StandardError=syslog | 14 | StandardError=syslog |
14 | SyslogIdentifier=peertube | 15 | SyslogIdentifier=peertube |