gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

Replace nginx+certbot with caddy #219

Closed bt90 closed 2 years ago

bt90 commented 3 years ago

Caddy is easier to configure, handles certificate renewal on its own and also supports gRPC using the h2c directive which uses cleartext http2 communication to the backend.

https://github.com/caddyserver/caddy/

https://hub.docker.com/_/caddy

afeiszli commented 3 years ago

Thanks @bt90, Nginx and certbot are what we use for the quick start guide, but isn't actually an official part of the project, just an opinionated way to get started. If you're willing to write up some documentation for the project, we'd gladly add it to the official docs. It should be pretty simple to run any arbitrary reverse proxy in front of Netmaker.

0x1a8510f2 commented 3 years ago

I'm thinking of trying netmaker with Caddy soon. I can give some examples here if I manage to get it working although I'm not sure I'll have time to write up complete docs.

bt90 commented 3 years ago

The following snippet should be enough:

{
    # LetsEncrypt account
    email you@your-domain.com
}

# Dashboard
https://dashboard.NETMAKER_BASE_DOMAIN {
    reverse_proxy http://127.0.0.1:8082
}

# API
https://api.NETMAKER_BASE_DOMAIN {
    reverse_proxy http://127.0.0.1:8081
}

# gRPC
https://grpc.NETMAKER_BASE_DOMAIN {
    reverse_proxy h2c://127.0.0.1:50051
}

The cool thing is that you can add caddy to your docker-compose definition with a static Caddyfile which get's filled using environment variables:

{
    # LetsEncrypt account
    email {$LE_MAIL}
}

# Dashboard
https://dashboard.{$BASE_DOMAIN} {
    reverse_proxy http://127.0.0.1:8082
}

# API
https://api.{$BASE_DOMAIN} {
    reverse_proxy http://127.0.0.1:8081
}

# gRPC
https://grpc.{$BASE_DOMAIN} {
    reverse_proxy h2c://127.0.0.1:50051
}
afeiszli commented 2 years ago

@bt90 @0x1a8510f2 Closed. Caddy is now the recommended way of doing a quick install of Netmaker! Thanks for the suggestion, I'm sure this will make installs easier for a lot of people.