separate caddy configs + cleanup

This commit is contained in:
Failure 2025-03-18 16:33:01 -07:00
parent 3a8983d054
commit 54e18ead20
7 changed files with 90 additions and 57 deletions

View file

@ -1,56 +1,6 @@
{
}
{$DOMAIN} {
root * /srv
encode gzip
handle {
try_files {path} /index.html
file_server
}
header /assets/*.js {
Service-Worker-Allowed "/"
}
handle_path /3m/* {
reverse_proxy 3m:8001
}
handle_path /chat {
reverse_proxy ergo:8097
}
handle_path /voice {
reverse_proxy grumble:8443
}
handle_path /video/* {
rewrite /video /
reverse_proxy mediamtx:8889
}
}
{$HOST_DOMAIN} {
header Access-Control-Allow-Origin *
header Access-Control-Allow-Origin i.cef.icu
header Access-Control-Allow-Origin cef.icu
@uploads {
path_regexp hash ^/uploads/(.*)/.*
}
rewrite @uploads /uploads/{re.hash.1}
respond /uploads/ 403
respond /pfp/ 403
handle_path /embed/* {
reverse_proxy imagor:8000
header -Cache-Control
header -Expires
header Cache-Control "public, max-age=604800"
}
reverse_proxy minio:9000 {
@error status 500 404
handle_response @error {
root * /srv
try_files /assets/theme-cef/blankIcon.png
file_server
}
}
}
import ./Frontend
import ./Imagor

24
configs/caddy/Frontend Normal file
View file

@ -0,0 +1,24 @@
{$DOMAIN} {
root * /srv
encode gzip
handle {
try_files {path} /index.html
file_server
}
header /assets/*.js {
Service-Worker-Allowed "/"
}
handle_path /3m/* {
reverse_proxy 3m:8001
}
handle_path /chat {
reverse_proxy ergo:8097
}
handle_path /voice {
reverse_proxy grumble:8443
}
handle_path /video/* {
rewrite /video /
reverse_proxy mediamtx:8889
}
}

8
configs/caddy/Imagor Normal file
View file

@ -0,0 +1,8 @@
{$IMAGOR_URL} {
header Access-Control-Allow-Origin *
header Access-Control-Allow-Origin {$DOMAIN}
reverse_proxy imagor:8000
header -Cache-Control
header -Expires
header Cache-Control "public, max-age=604800"
}

21
configs/caddy/Storage Normal file
View file

@ -0,0 +1,21 @@
{$HOST_DOMAIN} {
header Access-Control-Allow-Origin *
header Access-Control-Allow-Origin i.cef.icu
header Access-Control-Allow-Origin cef.icu
@uploads {
path_regexp hash ^/uploads/(.*)/.*
}
rewrite @uploads /uploads/{re.hash.1}
respond /uploads/ 403
respond /pfp/ 403
reverse_proxy minio:9000 {
@error status 500 404
handle_response @error {
root * /srv
try_files /assets/theme-cef/blankIcon.png
file_server
}
}
}

View file

@ -0,0 +1,29 @@
{$HOST_DOMAIN} {
header Access-Control-Allow-Origin *
header Access-Control-Allow-Origin i.cef.icu
header Access-Control-Allow-Origin cef.icu
@uploads {
path_regexp hash ^/uploads/(.*)/.*
}
rewrite @uploads /uploads/{re.hash.1}
respond /uploads/ 403
respond /pfp/ 403
handle_path /embed/* {
reverse_proxy imagor:8000
header -Cache-Control
header -Expires
header Cache-Control "public, max-age=604800"
}
reverse_proxy minio:9000 {
@error status 500 404
handle_response @error {
root * /srv
try_files try_files /assets/theme-cef/blankIcon.png
file_server
}
}
}

View file

@ -23,7 +23,7 @@ envp() {
envgen() {
if [ -z "${!1}" ]; then
echo "$1='$2'" >> .env
export "$1='$2'"
export "$1=$2"
fi
}
@ -41,7 +41,7 @@ envp ERGO__NETWORK__NAME "What's the overall name of the network? No spaces or s
envp DOMAIN "What is your domain? Omit HTTP/HTTPS (e.g. 'cef.icu')"
envgen ERGO__SERVER__NAME $DOMAIN
envgen ERGO__DATASTORE__MYSQL__PASSWORD $MYSQL_PASSWORD
envgen THREEM_DBURL "mysql+mysqldb://root:$MYSQL_PASSWORD@mariadb/ergo_ext"
envgen THREEM_DBURL "mysql+mysqldb://root:$MYSQL_PASSWORD@mariadb/ergo"
envp HOST_DOMAIN "What is the domain of your Minio configuration (e.g. 'i.cef.icu')"
envgen THREEM_MINIO_EXTERNAL_ADDR $HOST_DOMAIN

View file

@ -125,6 +125,7 @@ services:
environment:
DOMAIN: ${DOMAIN}
HOST_DOMAIN: ${HOST_DOMAIN}
IMAGOR_URL: ${IMAGOR_URL}
ports:
- "80:80"
- "443:443"
@ -136,8 +137,8 @@ services:
- caddyconfig:/config
- ${PWD}/www:/srv
- type: bind
source: ${PWD}/configs/caddy/Caddyfile
target: /etc/caddy/Caddyfile
source: ${PWD}/configs/caddy
target: /etc/caddy
restart: "always"
mariadb:
container_name: mariadb