Git Product home page Git Product logo

consul-envoy's Introduction

About consul-envoy

This project aim to be a quick'n'dirty way to get Envoy and Consul talking nicely, so any Consul service URL can be routed through evnoy.

The current code allows to route *.service.consul to the backends availble in the Consul catalog

Currently RDS - Route discovery service, SDS - Service discovery service and CDS - Cluster discovery service is implemented

Project goal

Making using Envoy with Consul as easy as fabio and traefik, possible exposting additional configuration to envoy through Consul Service tags (similar to fabio urlprefix-* configuration).

Configuration

  • PORT (env) - the HTTP port to listen on (example: 8877)
  • CONSUL_* (env) - the default Consul environment variables is used when connecting to the Consul cluster. (e.g. CONSUL_HTTP_ADDR)

Building

make requirements to install Go Vendor and fetch dependencies make install to build the binary (consul-envoy) into ${GOPATH}/bin make dist to build platform specific binary into ./build/consul-enovy-${OS}-${ARCH}

Example envoy config

The configuration assume that this project is named envoy-consul in the Consul catalog and listens on port 8877

{
    "listeners": [
        {
            "address": "tcp://0.0.0.0:80",
            "filters": [
                {
                    "name": "http_connection_manager",
                    "config": {
                        "codec_type": "auto",
                        "stat_prefix": "http",
                        "use_remote_address": true,
                        "rds": {
                            "route_config_name": "default",
                            "refresh_delay_ms": 10000,
                            "cluster": "rds_http"
                        },
                        "filters": [
                            {
                                "name": "router",
                                "config": {}
                            }
                        ]
                    }
                }
            ]
        },
    ],
    "admin": {
        "access_log_path": "/dev/null",
        "address": "tcp://0.0.0.0:8001"
    },
    "cluster_manager": {
        "cds": {
            "cluster": {
                "name": "cds",
                "type": "logical_dns",
                "lb_type": "round_robin",
                "connect_timeout_ms": 1000,
                "hosts": [
                    {
                        "url": "tcp://consul-envoy.service.consul:8877"
                    }
                ]
            }
        },
        "sds": {
            "refresh_delay_ms": 5000,
            "cluster": {
                "name": "sds",
                "type": "logical_dns",
                "lb_type": "round_robin",
                "connect_timeout_ms": 1000,
                "hosts": [
                    {
                        "url": "tcp://consul-envoy.service.consul:8877"
                    }
                ]
            }
        },
        "clusters": [
            {
                "name": "rds_http",
                "type": "logical_dns",
                "lb_type": "round_robin",
                "connect_timeout_ms": 1000,
                "hosts": [
                    {
                        "url": "tcp://consul-envoy.service.consul:8877"
                    }
                ]
            }
        ]
    }
}

consul-envoy's People

Contributors

jippi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

consul-envoy's Issues

Could not find consul domain

I tried to start with

PORT=1000 CONSUL_HTTP_ADDR=10.10.7.201:8500 go run main.go

but the error tells me

Could not find consul domain

the question is,

  1. How to check my consul domain is? I run it without passing a domain parameter.
  2. How to passing the domain to consul-envoy.

thankyou

Add a License

Hi!

I would like to use this as a base for connecting consul registered services to envoy.

Are you open to adding a LICENSE like Apache's or MIT?

Thanks!

panic serving

so, I tried to hardcode the domain variable.. and run it.

How to check if my service running successfully or not? when I tried to go to the port... the page said

404 page not found

And when I tried to use it in my envoy, its send me a panic error:
panic

my envoy configuration is:
image
*10.10.4.9:9000 is where my consul-envoy lies

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.