From dfc533a613be4f8277c1437ddb80ea60acf4668b Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 3 Nov 2024 11:33:49 +0100 Subject: [PATCH] reorganize Caddyfiles --- Caddyfile | 9 --------- {etc => fly/applications}/caddy/Caddyfile | 7 +++---- fly/applications/caddy/fly.toml | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 13 deletions(-) rename {etc => fly/applications}/caddy/Caddyfile (72%) create mode 100644 fly/applications/caddy/fly.toml diff --git a/Caddyfile b/Caddyfile index f2070ad..172f95a 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,13 +1,4 @@ localhost :443 { - # redirect legacy URLs - @blogs path /blogs /blogs/* - @posts path /posts /posts/* - @lang path /en /en/* /de /de/* /es /es/* /fr /fr/* /it /it/* /pt /pt/* /tr /tr/* - - redir @blogs https://legacy.rogue-scholar.org{uri} - redir @posts https://legacy.rogue-scholar.org{uri} - redir @lang https://legacy.rogue-scholar.org{uri} - root /static/* /opt/invenio/var/instance/static try_files {path} {path}/ /index.html reverse_proxy web:5000 diff --git a/etc/caddy/Caddyfile b/fly/applications/caddy/Caddyfile similarity index 72% rename from etc/caddy/Caddyfile rename to fly/applications/caddy/Caddyfile index 44ae79b..17e557b 100644 --- a/etc/caddy/Caddyfile +++ b/fly/applications/caddy/Caddyfile @@ -1,5 +1,5 @@ -0.0.0.0:6000 { - # redirect legacy URLs +:8080 { + # redirect Rogue Scholar legacy URLs @blogs path /blogs /blogs/* @posts path /posts /posts/* @lang path /en /en/* /de /de/* /es /es/* /fr /fr/* /it /it/* /pt /pt/* /tr /tr/* @@ -8,6 +8,5 @@ redir @posts https://legacy.rogue-scholar.org{uri} redir @lang https://legacy.rogue-scholar.org{uri} - # requests get proxied to the backend server - reverse_proxy 0.0.0.0:5000 + redir / https://rogue-scholar.org{uri} } diff --git a/fly/applications/caddy/fly.toml b/fly/applications/caddy/fly.toml new file mode 100644 index 0000000..05fff04 --- /dev/null +++ b/fly/applications/caddy/fly.toml @@ -0,0 +1,23 @@ +# fly.toml app configuration file generated for rogue-scholar-caddy on 2024-11-03T11:26:41+01:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'rogue-scholar-caddy' +primary_region = 'ams' + +[build] + image = 'caddy:2.8.4' + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1