Giter VIP home page Giter VIP logo

vergilius's Introduction

Vergilius

nginx http router for docker cluster based on consul

Circle CI

what is that

Docker image with nginx and tornado app, that has an opinion on how to route traffic to docker containers registered in consul.

run

docker run -d -p 80:80 -p 433:433 --env-file .env --name vergilius devopsftw/vergilius

Example .env file:

CONSUL_HOST=127.0.0.1
SECRET=passw0rd
EMAIL=root@localhost

how routing works

Consul service config example

{
  "service": {
    "name": "my-http-service",
    "tags": [
      "http",
      "http:service.example.com",
      "http:www.service.example.com"
    ],
    "port": 8080
  }
}

Vergilius looks for registered services with tags http and http2 creates upstream with all containers of this service, routes requests from (www.)?service.example.com and *.(www.)?service.example.com to containers using nginx least_conn balancing algorithm.

You can also add tcp and udp tags to service, vergilus will stream this protocols too. External ports for this services are stored in consul KV at vergilius/ports/%service_name%. You can configure external ports range with PROXY_PORTS env, for ex.: 5000-6000. It's strongly recommended to use vergilius in net=host mode or disable userland-proxy, because docker will create as much userland proxies as PROXY_PORTS you have.

how http2 works

To use http2 proxy, use http2 tag instead of http or use both. Vergilius will try to acquire certificate from plugin or create self signed certificate.

identity

Vergilius has an identity. To move vergilius seamlessly, copy vergilius/identity consul kv folder to your new cluster. If no identity found on start - it will be created for you.

  • Consul key: vergilius/identity/private_key โ€” private dsa3 encrypted RSA key with password specified in env SECRET, used for certificates signing.
  • Environment variable: SECRET - used for any encryption in vergilius

service configuration

Additional tags:

  • allow_crossdomain โ€” allow all crossdomain xhr communication for service.

plugins

See our organisation's repos for official plugins

There are letsencrypt/acme and doorman (oauth proxy) integrations will be available soon.

custom configs

To add custom nginx configs simply mount your configs folder to /etc/nginx/sites-enabled

TODO

  • readthedocs, sphinx
  • docker events + labels, Apache Zookeeper, etcd, eureka, etc. support?

For any ideas or issues please don't hesitate to submit an issue on github.

vergilius's People

Contributors

bazilio91 avatar ramm avatar holycheater avatar

Watchers

Dimitri Grinkevich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.