Reuse content across files

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2415>
This commit is contained in:
Sporiff 2023-05-02 09:41:09 +02:00
parent b46fdaacd5
commit 5b43ae4f2b
2 changed files with 49 additions and 60 deletions

View File

@ -316,48 +316,60 @@ That's it! systemd keeps these services running and starts them up in the correc
Funkwhale uses a reverse proxy to serve content to users. We use [Nginx](https://nginx.com) to serve this proxy. Follow this guide to install an Nginx configuration using details from your `.env` file.
1. Install Nginx.
:::{note} Before you begin
Nginx isn't preinstalled on Debian. You can install it by running the following commands:
```{code-block} sh
sudo apt-get update
sudo apt-get install nginx
```console
$ sudo apt update
$ sudo apt install nginx
```
:::
% Nginx update instructions
1. Log in to a root shell to make changes to the config files
```console
$ sudo su
```
2. Download the Nginx templates from Funkwhale.
2. Download the new Nginx templates from Funkwhale
```{code-block} sh
sudo curl -L -o /etc/nginx/funkwhale_proxy.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale_proxy.conf"
sudo curl -L -o /etc/nginx/sites-available/funkwhale.template "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/nginx.template"
```console
# curl -L -o /etc/nginx/funkwhale_proxy.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale_proxy.conf"
# curl -L -o /etc/nginx/sites-available/funkwhale.template "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/nginx.template"
```
3. Create an Nginx template with details from your `.env` file.
3. Update the Nginx configuration with details from your {file}`.env` file
```{code-block} sh
# Log in to a root shell.
sudo su
# Create an Nginx configuration using the Funkwhale template with details from your `.env` file.
set -a && source /srv/funkwhale/config/.env && set +a
```console
# set -a && source /srv/funkwhale/config/.env && set +a
envsubst "`env | awk -F = '{printf \" $%s\", $$1}'`" \
< /etc/nginx/sites-available/funkwhale.template \
> /etc/nginx/sites-available/funkwhale.conf
# Enable the configuration so that Nginx serves it.
ln -s /etc/nginx/sites-available/funkwhale.conf /etc/nginx/sites-enabled/
# Exit the root shell.
exit
```
That's it! You've created your Nginx file. Run the following command to check the `.env` details populated correctly.
4. Check the configuration file to make sure the template values have been updated properly
```{code-block} sh
grep '${' /etc/nginx/sites-enabled/funkwhale.conf
```
```console
# grep '${' /etc/nginx/sites-available/funkwhale.conf
```
% Instructions end
5. Create a symbolic link to the {file}`sites-enabled` directory to enable your configuration
```console
# ln -s /etc/nginx/sites-available/funkwhale.conf /etc/nginx/sites-enabled/
```
6. Restart Nginx
```console
# systemctl restart nginx
```
That's it! You've created your Nginx file.
## 10. Set up TLS

View File

@ -37,39 +37,16 @@ If you installed Funkwhale following the [Debian guide](../installation/debian.m
To ensure your reverse proxy is up-to-date with changes, you should regenerate your Nginx configuration with each upgrade. To do this:
1. Log in to a root shell to make changes to the config files
:::{include} /administrator/installation/debian.md
:start-after: Nginx update instructions
:end-before: Instructions end
:::
```console
$ sudo su
```
Once you've updated your configuration, restart Nginx.
2. Download the new Nginx templates from Funkwhale
```console
# curl -L -o /etc/nginx/funkwhale_proxy.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/funkwhale_proxy.conf"
# curl -L -o /etc/nginx/sites-available/funkwhale.template "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/nginx.template"
```
3. Update the Nginx configuration with details from your {file}`.env` file
```console
# set -a && source /srv/funkwhale/config/.env && set +a
envsubst "`env | awk -F = '{printf \" $%s\", $$1}'`" \
< /etc/nginx/sites-available/funkwhale.template \
> /etc/nginx/sites-available/funkwhale.conf
```
4. Check the configuration file to make sure the template values have been updated properly
```console
# grep '${' /etc/nginx/sites-enabled/funkwhale.conf
```
5. Restart Nginx
```console
# systemctl restart nginx
```
```console
# systemctl restart nginx
```
## Update your Funkwhale instance