Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we add Caddy Plugins? #28

Open
codecraf8 opened this issue Aug 6, 2019 · 3 comments
Open

How do we add Caddy Plugins? #28

codecraf8 opened this issue Aug 6, 2019 · 3 comments
Assignees

Comments

@codecraf8
Copy link

I wanted to add gzip, cache, and others.

@lgaticaq lgaticaq self-assigned this Aug 6, 2019
@lgaticaq
Copy link
Member

lgaticaq commented Aug 6, 2019

Hi. the simple way is overwrite the Caddyfile. Ex:

Create a custom Caddyfile

# custom.Caddyfile
0.0.0.0:80
{
  proxy / django:{$PORT} {
    transparent
    except /media /static
  }

  root /var/www

  log /var/log/access.log {
    rotate_size 100 # Rotate after 100 MB
    rotate_age  14  # Keep log files for 14 days
    rotate_keep 10  # Keep at most 10 log files
    rotate_compress # Compress rotated log files in gzip format
  }

  # Custom plugins
  gzip
}

Then run container with custom Caddyfile (-v)

docker run -d --name caddy --link django:django -v static:/var/www/static -v media:/var/www/media -v logs:/var/log -v /path/to/custom.Caddyfile:/etc/Caddyfile -e PORT=8000 lgatica/django-caddy

Or build a custom docker image with custom Caddyfile

FROM lgatica/django-caddy

COPY custom.Caddyfile /etc/Caddyfile
docker build -t my-custom-image .
docker run -d --name caddy --link django:django -v static:/var/www/static -v media:/var/www/media -v logs:/var/log -v /path/to/custom.Caddyfile:/etc/Caddyfile -e PORT=8000 my-custom-image

@codecraf8
Copy link
Author

only gzip works, if you put "cache" as a plugin, it throws error.

@lgaticaq
Copy link
Member

Is not possible because this Dockerfile get binary from release and not build, sorry. I recommend use https://hub.docker.com/r/abiosoft/caddy and add a custom Caddyfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants