Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caddy and docker compose to robustcdn #306

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion src/en/server-hosting/setting-up-robust-cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,32 @@ The latest stable image of Robust.Cdn is `ghcr.io/space-wizards/robust.cdn:2`. I
* `/manifest`: contains SQLite database for server manifest operations.
* `/database`: contains SQLite database for client content downloads.

Here is an example ``docker-compose.yml``, please modify it to your needs.

```
services:
robust_cdn:
image: ghcr.io/space-wizards/robust.cdn:2
container_name: robust_cdn
user: 1654:1654
volumes:
- ./appsettings.json:/app/appsettings.json
- ./builds:/builds
- ./manifest:/manifest
- ./database:/database
ports:
- 8080:8080
restart: unless-stopped
```

You may have to run these commands to set the correct owner and permissions for the ``builds``, ``manifest`` and ``database`` folders.

```
sudo chown -R 1654:1654 builds/ database/ manifest/
sudo chmod -R u+w,g+w builds/ database/ manifest/
```


### Manual compilation

If you hate containers, you can manually publish Robust.Cdn and deploy the files yourself. For this you will need Git and the .NET 8 SDK. The server that will run the build needs the matching ASP.NET Core Runtime installed, but does not need the SDK itself.
Expand Down Expand Up @@ -225,7 +251,7 @@ You should go over this config file in full to understand what you are setting u

If your fork's repository is hosted on GitHub, the easiest way to automatically publish new builds to Robust.Cdn is via the GitHub Actions configuration available in the codebase. This is how official Wizard's Den builds are published.

1. Edit `Tools/publish_github_artifact.py` to modify the "configuration parameters" at the top of the script:
1. Edit `Tools/publish_multi_request.py` to modify the "configuration parameters" at the top of the script:
* `ROBUST_CDN_URL` should be the URL at which Robust.Cdn is accessible.
* `FORK_ID` should be the ID of the fork you configured in `appsettings.json`

Expand Down Expand Up @@ -356,6 +382,27 @@ location / {
}
```

### Caddy

This is an example Caddyfile to go into an existing block for the domain with the CDN. If you are putting this in a path you can just put all these under the path.

```
# Increased max body size for multi-request publishes.
request_body {
max_size 512MB
}

# Update port here.
reverse_proxy localhost:8080 {
flush_interval -1
}

# Compress JSON responses.
encode zstd gzip {
match header Content-Type application/json*
}
```

## Troubleshooting

### 504 gateway timeout during publish
Expand Down
Loading