• Stars
    star
    132
  • Rank 273,009 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Golang client for Netflix Eureka

fargo

Netflix Eureka client in golang. Named for the show Eureka.

c = fargo.NewConn("http://127.0.0.1:8080/eureka/v2")
c.GetApps() // returns a map[String]fargo.Application

Testing

Tests can be executed using docker container. See the below section to build and start all the required containers. Once the Eureka containers are running, and fargo image is built then you can run the command as follows:

Run:

docker run --rm -v "$PWD":/go/src/github.com/hudl/fargo -w /go/src/github.com/hudl/fargo hudloss/fargo:master go test -v ./...

Note: If you are running bash for Windows add MSYS_NO_PATHCONV=1 at the beginning.

The tests may need to be run a couple of times to allow changes to propagate between the two Eureka servers. If the tests are failing, try running them again approximately 30 seconds later.

If you are adding new packages to godep you may want to update the hudloss/fargo image first.

Known Issues

Until this PR is in an official vagrant release, the Fedora 19 opscode box will fail when setting up private networks in vagrant 1.2.5 and later.

FAQ

Q: Is this a full client?

A: Not yet. It's very much a work in progress, and it's also being built with consideration for Go idioms, which means some Java-isms will never be included.

Q: Does it cache?

A: No, it does not support caching records.

Q: Can I integrate this into my Go app and have it manage hearbeats to Eureka?

A: Glad you asked, of course you can. Just grab an application (for this example, "TESTAPP")

// register a couple instances, and then set up to only heartbeat one of them
e, _ := fargo.NewConnFromConfigFile("/etc/fargo.gcfg")
app, _ := e.GetApp("TESTAPP")
// starts a goroutine that updates the application on poll interval
e.UpdateApp(&app)
for {
    for _, ins := range app.Instances {
        fmt.Printf("%s, ", ins.HostName)
    }
    fmt.Println(len(app.Instances))
    <-time.After(10 * time.Second)
}
// You'll see all the instances at first, and within a minute or two all the
// ones that aren't heartbeating will disappear from the list. Note that after
// calling `UpdateApp` there's no need to manually update

TODO

  • Actually do something with AWS availability zone info
  • Currently the load balancing is random, and does not give preference to servers within a zone.
  • Make releases available on gopkg.in

Hacking

Just Let Me Import Already

go get github.com/hudl/fargo

package main

import (
    "github.com/hudl/fargo"
)

func main() {
    e, _ := fargo.NewConnFromConfigFile("/etc/fargo.gcfg")
    e.AppWatchChannel
}

Adding Stuff

go test is your friend. I use the excellent goconvey library in addition to the standard lib's testing package. If you add something, write a test. If something is broken, write a test that reproduces your issue or post repro steps to the issues on this repository. The tests require that you have a eureka install and are designed to run against the included vagrant specs.

Verifying Releases

We're on semver and tag releases accordingly. The releases are signed and can be verified with git tag --verify vA.B.C.

Using Docker

Fargo is tested against two eureka versions, v1.1.147 and v1.3.1. To support testing, we provide Docker containers that supply Eureka locally. Here's how to get started.

  1. Clone Fargo
  2. If you don't have it, install Docker.
# Defaults to 1.1.147, can be set to 1.3.1
EUREKA_VERSION=1.1.147

cp docker-compose.override.yml.dist docker-compose.override.yml

docker-compose up -d

# Run the tests

Contributors

  • Ryan S. Brown (ryansb)
  • Carl Quinn (cquinn)

MIT License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

HudlFfmpeg

Hudl.Ffmpeg framework
C#
112
star
2

react-native-android-fragment

DEPRECATED: A utility library for facilitating React Native development with Android Fragments.
Java
99
star
3

Mjolnir

Isolation and fail-fast fault tolerance library, modeled after https://github.com/Netflix/Hystrix.
C#
78
star
4

luigi-monitor

Send summary messages of your Luigi jobs to Slack
Python
46
star
5

react-native-system-bars

Control the visibility of Android's Status Bar and Navigation Bar
Java
38
star
6

nugget

Client/server framework for building awesome communal dashboards.
JavaScript
28
star
7

DeviceNanny

Mobile device checkout system
Python
19
star
8

iOS-FFmpeg-processor

FFmpeg encoder for iOS
C
16
star
9

HudlDistortionCorrectionTool

Toolbox for generating, tweaking, and applying distortion correction parameters to videos and images
C++
13
star
10

qupid

C# API for running sql-like queries against MongoDB
C#
11
star
11

react-native-detox-context

Easily pass data from Detox e2e tests to the JS layer
Java
10
star
12

scrollomatic

jQuery plugin for fragment scrolling with URL manipulation and support for fixed headers
JavaScript
10
star
13

Tyr

Tyr is a Python library used internally at Hudl to automate the task of spinning up individual servers as well as different types of clusters.
Python
8
star
14

CalendarToSlack

Grabs calendar data from Outlook and sets Slack presence to Away when events occur.
TypeScript
7
star
15

riemann-cookbook

Chef cookbook for Riemann
Ruby
7
star
16

Convenus

Meeting room status display web application
JavaScript
7
star
17

docker

Home for our public Docker container Dockerfiles
Python
4
star
18

hudlbot

CoffeeScript
3
star
19

redux-action-logger

A simple, extensible redux middleware system to generate logs from actions
JavaScript
3
star
20

fastlane-plugin-xclogparser

Ruby
2
star
21

IPCaptureDemo

This is demo MacOS App for IP Capture Demo
Objective-C
2
star
22

go-pagerduty

A go library for interacting with the PagerDuty API
Go
2
star
23

NSArray-FunctionalHelper

A category for NSArray with several functional methods you've seen in other languages.
Objective-C
2
star
24

skunkworks-tournament

Tournament Tracking with Hudl integration
JavaScript
1
star
25

remote-controls

HTML
1
star
26

stackdriver.net

A C# wrapper for sending custom metrics to StackDriver
C#
1
star
27

zendesk-exporter

A simple command line application that continuously exports data from Zendesk
Go
1
star
28

data-docs

Holds data documentation
1
star
29

appmesh-playground

A safe place to play with AppMesh and other supporting AWS services. This repository aims to be a hub full of example AppMesh architectures.
C#
1
star
30

pages-public-api

Fetches tweets in JSON format for custom displays
JavaScript
1
star