aboutsummaryrefslogtreecommitdiffhomepage
path: root/support
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-15 17:56:58 +0100
committerChocobozzz <me@florianbigard.com>2018-01-15 18:07:08 +0100
commitd2000ca6e7fa77758d4f811e4a8af11108d2655d (patch)
treed40860d17f33eacd33f79780fab08ecb7e6e46a7 /support
parent53733ec2abd4b7588c85cdd37824b0082b46f188 (diff)
downloadPeerTube-d2000ca6e7fa77758d4f811e4a8af11108d2655d.tar.gz
PeerTube-d2000ca6e7fa77758d4f811e4a8af11108d2655d.tar.zst
PeerTube-d2000ca6e7fa77758d4f811e4a8af11108d2655d.zip
Update production guide
Use release that already contains build files. It requires a specific directories tree but I think it would be fine.
Diffstat (limited to 'support')
-rw-r--r--support/doc/production.md50
-rw-r--r--support/nginx/peertube (renamed from support/nginx/peertube-https)6
-rw-r--r--support/systemd/peertube.service7
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).
11Create a `peertube` user with `/home/peertube` home: 11Create a `peertube` user with `/home/peertube` home:
12 12
13``` 13```
14sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube 14$ sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube
15sudo passwd peertube 15$ sudo passwd peertube
16``` 16```
17 17
18### Database 18### Database
@@ -20,20 +20,24 @@ sudo passwd peertube
20Create production database and peertube user: 20Create production database and peertube user:
21 21
22``` 22```
23sudo -u postgres createuser -P peertube 23$ sudo -u postgres createuser -P peertube
24sudo -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
29Clone, install node dependencies and build application: 29Check the latest release: https://github.com/Chocobozzz/PeerTube/releases or the release version you want.
30We 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
41Copy example configuration: 45Copy 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
47Then edit the `config/production.yaml` file according to your webserver 51Then edit the `config/production.yaml` file according to your webserver
48configuration. Keys set in this file will override those of 52configuration.
49`config/default.yml`.
50 53
51### Webserver 54### Webserver
52 55
53Copy the nginx configuration template: 56Copy 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
59Then modify the webserver configuration file. Please pay attention to the `alias` key of `/static/webseed` location. 62Then 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
160Copy the nginx configuration template: 163Copy the nginx configuration template:
161 164
162``` 165```
163sudo 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
166Update the service file: 169Update the service file:
167 170
168``` 171```
169sudo vim /etc/systemd/system/peertube.service 172$ sudo vim /etc/systemd/system/peertube.service
170``` 173```
171 174
172It should look like this: 175It should look like this:
@@ -179,10 +182,11 @@ After=network.target
179[Service] 182[Service]
180Type=simple 183Type=simple
181Environment=NODE_ENV=production 184Environment=NODE_ENV=production
185Environment=NODE_CONFIG_DIR=/home/peertube/config
182User=peertube 186User=peertube
183Group=peertube 187Group=peertube
184ExecStart=/usr/bin/npm start 188ExecStart=/usr/bin/npm start
185WorkingDirectory=/home/peertube/PeerTube 189WorkingDirectory=/home/peertube/peertube-latest
186StandardOutput=syslog 190StandardOutput=syslog
187StandardError=syslog 191StandardError=syslog
188SyslogIdentifier=peertube 192SyslogIdentifier=peertube
@@ -196,20 +200,20 @@ WantedBy=multi-user.target
196Tell systemd to reload its config: 200Tell systemd to reload its config:
197 201
198``` 202```
199sudo systemctl daemon-reload 203$ sudo systemctl daemon-reload
200``` 204```
201 205
202If you want to start PeerTube on boot: 206If you want to start PeerTube on boot:
203 207
204``` 208```
205sudo systemctl enabled peertube 209$ sudo systemctl enabled peertube
206``` 210```
207 211
208### Run 212### Run
209 213
210``` 214```
211sudo systemctl start peertube 215$ sudo systemctl start peertube
212sudo 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
8server { 10server {
@@ -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]
6Type=simple 6Type=simple
7Environment=NODE_ENV=production 7Environment=NODE_ENV=production
8User=myuser 8Environment=NODE_CONFIG_DIR=/home/peertube/config
9Group=myuser 9User=peertube
10Group=peertube
10ExecStart=/usr/bin/npm start 11ExecStart=/usr/bin/npm start
11WorkingDirectory=/path/to/peertube 12WorkingDirectory=/home/peertube/peertube-latest
12StandardOutput=syslog 13StandardOutput=syslog
13StandardError=syslog 14StandardError=syslog
14SyslogIdentifier=peertube 15SyslogIdentifier=peertube