All Projects → wemake-services → Caddy Gen

wemake-services / Caddy Gen

Licence: mit
Automated Caddy reverse proxy for docker containers

Projects that are alternatives of or similar to Caddy Gen

caddy-scratch
Caddy server 2.0.0 / 1.0.5 on Docker Scratch, all in 18MB / 35MB
Stars: ✭ 32 (-76.98%)
Mutual labels:  proxy-server, caddy
Psiphon
A multi-functional version of a popular network circumvention tool
Stars: ✭ 169 (+21.58%)
Mutual labels:  proxy-server, docker-image
Foundryvtt Docker
An easy-to-deploy Dockerized Foundry Virtual Tabletop server.
Stars: ✭ 123 (-11.51%)
Mutual labels:  docker-image
Sec Tools
Docker images for infosec tools
Stars: ✭ 135 (-2.88%)
Mutual labels:  docker-image
Caddy Auth Jwt
JWT Authorization Plugin for Caddy v2
Stars: ✭ 127 (-8.63%)
Mutual labels:  caddy
4minitz
4Minitz - Simply a decent free webapp for taking collaborative meeting minutes. (Keywords: Meeting Protocols, Action Items, Open Source). Check it out on our demo server:
Stars: ✭ 125 (-10.07%)
Mutual labels:  docker-image
Nginx Adapter
Run Caddy with your NGINX config
Stars: ✭ 130 (-6.47%)
Mutual labels:  caddy
Flynet
A powerful TCP/UDP tool, which support socks5 proxy by tcp and udp, http proxy and NAT traversal. This tool can help you bypass gfw easily
Stars: ✭ 124 (-10.79%)
Mutual labels:  proxy-server
Mq Container
Container images for IBM® MQ
Stars: ✭ 138 (-0.72%)
Mutual labels:  docker-image
Ivozprovider
IVOZ Provider - Multitenant solution for VoIP telephony providers
Stars: ✭ 127 (-8.63%)
Mutual labels:  scale
Docker Matrix
docker image for matrix.org
Stars: ✭ 134 (-3.6%)
Mutual labels:  docker-image
Laravel Docker K8s
Running Laravel project using Docker and Deploying using Kubernetes
Stars: ✭ 127 (-8.63%)
Mutual labels:  docker-image
Kubler
A generic, extendable build orchestrator.
Stars: ✭ 126 (-9.35%)
Mutual labels:  docker-image
Reframe.js
🖼 Reframe unresponsive elements responsively.
Stars: ✭ 1,622 (+1066.91%)
Mutual labels:  scale
Ucrop
Image Cropping Library for Android
Stars: ✭ 11,003 (+7815.83%)
Mutual labels:  scale
Bhadoo Cloud
Directly Upload to Google Drive from Torrent or URLs
Stars: ✭ 136 (-2.16%)
Mutual labels:  docker-image
Docker Workshop
Introduction to Docker tutorial
Stars: ✭ 124 (-10.79%)
Mutual labels:  docker-image
Mdtopdf
🐳 Pandoc docker image for converting markdown to PDF using TeX typesetting
Stars: ✭ 127 (-8.63%)
Mutual labels:  docker-image
Laravel Dusk Ci
Docker Test suite for Laravel Dusk in gitlab CI
Stars: ✭ 129 (-7.19%)
Mutual labels:  docker-image
Shadowsocks Cloak Installer
A one-key script to setup Cloak plugin with Shadowsocks on your server
Stars: ✭ 138 (-0.72%)
Mutual labels:  proxy-server

caddy-gen

wemake.services Build Status Dockerhub image size caddy's version

A perfect mix of Caddy, docker-gen, and forego. Inspired by nginx-proxy.


Why

Using Caddy as your primary web server is super simple. But when you need to scale your application Caddy is limited to its static configuration.

To overcome this issue we are using docker-gen to generate configuration everytime a container spawns or dies. Now scaling is easy!

CADDY 2

BREAKING CHANGES since version 0.3.0!

Options to configure:

  • virtual.host domain name, don't pass http:// or https://, you can separate them with space,
  • virtual.alias domain alias, e.q. www prefix,
  • virtual.port port exposed by container, e.g. 3000 for React apps in development,
  • virtual.tls-email the email address to use for the ACME account managing the site's certificates,
  • virtual.auth.path with
  • virtual.auth.username and
  • virtual.auth.password together provide HTTP basic authentication.

Password should be a string base64 encoded from bcrypt hash. You can use https://bcrypt-generator.com/ with default config and https://www.base64encode.org/.

Backing up certificates

To backup certificates make a volume:

services:
  caddy:
    volumes:
      - ./caddy-info:/data/caddy

Usage

This image is created to be used in a single container.

version: "3"
services:
  caddy-gen:
    container_name: caddy-gen
    image: "wemakeservices/caddy-gen:latest"
    restart: always
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro # needs socket to read events
      - ./caddy-info:/data/caddy # needs volume to back up certificates
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - whoami

  whoami: # this is your service
    image: "katacoda/docker-http-server:v2"
    labels:
      - "virtual.host=myapp.com" # your domain
      - "virtual.alias=www.myapp.com" # alias for your domain (optional)
      - "virtual.port=80" # exposed port of this container
      - "[email protected]" # ssl is now on
      - "virtual.auth.path=/secret/*" # path basic authnetication applys to
      - "virtual.auth.username=admin" # Optionally add http basic authentication
      - "virtual.auth.password=JDJ5JDEyJEJCdzJYM0pZaWtMUTR4UVBjTnRoUmVJeXQuOC84QTdMNi9ONnNlbDVRcHltbjV3ME1pd2pLCg==" # By specifying both username and password hash

Or see docker-compose.yml example file.

Configuration

caddy-gen is configured with labels.

The main idea is simple. Every labeled service exposes a virtual.host to be handled. Then, every container represents a single upstream to serve requests.

There are several options to configure:

  • virtual.host is basically a domain name, see Caddy docs
  • virtual.alias (optional) domain alias, useful for www prefix with redirect. For example www.myapp.com. Alias will always redirect to the host above.
  • virtual.port exposed port of the container
  • virtual.tls-email could be empty, unset or set to valid email
  • virtual.tls (alias of virtual.tls-email) could be empty, unset or set to a valid set of tls directive value(s)
  • virtual.auth.username when set, along with virtual.auth.password and virtual.auth.path, http basic authentication is enabled
  • virtual.auth.password needs to be specified, along with virtual.auth.usernmae, to enable http basic authentication
  • virtual.auth.path sets path basic auth applys to.

Note, that options should not differ for containers of a single service.

Backing up certificates

To backup certificates make a volume:

services:
  caddy:
    volumes:
      - ./caddy-info:/data/caddy

Versions

This image supports two build-time arguments:

  • FOREGO_VERSION to change the current version of forego
  • DOCKER_GEN_VERSION to change the current version of docker-gen

See also

Changelog

Full changelog is available here.

License

MIT. See LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].