Skip to content

Instantly share code, notes, and snippets.

@zmanian
Created May 7, 2018 21:55
Show Gist options
  • Save zmanian/952905e9fa20db48445120914e90295a to your computer and use it in GitHub Desktop.
Save zmanian/952905e9fa20db48445120914e90295a to your computer and use it in GitHub Desktop.

This expects that your have a cosmos node running on localhost and opened ports 80 and 443 on your firewall and assigned a domain name to your server's public ip address.

  1. Download Traefik

https://github.com/containous/traefik/releases

wget https://github.com/containous/traefik/releases/download/v1.6.0/traefik

  1. Create a traefik config from the example below. Change the domain at #MUSTCHANGE to yours
# Sample entrypoint configuration when using ACME.
[entryPoints]
  [entryPoints.http]
  address = ":80"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

# Enable ACME (Let's Encrypt): automatic SSL.
[acme]

# Email address used for registration.
#
# Required
#
email = "[email protected]"

# File or key used for certificates storage.
#
# Required
storage = "acme.json"
# or `storage = "traefik/acme/account"` if using KV store.

# Entrypoint to proxy acme apply certificates to.
#
# Required
#
entryPoint = "https"
[[acme.domains]]
   main = "example.com" #MUSTCHANGE to your domain

[acme.httpChallenge]
  entryPoint = "http"

[file]

[backends]
  [backends.backend1]
    [backends.backend1.servers.cosmos]
    url = "http://localhost:46657"

[frontends]
  [frontends.cosmos]
  backend = "backend1"
  entrypoints = ["http","https"]
   [frontends.cosmos.routes.hosts]
    rule = "Host:example.com" #MUSTCHANGE to your domain
  passHostHeader = true
  passTLSCert = true
  priority = 10
     
  1. Start the proxy sudo ./traefik --configFile=traefik.cosmos.toml

Try sudo ./traefik --configFile=traefik.cosmos.toml --loglevel=DEBUG to debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment