All Projects → SeaBattle → seagull

SeaBattle / seagull

Licence: Apache-2.0 license
Configuration server submodule for all SeaSerives

Programming Languages

erlang
1774 projects
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to seagull

Docker Compose
一些基础服务的docker-compose配置文件,方便在一台新电脑上快速开始工作
Stars: ✭ 163 (+757.89%)
Mutual labels:  consul, etcd
perseus
Perseus is a set of scripts (docker+javascript) to investigate a distributed database's responsiveness when one of its three nodes is isolated from the peers
Stars: ✭ 49 (+157.89%)
Mutual labels:  consul, etcd
Remco
remco is a lightweight configuration management tool
Stars: ✭ 200 (+952.63%)
Mutual labels:  consul, etcd
Hippo
💨A well crafted go packages that help you build robust, reliable, maintainable microservices.
Stars: ✭ 134 (+605.26%)
Mutual labels:  consul, service-discovery
consul-examples
Example usages of consul functionality.
Stars: ✭ 88 (+363.16%)
Mutual labels:  consul, service-discovery
Go Oauth2 Server
A standalone, specification-compliant, OAuth2 server written in Golang.
Stars: ✭ 1,843 (+9600%)
Mutual labels:  consul, etcd
kongsul
Kong Api Gateway with Consul Service Discovery (MicroService)
Stars: ✭ 35 (+84.21%)
Mutual labels:  consul, service-discovery
Learning Tools
A collection of tools and files for learning new technologies
Stars: ✭ 1,287 (+6673.68%)
Mutual labels:  consul, etcd
blogr-pve
Puppet provisioning of HA failover/cluster environment implemented in Proxmox Virtual Environment and Linux boxes.
Stars: ✭ 28 (+47.37%)
Mutual labels:  consul, service-discovery
Uragano
Uragano, A simple, high performance RPC library. Support load balancing, circuit breaker, fallback, caching, intercepting.
Stars: ✭ 28 (+47.37%)
Mutual labels:  consul, service-discovery
Library
A microservice project using .NET Core 2.0, DDD, CQRS, Event Sourcing, Redis and RabbitMQ
Stars: ✭ 122 (+542.11%)
Mutual labels:  consul, service-discovery
rkt-compose
CLI to run Docker Compose file as pod on rkt with integrated service discovery using Consul - EOL
Stars: ✭ 24 (+26.32%)
Mutual labels:  consul, service-discovery
User.api
集成网关、身份认证、Token授权、微服务、.netcore等的基于CQRS的微服务开发框架示例
Stars: ✭ 109 (+473.68%)
Mutual labels:  consul, service-discovery
Condenserdotnet
API Condenser / Reverse Proxy using Kestrel and Consul, Including light weight consul lib
Stars: ✭ 147 (+673.68%)
Mutual labels:  consul, service-discovery
Eureka Consul Adapter
This project contains a Spring Boot Starter that registers HTTP endpoints on a Spring Cloud Eureka server to support Prometheus's service discovery mechanism for Consul (<consul_sd_config>)
Stars: ✭ 93 (+389.47%)
Mutual labels:  consul, service-discovery
Dbtester
Distributed database benchmark tester
Stars: ✭ 214 (+1026.32%)
Mutual labels:  consul, etcd
Containerpilot
A service for autodiscovery and configuration of applications running in containers
Stars: ✭ 1,078 (+5573.68%)
Mutual labels:  consul, service-discovery
Vip Manager
Manages a virtual IP based on state kept in etcd or Consul
Stars: ✭ 75 (+294.74%)
Mutual labels:  consul, etcd
sample-kotlin-ktor-microservices
sample microservices written in Kotlin that demonstrates usage of Ktor framework woth Consul server
Stars: ✭ 37 (+94.74%)
Mutual labels:  consul, service-discovery
etcdenv
Use your etcd keys as environment variables
Stars: ✭ 23 (+21.05%)
Mutual labels:  service-discovery, etcd

Seagull

Service for working with configuration and service-discovery via etcd or consul. Can be useful in microservices.
Build Status Enot

Configuration

Static

For configuration use sys.config:

{seagull, 
    [
        {backend, {Backend, BackendUrl}}
    ]
}

Where:
Backend is an module with implementation of sc_backend. BackendUrl is url to reach the service.
Example:

{seagull, 
        [
            {backend, {sc_backend_consul, "http://127.0.0.1:8500"}}
        ]
    }

Dynamic

In case you don't know consul url on compilation time you do not need to specify seagull configuration in sys.config. Just when you obtain you module, url and other params call seagull:add_backend/2/3. Third argument is a proplist with all your options (listed below).
Example:

seagull:add_backend(sc_backend_consul, "http://mydynamicconsul:8500", [{cache, #{enable => true, update_time => 15000}}]).

Caching kv

You can cache kv storage in ets by adding {cache, [{enable, true}]} to sys.config. By default cache is false. Also you should update interval for cache values to be synchronized with backend by adding #{update_time => TimeMS} to cache section. Default update interval is 5 sec. If you don't need to update values, set #{update_time => undefined} to disable cache values updates. Full Example:

{seagull, 
        [
            {backend, {sc_backend_consul, "http://127.0.0.1:8500"}},
            {cache, #{enable => true, update_time => 15000}}
        ]
    }

Service auto registration

To make registration of your service on application start - add seagull to your applications and add this option to seagull conf in sys.config:

{seagull, 
        [
            ...
            {autoregister, #{service => Service, address => Address, port => Port}},
            ...
        ]
    }

On update callbacks (Not implemented)

If you enabled cache update - you can add callback function, which will be called, when value is updated.
Remember, that callbacks are synchronous and are called from main conf sycle, so do not do any long operations in them.
Example:

ResetAllPassFun = fun(NewPass) -> database_man ! {reset_pass, NewPass} end, 
seagull:add_callback(<<"user_pass">>, ResetAllPassFun).

Callback can be removed with remove_callback:/1 function.

Usage

Unified api

After configuring backend you can use unified api:

1> seagull:get_services().
#{<<"consul">> => [],<<"postgres">> => [],<<"redis">> => []}

Consul special api

You can use consul special api with consul backend:

1> seagull:dns_request("redis").
[{1,1,6379,"tihon_home.node.dc1.consul"},
{1,1,6379,"tihon_work.su.node.dc1.consul"}]
2> seagull:get_service_near("redis").
{ok, #{<<"Address">> => <<"192.168.1.204">>,
        <<"CreateIndex">> => 313,
        <<"ModifyIndex">> => 313,
        <<"Node">> => <<"tihon_work.su">>,
        <<"ServiceAddress">> => <<>>,
        <<"ServiceEnableTagOverride">> => false,
        <<"ServiceID">> => <<"tihon_work.su:redis:6379">>,
        <<"ServiceName">> => <<"redis">>,
        <<"ServicePort">> => 6379,
        <<"ServiceTags">> => [],
        <<"TaggedAddresses">> => #{<<"wan">> => <<"192.168.1.204">>}}, 
        [#{<<"Address">> => <<"192.168.1.105">>,
            <<"CreateIndex">> => 231,
            <<"ModifyIndex">> => 231,
            <<"Node">> => <<"tihon_home">>,
            <<"ServiceAddress">> => <<>>,
            <<"ServiceEnableTagOverride">> => false,
            <<"ServiceID">> => <<"tihon_home:redis:6379">>,
            <<"ServiceName">> => <<"redis">>,
            <<"ServicePort">> => 6379,
            <<"ServiceTags">> => [],
            <<"TaggedAddresses">> => #{<<"lan">> => <<"192.168.1.105">>,
                <<"wan">> => <<"192.168.1.105">>}}]

Testing

To run tests of backends you will need this backends running and accessible. sc_backend_consul tries to find consul on http://127.0.0.1:8500, and sc_backend_etcd tries to find etcd on http://127.0.0.1:2379.
You can use install-deps.sh script for getting executables of theese two deps downloaded to $HOME/consul and $HOME/etcd.

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].