add Caddyfile to docs

This commit is contained in:
Sam 2023-05-27 23:46:12 +02:00
parent 1f138bee16
commit 7435604dab
No known key found for this signature in database
GPG Key ID: B4EF20DDE721CAA1
2 changed files with 18 additions and 6 deletions

12
docs/Caddyfile Normal file
View File

@ -0,0 +1,12 @@
http://pronouns.local {
handle /media* {
uri path_regexp ^/media /pronouns.cc
reverse_proxy localhost:9000
}
handle_path /api* {
reverse_proxy localhost:8080
}
reverse_proxy localhost:5173
}

View File

@ -8,6 +8,7 @@ You might have to change paths and ports, but they should work fine as-is.
```bash ```bash
git clone https://codeberg.org/u1f320/pronouns.cc.git pronouns git clone https://codeberg.org/u1f320/pronouns.cc.git pronouns
cd pronouns cd pronouns
git checkout stable
make all make all
# if running for the first time # if running for the first time
@ -43,6 +44,8 @@ one in the repository root (for the backend) and one in the frontend directory.
- `PUBLIC_BASE_URL`: the base URL for the frontend. - `PUBLIC_BASE_URL`: the base URL for the frontend.
- `PRIVATE_SENTRY_DSN`: your Sentry DSN. - `PRIVATE_SENTRY_DSN`: your Sentry DSN.
- `PUBLIC_MEDIA_URL`: the base URL for media.
If you're proxying your media through nginx as in `pronounscc.nginx`, set this to `$PUBLIC_BASE_URL/media`.
## Updating ## Updating
@ -60,9 +63,6 @@ systemctl start pronouns-exporter # if the exporter was stopped
Both the backend and frontend are expected to run behind a reverse proxy such as Caddy or nginx. Both the backend and frontend are expected to run behind a reverse proxy such as Caddy or nginx.
This directory contains a sample configuration file for nginx. This directory contains a sample configuration file for nginx.
Every path should be proxied to the frontend, except: Every path should be proxied to the frontend, except for `/api/`:
this should be proxied to the backend, with the URL being rewritten to remove `/api`
- `/api/`: this should be proxied to the backend, with the URL being rewritten to remove `/api` (for example, a request to `$DOMAIN/api/v1/users/@me` should be proxied to `localhost:8080/v1/users/@me`)
(for example, a request to `$DOMAIN/api/v1/users/@me` should be proxied to `localhost:8080/v1/users/@me`)
- `/media/`: this should be proxied to your object storage.
Make sure to rewrite `/media` into your storage bucket's name.