From 962ab164ac166876cc51f5fc21969bdefa95d31e Mon Sep 17 00:00:00 2001 From: Obada Haddad Date: Wed, 26 Mar 2025 11:51:43 +0100 Subject: [PATCH 1/3] Maintenance mode option added in Caddyfile, used by creating a maintenance.on file in the maintenance_mode/ directory --- Caddyfile | 14 +++++++++++++- docker-compose.yml | 1 + maintenance_mode/maintenance.html | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 maintenance_mode/maintenance.html diff --git a/Caddyfile b/Caddyfile index f2a8f2372..7c5bc3972 100644 --- a/Caddyfile +++ b/Caddyfile @@ -8,10 +8,21 @@ # ca https://acme-staging-v02.api.letsencrypt.org/directory # } - + # Removing some headers for improved security: header -Server + @maintenanceModeActive file { + root /srv + try_files maintenance.on + } + handle @maintenanceModeActive { + root * /srv + try_files maintenance.html + file_server { + status 503 + } + } # Serves static files, should be the same as `STATIC_ROOT` setting: root * /var/www/django file_server @@ -21,6 +32,7 @@ not path /media/* } + # Serving dynamic requests: reverse_proxy @noStatic django:8000 diff --git a/docker-compose.yml b/docker-compose.yml index 9b96f9590..cc8109952 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: - ./caddy_data:/data - ./caddy_config:/config - ./var/log/caddy:/var/log/ + - ./maintenance_mode/:/srv restart: unless-stopped ports: - 80:80 diff --git a/maintenance_mode/maintenance.html b/maintenance_mode/maintenance.html new file mode 100644 index 000000000..ce48b6baa --- /dev/null +++ b/maintenance_mode/maintenance.html @@ -0,0 +1,18 @@ + + + + Codabench + + + +

The Codabench site is being upgraded...

+

Sorry, the page you are looking for is currently unavailable because the site is undergoing maintenance.

+

Please try again later. Thank you.

+ + \ No newline at end of file From 345024939029ebe29d692052781a7a0f274fe8b6 Mon Sep 17 00:00:00 2001 From: didayolo Date: Tue, 8 Apr 2025 16:35:14 +0200 Subject: [PATCH 2/3] Add offline.png --- maintenance_mode/maintenance.html | 1 + maintenance_mode/offline.png | Bin 0 -> 6815 bytes 2 files changed, 1 insertion(+) create mode 100644 maintenance_mode/offline.png diff --git a/maintenance_mode/maintenance.html b/maintenance_mode/maintenance.html index ce48b6baa..d6adce912 100644 --- a/maintenance_mode/maintenance.html +++ b/maintenance_mode/maintenance.html @@ -11,6 +11,7 @@ + Offline

The Codabench site is being upgraded...

Sorry, the page you are looking for is currently unavailable because the site is undergoing maintenance.

Please try again later. Thank you.

diff --git a/maintenance_mode/offline.png b/maintenance_mode/offline.png new file mode 100644 index 0000000000000000000000000000000000000000..837974125222a3a0d07577b19870a9a2d54dc2e8 GIT binary patch literal 6815 zcmeHMdpK0>+8>oe6iFzeX{2%(Gs6sHoI{8yuj8V^teG{Mm>JA4Ln$3(97+@&B{GR*%J@@lmvq*Gb z?KE3nLmq)Z%yw~h@IWA@0kC~eZaRD~?=9X0|Eh`c0=OO&9x^O~O=pBcNN#i(goOAE zIs(COXSy>LZzAQsyw!`EQF@WT@No&v?BTnF?Jke|buH(N%slz^%k}1vIQR6IWLLEG zERRzj#kLjqmg?MonOI<(cB9)f|DC|F`qiUU|Be^6H9NY6e)};iVjL)C>Uld$t#@|m zXlw0$(l94)an(!dS=(Mw?aq~~cY0{ik;`JZn+GXw&;4pyM}KTl{N<)Yc3Q^3%0mwr2s? zuFI*=z^E+T$lP%7t{|=cu8NbO+C#~}>Td0>m6qg%-h}L-_#<`tJ?I91Q3dJ!OUx|w zkqoG?d7-_0GO&Gyvb@IGWAX~&{*fMTv<)`B&lg3G&AmD=!n^#oFir!1d(WaVr7gS= zwKGdQPlnC?Ym@LzYB=(W!o{phUt&Wazfmb4pS7-c{nqo+cekWJ>EC!yCuoD_l`8`q zYqi6!PEWCHf$XD}*pPF98BZGj${H#kL^qYa`n&Z}P4D!*rwZ?zl~*jr{&BoNGL@GQ zv+47Dw=-pnLOUW(Rybl0!JQYwfIAEzyOF4DrV)k41|cIpGYoD$1j5pWA4Z{uKwKmU z1v6MysJGY3P)G*N3gt^6W65Fm&<2KcOa$Z^v)YRq6GAnop=_+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;b!u>Lhlq2&)BB6t(QHD>5U5H{z^km5~eFuXZOz z8on>m90;iT#PrTwQ;<-YZXmqm)2(|o?X*BO3%G+9TGsiFv)Jp*JgSmb6s&)*ZeJja z@dQ$NEY;5eDS$xrk3{IbP`k82I8QC^e3gcR@c57`*{Pu@)ato>w71V%^k!9cj8B$b z{G8Wqn{+Qf%x~)GdQlM=w%bci*fq~U32j~9JsNNv0H@a#t0!zZ0DzF{x>C{X5p9y+ z*PRw8E+`v((A%7yEn4hj<8dTPv@Qk6?*(^vE-+rEt7fDvOb^}_FZ*J_$PqBU%B4F= zkq-74>24mBU%P2VYu;yV-(KXJMAgAtC7? z_BX)uYAPW|Vh2ryQAI#Rnzy&hu}COcZsQDO zkAccUBz}>>hve&BhUFb5JLU;N)%?eKPFn|_t%+9!9S8P5VmYS|$4B{(2K4QytOJu; z5(JKKW48g3R=4;fpoV&-s_%MT%YkIzkLDC!ZBt<*`*s-UXcT%k3IEF*Xr4y!_~l z1AT;*i$xsDTab8`qA-KHcwKKJzn zWzc(I#P)olk4cBi4SJ;&=%}B0fq%b`cP8_#+1h6F7anavqVbi6&N~z0x5?Nu7ny{N zJ-*hKc}|#)yLO9RksotvfcU3Y^X9PX_LBnDtM0G(jfa}Cr}H62tpoknm5yd2TP^Xe z4>9{^#>$>oyd|5Mv2^-{nRW#{dU+KX={d&VW!jh8A7$=19j-f+ATq6>*qa^>or~ Date: Wed, 9 Apr 2025 10:33:34 +0200 Subject: [PATCH 3/3] Fixed image not loading --- Caddyfile | 11 ++++++++--- maintenance_mode/maintenance.html | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Caddyfile b/Caddyfile index 7c5bc3972..2e1528610 100644 --- a/Caddyfile +++ b/Caddyfile @@ -12,17 +12,22 @@ # Removing some headers for improved security: header -Server + @noRedirect { + not path /maintenance.html + not path /offline.png + } @maintenanceModeActive file { root /srv try_files maintenance.on } handle @maintenanceModeActive { root * /srv - try_files maintenance.html + redir @noRedirect /maintenance.html file_server { - status 503 - } + status 503 + } } + # Serves static files, should be the same as `STATIC_ROOT` setting: root * /var/www/django file_server diff --git a/maintenance_mode/maintenance.html b/maintenance_mode/maintenance.html index d6adce912..e300ec782 100644 --- a/maintenance_mode/maintenance.html +++ b/maintenance_mode/maintenance.html @@ -11,7 +11,7 @@ - Offline + offline

The Codabench site is being upgraded...

Sorry, the page you are looking for is currently unavailable because the site is undergoing maintenance.

Please try again later. Thank you.