Skip to content

Commit

Permalink
Caddy (#1424)
Browse files Browse the repository at this point in the history
* caddy image + Caddyfile updates

* Changed caddy image tag to 2.7.6 instead of latest (latest as of 26 avr 2024)

* Removed unnecessary comment

* Changed caddy data folder to more relevent name + removed unecessary spaces hopefully

* caddy image + Caddyfile updates

* Better caddy console format + re-removed unecessary spaces in docker-compose.yml

* Commented the tls directive

* Uncomment TLS_EMAIL so it is more robust

---------

Co-authored-by: Obada Haddad <obada.haddad@lisn.fr>
Co-authored-by: didayolo <adrien.pavao@gmail.com>
  • Loading branch information
3 people authored May 28, 2024
1 parent b142529 commit 94028a4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .env_sample
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ MAX_EXECUTION_TIME_LIMIT=600 # time limit for the default queue (in seconds)
DOMAIN_NAME=localhost:80

# SSL style domain definition
TLS_EMAIL=your@email.com
# DOMAIN_NAME=example.com:443
# TLS_EMAIL=your@email.com

RABBITMQ_HOST=rabbit
RABBITMQ_DEFAULT_USER=rabbit-username
Expand Down
30 changes: 18 additions & 12 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
{$DOMAIN_NAME} {
# HTTPS options:
# HTTPS Options
tls {$TLS_EMAIL}


# Test HTTPS setup
# tls {$TLS_EMAIL} {
# ca https://acme-staging-v02.api.letsencrypt.org/directory
# }


# Removing some headers for improved security:
header / -Server
header -Server

# Serves static files, should be the same as `STATIC_ROOT` setting:
root /var/www/django

# Serving dynamic requests:
proxy / django:8000 {
except /static /media
transparent
websocket
root * /var/www/django
file_server

@noStatic {
not path /static/*
not path /media/*
}

# Serving dynamic requests:
reverse_proxy @noStatic django:8000

# Allows to use `.gz` files when available:
gzip
encode gzip

# Logs:
log stdout
errors stdout
log {
output stdout
format console
}
}
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ services:
# Web Services
#-----------------------------------------------
caddy:
image: abiosoft/caddy:1.0.3
image: caddy:2.7.6
env_file: .env
environment:
- ACME_AGREE=true
volumes:
- ./Caddyfile:/etc/Caddyfile
- ./Caddyfile:/etc/caddy/Caddyfile
- ./src/staticfiles:/var/www/django/static
- ./certs/caddy:/etc/caddycerts
- ./caddy_data:/data
- ./caddy_config:/config
restart: unless-stopped
ports:
- 80:80
Expand Down Expand Up @@ -231,4 +232,4 @@ services:
logging:
options:
max-size: "20k"
max-file: "10"
max-file: "10"

0 comments on commit 94028a4

Please sign in to comment.