Migrating nginx docs to caddy.

This commit is contained in:
Roland 2026-03-07 18:27:43 -07:00
parent 2cfe00e46d
commit 79dad0356f
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
8 changed files with 74 additions and 75 deletions

View file

@ -33,7 +33,7 @@ This dashboard works even when the main WROLPi app is down.
### During Upgrades
When WROLPi is upgrading, nginx automatically redirects to the Controller dashboard so you can monitor the
When WROLPi is upgrading, Caddy automatically redirects to the Controller dashboard so you can monitor the
upgrade progress and system status.
## Features

View file

@ -16,7 +16,7 @@ The following services are managed by the Controller:
| renderd | - | Map tile rendering |
| apache2 | - | Map tile server |
| postgresql | - | Database server |
| nginx | 80/443 | Web server and reverse proxy |
| caddy | 80/443 | Web server and reverse proxy |
Development services (shown only when running):
@ -36,7 +36,7 @@ service is running.
### Stopping a Service
Click the **Stop** button to stop a running service. Use caution when stopping critical services
like nginx or postgresql.
like Caddy or postgresql.
![Service stop button](services-stop-button.png)
@ -95,22 +95,19 @@ In Docker deployments, the Controller manages Docker containers instead of syste
### Docker Container Architecture
Docker mode uses HTTPS proxy containers to expose services securely:
Caddy handles HTTPS termination and reverse proxying for all services in a single `web` container:
| Service | Internal Container | HTTPS Proxy | Port |
|---------|--------------------|--------------|------|
| Help | `help` | `help_https` | 8086 |
| Map | `map` | `map_https` | 8084 |
| Kiwix | `zim` | `zim_https` | 8085 |
| Archive | - | `archive` | 8083 |
Other containers:
- `api` - Backend API (port 8081)
- `app` - React frontend
- `controller` - Controller service (port 8087)
- `db` - PostgreSQL database (port 5432)
- `web` - Nginx reverse proxy (port 8443)
| Container | Port | Description |
|--------------|------|--------------------------------|
| `web` | 8443 | Caddy reverse proxy (HTTPS) |
| `web` | 8080 | Caddy landing page (HTTP) |
| `api` | 8081 | Backend API |
| `app` | - | React frontend |
| `controller` | 8087 | Controller service |
| `db` | 5432 | PostgreSQL database |
| `help` | 8086 | Help documentation (via Caddy) |
| `map` | 8084 | Map tile server (via Caddy) |
| `zim` | 8085 | Kiwix wiki server (via Caddy) |
*The following screenshot is from a healthy WROLPi running in Docker containers*

View file

@ -28,7 +28,8 @@ into the video site. The easiest method is using a browser extension.
#### cookies.txt (Chrome/Brave/Edge)
1. Install [cookies.txt](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg) from the Chrome Web Store
1. Install [cookies.txt](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg) from the
Chrome Web Store
2. Navigate to the video site and log in
3. Click the extension icon
4. Click **Copy** to copy the cookies to your clipboard
@ -125,25 +126,25 @@ If downloads fail even with unlocked cookies:
## File Locations
| Item | Location |
|------|----------|
| Item | Location |
|-------------------|--------------------------------------------|
| Encrypted cookies | `{media_directory}/config/cookies.txt.enc` |
| Temporary files | `/dev/shm/w_*.tmp` (RAM-based) |
| Temporary files | `/dev/shm/w_*.tmp` (RAM-based) |
## Security Details
WROLPi implements several security measures to protect your cookies:
| Feature | Implementation |
|---------|----------------|
| **Encryption Algorithm** | Fernet (AES-128-CBC + HMAC-SHA256) |
| **Key Derivation** | PBKDF2-SHA256 with 480,000 iterations |
| **Salt** | 16 bytes random per encryption |
| **Password Minimum** | 8 characters |
| **Storage Location** | Encrypted file only; never plaintext on disk |
| **Memory Storage** | RAM-based temporary files (`/dev/shm`) |
| **Temp File Permissions** | `0o600` (owner-only) |
| **Secure Deletion** | Overwrite with zeros before unlinking |
| Feature | Implementation |
|---------------------------|----------------------------------------------|
| **Encryption Algorithm** | Fernet (AES-128-CBC + HMAC-SHA256) |
| **Key Derivation** | PBKDF2-SHA256 with 480,000 iterations |
| **Salt** | 16 bytes random per encryption |
| **Password Minimum** | 8 characters |
| **Storage Location** | Encrypted file only; never plaintext on disk |
| **Memory Storage** | RAM-based temporary files (`/dev/shm`) |
| **Temp File Permissions** | `0o600` (owner-only) |
| **Secure Deletion** | Overwrite with zeros before unlinking |
### How Encryption Works

View file

@ -66,7 +66,8 @@ Behavior when downloading videos can be configured in the `Videos > Settings` pa
* **Sleep Between Requests**
* Instructs yt-dlp to sleep between metadata requests. Helps reduce potential throttling.
* **User Agent**
* The browser identity sent with requests. **If using encrypted cookies, select "Use Current Browser" to match the browser your cookies came from.**
* The browser identity sent with requests. **If using encrypted cookies, select "Use Current Browser" to match the
browser your cookies came from.**
## Authentication for Downloads

View file

@ -20,10 +20,10 @@ Examples:
Collections are categorized by kind:
| Kind | Purpose | Default Location |
|-----------|------------------------------------|-----------------------------|
| `channel` | Video channels (YouTube, etc.) | `/media/wrolpi/videos/` |
| `domain` | Website archives (SingleFile, etc.)| `/media/wrolpi/archives/` |
| Kind | Purpose | Default Location |
|-----------|-------------------------------------|---------------------------|
| `channel` | Video channels (YouTube, etc.) | `/media/wrolpi/videos/` |
| `domain` | Website archives (SingleFile, etc.) | `/media/wrolpi/archives/` |
## Automatic Collection Creation
@ -92,15 +92,15 @@ Example: A video uploaded in 2024 titled "Tutorial" goes to
### Template Variables
| Variable | Description |
|-------------------|------------------------------------|
| `%(name)s` | Collection name |
| `%(tag)s` | Tag name (if tagged) |
| `%(kind)s` | Collection kind (channel/domain) |
| `%(upload_year)s` | Year of upload (videos) |
| `%(upload_month)s`| Month of upload (videos) |
| `%(title)s` | Video/archive title |
| `%(ext)s` | File extension |
| Variable | Description |
|--------------------|----------------------------------|
| `%(name)s` | Collection name |
| `%(tag)s` | Tag name (if tagged) |
| `%(kind)s` | Collection kind (channel/domain) |
| `%(upload_year)s` | Year of upload (videos) |
| `%(upload_month)s` | Month of upload (videos) |
| `%(title)s` | Video/archive title |
| `%(ext)s` | File extension |
## Related Documentation

View file

@ -12,28 +12,28 @@ This contains the tables for the API.
### Tables
| Name | Purpose | Relations | `/opt/wrolpi` File |
|------------------|---------------------------------------------------------|---------------------------|-------------------------------|
| alembic_version | Tracks Alembic migration. | | `alembic` |
| archive | Data about a FileGroup Archive. | file_group_id, domain_id | `modules/archive/models.py` |
| channel | Data about a video Channel. | | `modules/videos/models.py` |
| collection | A logical grouping of FileGroups. | tag_id | `wrolpi/collections/models.py`|
| collection_item | Links a FileGroup to a Collection. | collection_id, file_group_id | `wrolpi/collections/models.py`|
| directory | Directories in the media directory. | | `wrolpi/files/models.py` |
| domains | Groups Archives by shared URL domain. | | `modules/archive/models.py` |
| download | Data about what should be downloaded and when. | | `wrolpi/downloader.py` |
| ebook | Data about FileGroups that are books. | file_group_id | `wrolpi/files/ebooks.py` |
| file_group | Each record is a group of files that share a stem. | | `wrolpi/files/models.py` |
| inventory | A collection of items. | | `modules/inventory/models.py` |
| item | An item in an inventory. | inventory_id | `modules/inventory/models.py` |
| map_file | Data about PBF files (if they have been imported, etc.) | | `modules/map/models.py` |
| tag | Data about a Tag (name, color, etc.) | | `wrolpi/tags.py` |
| tag_file | A FileGroup that has been tagged. | tag_id, file_group_id | `wrolpi/tags.py` |
| tag_zim | An entry (article) that was tagged in a Zim file. | tag_id, zim_id, zim_entry | `modules/zim/models.py` |
| video | Data about a FileGroup Video | file_group_id, channel_id | `modules/videos/models.py` |
| wrolpi_flag | Long-term flags that have occurred in the API. | | `wrolpi/flags.py` |
| zim | A Zim file | | `modules/zim/models.py` |
| zim_subscription | A recurring download of a Zim file. | | `modules/zim/models.py` |
| Name | Purpose | Relations | `/opt/wrolpi` File |
|------------------|---------------------------------------------------------|------------------------------|--------------------------------|
| alembic_version | Tracks Alembic migration. | | `alembic` |
| archive | Data about a FileGroup Archive. | file_group_id, domain_id | `modules/archive/models.py` |
| channel | Data about a video Channel. | | `modules/videos/models.py` |
| collection | A logical grouping of FileGroups. | tag_id | `wrolpi/collections/models.py` |
| collection_item | Links a FileGroup to a Collection. | collection_id, file_group_id | `wrolpi/collections/models.py` |
| directory | Directories in the media directory. | | `wrolpi/files/models.py` |
| domains | Groups Archives by shared URL domain. | | `modules/archive/models.py` |
| download | Data about what should be downloaded and when. | | `wrolpi/downloader.py` |
| ebook | Data about FileGroups that are books. | file_group_id | `wrolpi/files/ebooks.py` |
| file_group | Each record is a group of files that share a stem. | | `wrolpi/files/models.py` |
| inventory | A collection of items. | | `modules/inventory/models.py` |
| item | An item in an inventory. | inventory_id | `modules/inventory/models.py` |
| map_file | Data about PBF files (if they have been imported, etc.) | | `modules/map/models.py` |
| tag | Data about a Tag (name, color, etc.) | | `wrolpi/tags.py` |
| tag_file | A FileGroup that has been tagged. | tag_id, file_group_id | `wrolpi/tags.py` |
| tag_zim | An entry (article) that was tagged in a Zim file. | tag_id, zim_id, zim_entry | `modules/zim/models.py` |
| video | Data about a FileGroup Video | file_group_id, channel_id | `modules/videos/models.py` |
| wrolpi_flag | Long-term flags that have occurred in the API. | | `wrolpi/flags.py` |
| zim | A Zim file | | `modules/zim/models.py` |
| zim_subscription | A recurring download of a Zim file. | | `modules/zim/models.py` |
## Map Database
@ -41,4 +41,4 @@ This contains tables for the OpenStreetMap.
### Service
`postgresql@15-map.service`
`postgresql@15-map.service`

View file

@ -61,7 +61,7 @@ OK: WROLPi app systemd exists
OK: WROLPi app service is up
OK: WROLPi app responded with interface
OK: Port 80 is occupied
OK: nginx systemd exists
OK: Caddy systemd exists
OK: Found map database
OK: Map database is initialized
@ -76,8 +76,8 @@ OK: Kiwix app responded
OK: The media directory exists
OK: Can modify media directory
OK: Media directory is a mounted drive
OK: Media directory files are served by nginx
OK: Config can be fetched from nginx
OK: Media directory files are served by Caddy
OK: Config can be fetched from Caddy
OK: Media directory is owned by wrolpi user
OK: Singlefile can be run

View file

@ -75,9 +75,9 @@ If using the Docker containers (the development environment), you may have addit
### Development Web
| Software Project | Purpose |
|-----------------------------|---------------------------------------------------------------|
| [nginx](https://nginx.org/) | Facilitates integration between development docker containers |
| Software Project | Purpose |
|-----------------------------------|---------------------------------------------------------------|
| [Caddy](https://caddyserver.com/) | Facilitates integration between development docker containers |
### Archive