Hi all! This is my first post.
I’m Robert and work in the EU institutions on some digitalisation projects. We want to use Peertube for our videos and I wonder if we can have a slimmer setup if we replace nginx by caddy.
I do not have a bug, but I would appreciate your feedback. I plan to blog about the final configue and possibly contribute upstream to peertube.
1. Caddy version (caddy version
):
I am using docker with the image caddy:2-alpine
. Caddy version: v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
2. How I run Caddy:
I replaced in the Peertube Docker Compose file nginx by caddy caddy:2-alpine
. No problems here either.
d. My complete Caddyfile or JSON config:
The idea is to rewrite the nginx config for Caddy. Find the original here:
# kate: indent-width 8; space-indent on;
{
# Global options block. Entirely optional, https is on by default
# Optional email key for lets encrypt
email {$LETS_ENCRYPT_EMAIL}
# Optional staging lets encrypt for testing. Comment out for production.
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# admin off
debug
servers {
timeouts {
idle 1d
}
}
}
# https://gist.github.com/yukimochi/bb7c90cbe628f216f821e835df1aeac1?permalink_comment_id=3607303#gistcomment-3607303
{$PEERTUBE_DOMAIN} {
log {
level debug
# format single_field common_log
output file /logs/access.log
}
encode gzip
root * /var/www/peertube
@upload_video {
method POST HEAD
path /api/v1/videos/upload
}
@upload_assets {
path_regexp ^/api/v1/(videos|video-playlists|video-channels|users/me)
}
@download_assets_overrides {
path_regexp ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$
file /storage/client-overrides/{path} /peertube-latest/{path}
}
@download_assets {
path_regexp ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$
}
@tracker {
path /tracker/socket*
}
@static {
file /storage/{path}
}
handle @download_assets_overrides {
header Cache-Control "public, max-age=31536000, immutable"
try_files file /storage/client-overrides/{path} /peertube-latest/{path}
file_server
}
handle @download_assets {
header Cache-Control "public, max-age=31536000, immutable"
rewrite * /peertube-latest/{path}
file_server
}
handle @static {
file_server
}
handle {
request_body @upload_video {
max_size 12GB
}
header @upload_video X-File-Maximum-Size 8G
request_body @upload_assets {
max_size 6MB
}
header @upload_assets X-File-Maximum-Size 4M
reverse_proxy @tracker peertube:9000 {
transport http {
response_header_timeout 15m
}
}
reverse_proxy peertube:9000 {
transport http {
response_header_timeout 10m
}
}
}
}
3. The problem I’m having:
I would appreciate your feedback on
- how I can even better replicate the nginx setup at PeerTube/peertube at develop · Chocobozzz/PeerTube · GitHub
- how I can possibly be more DRY and shorter with my Caddyfile above.
Thanks for your considerations!
/ Robert