diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-08 09:44:14 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-08 09:44:14 +0100 |
commit | a23f6c94edee1cb11875585a64dc61f1004c1792 (patch) | |
tree | d77354473d388e3ebb41fe8ce48204f3fbeba4d1 | |
parent | 2d4822e3afb535287067d79c46063a05683e0330 (diff) | |
download | PeerTube-a23f6c94edee1cb11875585a64dc61f1004c1792.tar.gz PeerTube-a23f6c94edee1cb11875585a64dc61f1004c1792.tar.zst PeerTube-a23f6c94edee1cb11875585a64dc61f1004c1792.zip |
Improve production guide
Add syntax highlighting
Add emoji on section titles to better differenciate each section
-rw-r--r-- | support/doc/production.md | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/support/doc/production.md b/support/doc/production.md index 790e43f31..e711f0997 100644 --- a/support/doc/production.md +++ b/support/doc/production.md | |||
@@ -8,36 +8,36 @@ | |||
8 | Please don't install PeerTube for production on a device behind a low bandwidth connection (example: your ADSL link). | 8 | Please don't install PeerTube for production on a device behind a low bandwidth connection (example: your ADSL link). |
9 | If you want information about the appropriate hardware to run PeerTube, please see the [FAQ](https://joinpeertube.org/en_US/faq#should-i-have-a-big-server-to-run-peertube). | 9 | If you want information about the appropriate hardware to run PeerTube, please see the [FAQ](https://joinpeertube.org/en_US/faq#should-i-have-a-big-server-to-run-peertube). |
10 | 10 | ||
11 | ### Dependencies | 11 | ### :hammer: Dependencies |
12 | 12 | ||
13 | **Follow the steps of the [dependencies guide](dependencies.md).** | 13 | Follow the steps of the [dependencies guide](dependencies.md). |
14 | 14 | ||
15 | ### PeerTube user | 15 | ### :construction_worker: PeerTube user |
16 | 16 | ||
17 | Create a `peertube` user with `/var/www/peertube` home: | 17 | Create a `peertube` user with `/var/www/peertube` home: |
18 | 18 | ||
19 | ``` | 19 | ```bash |
20 | $ sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube | 20 | $ sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube |
21 | ``` | 21 | ``` |
22 | 22 | ||
23 | Set its password: | 23 | Set its password: |
24 | ``` | 24 | ```bash |
25 | $ sudo passwd peertube | 25 | $ sudo passwd peertube |
26 | ``` | 26 | ``` |
27 | 27 | ||
28 | **On FreeBSD** | 28 | **On FreeBSD** |
29 | 29 | ||
30 | ``` | 30 | ```bash |
31 | $ sudo pw useradd -n peertube -d /var/www/peertube -s /usr/local/bin/bash -m | 31 | $ sudo pw useradd -n peertube -d /var/www/peertube -s /usr/local/bin/bash -m |
32 | $ sudo passwd peertube | 32 | $ sudo passwd peertube |
33 | ``` | 33 | ``` |
34 | or use `adduser` to create it interactively. | 34 | or use `adduser` to create it interactively. |
35 | 35 | ||
36 | ### Database | 36 | ### :card_file_box: Database |
37 | 37 | ||
38 | Create the production database and a peertube user inside PostgreSQL: | 38 | Create the production database and a peertube user inside PostgreSQL: |
39 | 39 | ||
40 | ``` | 40 | ```bash |
41 | $ cd /var/www/peertube | 41 | $ cd /var/www/peertube |
42 | $ sudo -u postgres createuser -P peertube | 42 | $ sudo -u postgres createuser -P peertube |
43 | ``` | 43 | ``` |
@@ -45,58 +45,58 @@ $ sudo -u postgres createuser -P peertube | |||
45 | Here you should enter a password for PostgreSQL `peertube` user, that should be copied in `production.yaml` file. | 45 | Here you should enter a password for PostgreSQL `peertube` user, that should be copied in `production.yaml` file. |
46 | Don't just hit enter else it will be empty. | 46 | Don't just hit enter else it will be empty. |
47 | 47 | ||
48 | ``` | 48 | ```bash |
49 | $ sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod | 49 | $ sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod |
50 | ``` | 50 | ``` |
51 | 51 | ||
52 | Then enable extensions PeerTube needs: | 52 | Then enable extensions PeerTube needs: |
53 | 53 | ||
54 | ``` | 54 | ```bash |
55 | $ sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" peertube_prod | 55 | $ sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" peertube_prod |
56 | $ sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_prod | 56 | $ sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_prod |
57 | ``` | 57 | ``` |
58 | 58 | ||
59 | ### Prepare PeerTube directory | 59 | ### :page_facing_up: Prepare PeerTube directory |
60 | 60 | ||
61 | Fetch the latest tagged version of Peertube | 61 | Fetch the latest tagged version of Peertube |
62 | ``` | 62 | ```bash |
63 | $ 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" | 63 | $ 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" |
64 | ``` | 64 | ``` |
65 | 65 | ||
66 | Open the peertube directory, create a few required directories | 66 | Open the peertube directory, create a few required directories |
67 | ``` | 67 | ```bash |
68 | $ cd /var/www/peertube | 68 | $ cd /var/www/peertube |
69 | $ sudo -u peertube mkdir config storage versions | 69 | $ sudo -u peertube mkdir config storage versions |
70 | $ sudo -u peertube chmod 750 config/ | 70 | $ sudo -u peertube chmod 750 config/ |
71 | ``` | 71 | ``` |
72 | 72 | ||
73 | Download the latest version of the Peertube client, unzip it and remove the zip | 73 | Download the latest version of the Peertube client, unzip it and remove the zip |
74 | ``` | 74 | ```bash |
75 | $ cd /var/www/peertube/versions | 75 | $ cd /var/www/peertube/versions |
76 | $ sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" | 76 | $ sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" |
77 | $ sudo -u peertube unzip -q peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip | 77 | $ sudo -u peertube unzip -q peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip |
78 | ``` | 78 | ``` |
79 | 79 | ||
80 | Install Peertube: | 80 | Install Peertube: |
81 | ``` | 81 | ```bash |
82 | $ cd /var/www/peertube | 82 | $ cd /var/www/peertube |
83 | $ sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest | 83 | $ sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest |
84 | $ cd ./peertube-latest && sudo -H -u peertube yarn install --production --pure-lockfile | 84 | $ cd ./peertube-latest && sudo -H -u peertube yarn install --production --pure-lockfile |
85 | ``` | 85 | ``` |
86 | 86 | ||
87 | ### PeerTube configuration | 87 | ### :wrench: PeerTube configuration |
88 | 88 | ||
89 | Copy the default configuration file that contains the default configuration provided by PeerTube. | 89 | Copy the default configuration file that contains the default configuration provided by PeerTube. |
90 | You **must not** update this file. | 90 | You **must not** update this file. |
91 | 91 | ||
92 | ``` | 92 | ```bash |
93 | $ cd /var/www/peertube | 93 | $ cd /var/www/peertube |
94 | $ sudo -u peertube cp peertube-latest/config/default.yaml config/default.yaml | 94 | $ sudo -u peertube cp peertube-latest/config/default.yaml config/default.yaml |
95 | ``` | 95 | ``` |
96 | 96 | ||
97 | Now copy the production example configuration: | 97 | Now copy the production example configuration: |
98 | 98 | ||
99 | ``` | 99 | ```bash |
100 | $ cd /var/www/peertube | 100 | $ cd /var/www/peertube |
101 | $ sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml | 101 | $ sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml |
102 | ``` | 102 | ``` |
@@ -107,20 +107,20 @@ Keys defined in `config/production.yaml` will override keys defined in `config/d | |||
107 | 107 | ||
108 | **PeerTube does not support webserver host change**. Even though [PeerTube CLI can help you to switch hostname](https://docs.joinpeertube.org/maintain-tools?id=update-hostjs) there's no official support for that since it is a risky operation that might result in unforeseen errors. | 108 | **PeerTube does not support webserver host change**. Even though [PeerTube CLI can help you to switch hostname](https://docs.joinpeertube.org/maintain-tools?id=update-hostjs) there's no official support for that since it is a risky operation that might result in unforeseen errors. |
109 | 109 | ||
110 | ### Webserver | 110 | ### :truck: Webserver |
111 | 111 | ||
112 | We only provide official configuration files for Nginx. | 112 | We only provide official configuration files for Nginx. |
113 | 113 | ||
114 | Copy the nginx configuration template: | 114 | Copy the nginx configuration template: |
115 | 115 | ||
116 | ``` | 116 | ```bash |
117 | $ sudo cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube | 117 | $ sudo cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube |
118 | ``` | 118 | ``` |
119 | 119 | ||
120 | Then set the domain for the webserver configuration file. | 120 | Then set the domain for the webserver configuration file. |
121 | Replace `[peertube-domain]` with the domain for the peertube server. | 121 | Replace `[peertube-domain]` with the domain for the peertube server. |
122 | 122 | ||
123 | ``` | 123 | ```bash |
124 | $ sudo sed -i 's/${WEBSERVER_HOST}/[peertube-domain]/g' /etc/nginx/sites-available/peertube | 124 | $ sudo sed -i 's/${WEBSERVER_HOST}/[peertube-domain]/g' /etc/nginx/sites-available/peertube |
125 | $ sudo sed -i 's/${PEERTUBE_HOST}/127.0.0.1:9000/g' /etc/nginx/sites-available/peertube | 125 | $ sudo sed -i 's/${PEERTUBE_HOST}/127.0.0.1:9000/g' /etc/nginx/sites-available/peertube |
126 | ``` | 126 | ``` |
@@ -128,19 +128,19 @@ $ sudo sed -i 's/${PEERTUBE_HOST}/127.0.0.1:9000/g' /etc/nginx/sites-available/p | |||
128 | Then modify the webserver configuration file. Please pay attention to the `alias` keys of the static locations. | 128 | Then modify the webserver configuration file. Please pay attention to the `alias` keys of the static locations. |
129 | It should correspond to the paths of your storage directories (set in the configuration file inside the `storage` key). | 129 | It should correspond to the paths of your storage directories (set in the configuration file inside the `storage` key). |
130 | 130 | ||
131 | ``` | 131 | ```bash |
132 | $ sudo vim /etc/nginx/sites-available/peertube | 132 | $ sudo vim /etc/nginx/sites-available/peertube |
133 | ``` | 133 | ``` |
134 | 134 | ||
135 | Activate the configuration file: | 135 | Activate the configuration file: |
136 | 136 | ||
137 | ``` | 137 | ```bash |
138 | $ sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube | 138 | $ sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube |
139 | ``` | 139 | ``` |
140 | 140 | ||
141 | To generate the certificate for your domain as required to make https work you can use [Let's Encrypt](https://letsencrypt.org/): | 141 | To generate the certificate for your domain as required to make https work you can use [Let's Encrypt](https://letsencrypt.org/): |
142 | 142 | ||
143 | ``` | 143 | ```bash |
144 | $ sudo systemctl stop nginx | 144 | $ sudo systemctl stop nginx |
145 | $ sudo certbot certonly --standalone --post-hook "systemctl restart nginx" | 145 | $ sudo certbot certonly --standalone --post-hook "systemctl restart nginx" |
146 | $ sudo systemctl reload nginx | 146 | $ sudo systemctl reload nginx |
@@ -148,14 +148,14 @@ $ sudo systemctl reload nginx | |||
148 | 148 | ||
149 | Now you have the certificates you can reload nginx: | 149 | Now you have the certificates you can reload nginx: |
150 | 150 | ||
151 | ``` | 151 | ```bash |
152 | $ sudo systemctl reload nginx | 152 | $ sudo systemctl reload nginx |
153 | ``` | 153 | ``` |
154 | 154 | ||
155 | Certbot should have installed a cron to automatically renew your certificate. | 155 | Certbot should have installed a cron to automatically renew your certificate. |
156 | Since our nginx template supports webroot renewal, we suggest you to update the renewal config file to use the `webroot` authenticator: | 156 | Since our nginx template supports webroot renewal, we suggest you to update the renewal config file to use the `webroot` authenticator: |
157 | 157 | ||
158 | ``` | 158 | ```bash |
159 | $ # Replace authenticator = standalone by authenticator = webroot | 159 | $ # Replace authenticator = standalone by authenticator = webroot |
160 | $ # Add webroot_path = /var/www/certbot | 160 | $ # Add webroot_path = /var/www/certbot |
161 | $ sudo vim /etc/letsencrypt/renewal/your-domain.com.conf | 161 | $ sudo vim /etc/letsencrypt/renewal/your-domain.com.conf |
@@ -164,15 +164,15 @@ $ sudo vim /etc/letsencrypt/renewal/your-domain.com.conf | |||
164 | **FreeBSD** | 164 | **FreeBSD** |
165 | On FreeBSD you can use [Dehydrated](https://dehydrated.io/) `security/dehydrated` for [Let's Encrypt](https://letsencrypt.org/) | 165 | On FreeBSD you can use [Dehydrated](https://dehydrated.io/) `security/dehydrated` for [Let's Encrypt](https://letsencrypt.org/) |
166 | 166 | ||
167 | ``` | 167 | ```bash |
168 | $ sudo pkg install dehydrated | 168 | $ sudo pkg install dehydrated |
169 | ``` | 169 | ``` |
170 | 170 | ||
171 | ### TCP/IP Tuning | 171 | ### :alembic: TCP/IP Tuning |
172 | 172 | ||
173 | **On Linux** | 173 | **On Linux** |
174 | 174 | ||
175 | ``` | 175 | ```bash |
176 | $ sudo cp /var/www/peertube/peertube-latest/support/sysctl.d/30-peertube-tcp.conf /etc/sysctl.d/ | 176 | $ sudo cp /var/www/peertube/peertube-latest/support/sysctl.d/30-peertube-tcp.conf /etc/sysctl.d/ |
177 | $ sudo sysctl -p /etc/sysctl.d/30-peertube-tcp.conf | 177 | $ sudo sysctl -p /etc/sysctl.d/30-peertube-tcp.conf |
178 | ``` | 178 | ``` |
@@ -181,36 +181,36 @@ Your distro may enable this by default, but at least Debian 9 does not, and the | |||
181 | scheduler is quite prone to "Buffer Bloat" and extreme latency when dealing with slower client | 181 | scheduler is quite prone to "Buffer Bloat" and extreme latency when dealing with slower client |
182 | links as we often encounter in a video server. | 182 | links as we often encounter in a video server. |
183 | 183 | ||
184 | ### systemd | 184 | ### :bricks: systemd |
185 | 185 | ||
186 | If your OS uses systemd, copy the configuration template: | 186 | If your OS uses systemd, copy the configuration template: |
187 | 187 | ||
188 | ``` | 188 | ```bash |
189 | $ sudo cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/ | 189 | $ sudo cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/ |
190 | ``` | 190 | ``` |
191 | 191 | ||
192 | Check the service file (PeerTube paths and security directives): | 192 | Check the service file (PeerTube paths and security directives): |
193 | 193 | ||
194 | ``` | 194 | ```bash |
195 | $ sudo vim /etc/systemd/system/peertube.service | 195 | $ sudo vim /etc/systemd/system/peertube.service |
196 | ``` | 196 | ``` |
197 | 197 | ||
198 | 198 | ||
199 | Tell systemd to reload its config: | 199 | Tell systemd to reload its config: |
200 | 200 | ||
201 | ``` | 201 | ```bash |
202 | $ sudo systemctl daemon-reload | 202 | $ sudo systemctl daemon-reload |
203 | ``` | 203 | ``` |
204 | 204 | ||
205 | If you want to start PeerTube on boot: | 205 | If you want to start PeerTube on boot: |
206 | 206 | ||
207 | ``` | 207 | ```bash |
208 | $ sudo systemctl enable peertube | 208 | $ sudo systemctl enable peertube |
209 | ``` | 209 | ``` |
210 | 210 | ||
211 | Run: | 211 | Run: |
212 | 212 | ||
213 | ``` | 213 | ```bash |
214 | $ sudo systemctl start peertube | 214 | $ sudo systemctl start peertube |
215 | $ sudo journalctl -feu peertube | 215 | $ sudo journalctl -feu peertube |
216 | ``` | 216 | ``` |
@@ -218,51 +218,51 @@ $ sudo journalctl -feu peertube | |||
218 | **FreeBSD** | 218 | **FreeBSD** |
219 | On FreeBSD, copy the startup script and update rc.conf: | 219 | On FreeBSD, copy the startup script and update rc.conf: |
220 | 220 | ||
221 | ``` | 221 | ```bash |
222 | $ sudo install -m 0555 /var/www/peertube/peertube-latest/support/freebsd/peertube /usr/local/etc/rc.d/ | 222 | $ sudo install -m 0555 /var/www/peertube/peertube-latest/support/freebsd/peertube /usr/local/etc/rc.d/ |
223 | $ sudo sysrc peertube_enable="YES" | 223 | $ sudo sysrc peertube_enable="YES" |
224 | ``` | 224 | ``` |
225 | 225 | ||
226 | Run: | 226 | Run: |
227 | 227 | ||
228 | ``` | 228 | ```bash |
229 | $ sudo service peertube start | 229 | $ sudo service peertube start |
230 | ``` | 230 | ``` |
231 | 231 | ||
232 | ### OpenRC | 232 | ### :bricks: OpenRC |
233 | 233 | ||
234 | If your OS uses OpenRC, copy the service script: | 234 | If your OS uses OpenRC, copy the service script: |
235 | 235 | ||
236 | ``` | 236 | ```bash |
237 | $ sudo cp /var/www/peertube/peertube-latest/support/init.d/peertube /etc/init.d/ | 237 | $ sudo cp /var/www/peertube/peertube-latest/support/init.d/peertube /etc/init.d/ |
238 | ``` | 238 | ``` |
239 | 239 | ||
240 | If you want to start PeerTube on boot: | 240 | If you want to start PeerTube on boot: |
241 | 241 | ||
242 | ``` | 242 | ```bash |
243 | $ sudo rc-update add peertube default | 243 | $ sudo rc-update add peertube default |
244 | ``` | 244 | ``` |
245 | 245 | ||
246 | Run and print last logs: | 246 | Run and print last logs: |
247 | 247 | ||
248 | ``` | 248 | ```bash |
249 | $ sudo /etc/init.d/peertube start | 249 | $ sudo /etc/init.d/peertube start |
250 | $ tail -f /var/log/peertube/peertube.log | 250 | $ tail -f /var/log/peertube/peertube.log |
251 | ``` | 251 | ``` |
252 | 252 | ||
253 | ### Administrator | 253 | ### :technologist: Administrator |
254 | 254 | ||
255 | The administrator password is automatically generated and can be found in the PeerTube | 255 | The administrator password is automatically generated and can be found in the PeerTube |
256 | logs (path defined in `production.yaml`). You can also set another password with: | 256 | logs (path defined in `production.yaml`). You can also set another password with: |
257 | 257 | ||
258 | ``` | 258 | ```bash |
259 | $ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root | 259 | $ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root |
260 | ``` | 260 | ``` |
261 | 261 | ||
262 | Alternatively you can set the environment variable `PT_INITIAL_ROOT_PASSWORD`, | 262 | Alternatively you can set the environment variable `PT_INITIAL_ROOT_PASSWORD`, |
263 | to your own administrator password, although it must be 6 characters or more. | 263 | to your own administrator password, although it must be 6 characters or more. |
264 | 264 | ||
265 | ### What now? | 265 | ### :tada: What now? |
266 | 266 | ||
267 | Now your instance is up you can: | 267 | Now your instance is up you can: |
268 | 268 | ||
@@ -279,7 +279,7 @@ Now your instance is up you can: | |||
279 | 279 | ||
280 | The password it asks is PeerTube's database user password. | 280 | The password it asks is PeerTube's database user password. |
281 | 281 | ||
282 | ``` | 282 | ```bash |
283 | $ cd /var/www/peertube/peertube-latest/scripts && sudo -H -u peertube ./upgrade.sh | 283 | $ cd /var/www/peertube/peertube-latest/scripts && sudo -H -u peertube ./upgrade.sh |
284 | $ sudo systemctl restart peertube # Or use your OS command to restart PeerTube if you don't use systemd | 284 | $ sudo systemctl restart peertube # Or use your OS command to restart PeerTube if you don't use systemd |
285 | ``` | 285 | ``` |
@@ -288,7 +288,7 @@ $ sudo systemctl restart peertube # Or use your OS command to restart PeerTube i | |||
288 | 288 | ||
289 | Make a SQL backup | 289 | Make a SQL backup |
290 | 290 | ||
291 | ``` | 291 | ```bash |
292 | $ SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \ | 292 | $ SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \ |
293 | cd /var/www/peertube && sudo -u peertube mkdir -p backup && \ | 293 | cd /var/www/peertube && sudo -u peertube mkdir -p backup && \ |
294 | sudo -u postgres pg_dump -F c peertube_prod | sudo -u peertube tee "$SQL_BACKUP_PATH" >/dev/null | 294 | sudo -u postgres pg_dump -F c peertube_prod | sudo -u peertube tee "$SQL_BACKUP_PATH" >/dev/null |
@@ -296,13 +296,13 @@ $ SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \ | |||
296 | 296 | ||
297 | Fetch the latest tagged version of Peertube: | 297 | Fetch the latest tagged version of Peertube: |
298 | 298 | ||
299 | ``` | 299 | ```bash |
300 | $ 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" | 300 | $ 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" |
301 | ``` | 301 | ``` |
302 | 302 | ||
303 | Download the new version and unzip it: | 303 | Download the new version and unzip it: |
304 | 304 | ||
305 | ``` | 305 | ```bash |
306 | $ cd /var/www/peertube/versions && \ | 306 | $ cd /var/www/peertube/versions && \ |
307 | sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \ | 307 | sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \ |
308 | sudo -u peertube unzip -o peertube-${VERSION}.zip && \ | 308 | sudo -u peertube unzip -o peertube-${VERSION}.zip && \ |
@@ -311,21 +311,21 @@ $ cd /var/www/peertube/versions && \ | |||
311 | 311 | ||
312 | Install node dependencies: | 312 | Install node dependencies: |
313 | 313 | ||
314 | ``` | 314 | ```bash |
315 | $ cd /var/www/peertube/versions/peertube-${VERSION} && \ | 315 | $ cd /var/www/peertube/versions/peertube-${VERSION} && \ |
316 | sudo -H -u peertube yarn install --production --pure-lockfile | 316 | sudo -H -u peertube yarn install --production --pure-lockfile |
317 | ``` | 317 | ``` |
318 | 318 | ||
319 | Copy new configuration defaults values and update your configuration file: | 319 | Copy new configuration defaults values and update your configuration file: |
320 | 320 | ||
321 | ``` | 321 | ```bash |
322 | $ sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml | 322 | $ sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml |
323 | $ diff /var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example /var/www/peertube/config/production.yaml | 323 | $ diff /var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example /var/www/peertube/config/production.yaml |
324 | ``` | 324 | ``` |
325 | 325 | ||
326 | Change the link to point to the latest version: | 326 | Change the link to point to the latest version: |
327 | 327 | ||
328 | ``` | 328 | ```bash |
329 | $ cd /var/www/peertube && \ | 329 | $ cd /var/www/peertube && \ |
330 | sudo unlink ./peertube-latest && \ | 330 | sudo unlink ./peertube-latest && \ |
331 | sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest | 331 | sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest |
@@ -335,7 +335,7 @@ $ cd /var/www/peertube && \ | |||
335 | 335 | ||
336 | Check changes in nginx configuration: | 336 | Check changes in nginx configuration: |
337 | 337 | ||
338 | ``` | 338 | ```bash |
339 | $ cd /var/www/peertube/versions | 339 | $ cd /var/www/peertube/versions |
340 | $ diff "$(ls --sort=t | head -2 | tail -1)/support/nginx/peertube" "$(ls --sort=t | head -1)/support/nginx/peertube" | 340 | $ diff "$(ls --sort=t | head -2 | tail -1)/support/nginx/peertube" "$(ls --sort=t | head -1)/support/nginx/peertube" |
341 | ``` | 341 | ``` |
@@ -344,7 +344,7 @@ $ diff "$(ls --sort=t | head -2 | tail -1)/support/nginx/peertube" "$(ls --sort= | |||
344 | 344 | ||
345 | Check changes in systemd configuration: | 345 | Check changes in systemd configuration: |
346 | 346 | ||
347 | ``` | 347 | ```bash |
348 | $ cd /var/www/peertube/versions | 348 | $ cd /var/www/peertube/versions |
349 | $ diff "$(ls --sort=t | head -2 | tail -1)/support/systemd/peertube.service" "$(ls --sort=t | head -1)/support/systemd/peertube.service" | 349 | $ diff "$(ls --sort=t | head -2 | tail -1)/support/systemd/peertube.service" "$(ls --sort=t | head -1)/support/systemd/peertube.service" |
350 | ``` | 350 | ``` |
@@ -353,19 +353,19 @@ $ diff "$(ls --sort=t | head -2 | tail -1)/support/systemd/peertube.service" "$( | |||
353 | 353 | ||
354 | If you changed your nginx configuration: | 354 | If you changed your nginx configuration: |
355 | 355 | ||
356 | ``` | 356 | ```bash |
357 | $ sudo systemctl reload nginx | 357 | $ sudo systemctl reload nginx |
358 | ``` | 358 | ``` |
359 | 359 | ||
360 | If you changed your systemd configuration: | 360 | If you changed your systemd configuration: |
361 | 361 | ||
362 | ``` | 362 | ```bash |
363 | $ sudo systemctl daemon-reload | 363 | $ sudo systemctl daemon-reload |
364 | ``` | 364 | ``` |
365 | 365 | ||
366 | Restart PeerTube and check the logs: | 366 | Restart PeerTube and check the logs: |
367 | 367 | ||
368 | ``` | 368 | ```bash |
369 | $ sudo systemctl restart peertube && sudo journalctl -fu peertube | 369 | $ sudo systemctl restart peertube && sudo journalctl -fu peertube |
370 | ``` | 370 | ``` |
371 | 371 | ||
@@ -373,7 +373,7 @@ $ sudo systemctl restart peertube && sudo journalctl -fu peertube | |||
373 | 373 | ||
374 | Change `peertube-latest` destination to the previous version and restore your SQL backup: | 374 | Change `peertube-latest` destination to the previous version and restore your SQL backup: |
375 | 375 | ||
376 | ``` | 376 | ```bash |
377 | $ OLD_VERSION="v0.42.42" && SQL_BACKUP_PATH="backup/sql-peertube_prod-2018-01-19T10:18+01:00.bak" && \ | 377 | $ OLD_VERSION="v0.42.42" && SQL_BACKUP_PATH="backup/sql-peertube_prod-2018-01-19T10:18+01:00.bak" && \ |
378 | cd /var/www/peertube && sudo -u peertube unlink ./peertube-latest && \ | 378 | cd /var/www/peertube && sudo -u peertube unlink ./peertube-latest && \ |
379 | sudo -u peertube ln -s "versions/peertube-$OLD_VERSION" peertube-latest && \ | 379 | sudo -u peertube ln -s "versions/peertube-$OLD_VERSION" peertube-latest && \ |