Skip to content

Commit

Permalink
Merge pull request #75 from sagikazarmark/updates
Browse files Browse the repository at this point in the history
Various updates that bring the module up to modern standards
  • Loading branch information
damtur committed Jul 14, 2021
2 parents fce5cf4 + 0391efb commit 3eb9752
Show file tree
Hide file tree
Showing 18 changed files with 270 additions and 126 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
pull_request:
branches:
- master

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.15", "1.16"]
eureka: ["1.1.147", "1.3.1"]
env:
GOFLAGS: -mod=readonly

steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout@v2

- name: Launch Eureka
env:
EUREKA_VERSION: ${{ matrix.eureka }}
run: |
cp docker-compose.override.yml.dist docker-compose.override.yml
docker-compose up -d
echo "Waiting for Eureka to come up"
sleep 120
- name: Run tests
run: go test -v ./...
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.test
eureka
.vagrant/
.idea/
.idea/

/docker-compose.override.yml
45 changes: 0 additions & 45 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013 Hudl <@Hudl>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
54 changes: 8 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,62 +115,24 @@ get started.

1. Clone Fargo
1. If you don't have it, [install Docker](https://docs.docker.com/).
1. Change into the `docker` directory of this repository.

```bash
# Build the image, change "1.3.1" to 1.1.147 for the older version
VERSION=1.3.1
docker build -f Dockerfile-v$VERSION -t hudloss/eureka:$VERSION .
# Run two copies of the image (the containers will communicate with each other)
docker run -d --name eureka1 hudloss/eureka:$VERSION
docker run -d --name eureka2 hudloss/eureka:$VERSION

docker build -f Dockerfile-fargo-master -t hudloss/fargo:master .

# Run fargo container which launches shell
docker run --name fargo -it hudloss/fargo:master
# Once shell is attached, checkout your branch and run `go test ./...`
```
# Defaults to 1.1.147, can be set to 1.3.1
EUREKA_VERSION=1.1.147

Once all containers are running, please check that the IP addresses for
`eureka1` and `eureka2` are `172.17.0.2` and `172.17.0.3`. Eureka apps
will be available at those IPs on port 8080 from inside containers.
To expose the ports to your local machine, start containers using:
cp docker-compose.override.yml.dist docker-compose.override.yml

```bash
# forward port 8080 to local port 48000
docker run -d -p 48000:8080 --name eureka1 hudloss/eureka:1.1.147
# forward port 8080 to local port 49000
docker run -d -p 49000:8080 --name eureka2 hudloss/eureka:1.3.1
docker-compose up -d

# Run the tests
```


# Contributors

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

# MIT License

```
The MIT License (MIT)
Copyright (c) 2013 Hudl <@Hudl>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
```
The MIT License (MIT). Please see [License File](LICENSE) for more information.
5 changes: 3 additions & 2 deletions dns_discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ package fargo

import (
"fmt"
"github.com/cenkalti/backoff"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/franela/goreq"
"github.com/miekg/dns"
"time"
)

const azURL = "http://169.254.169.254/latest/meta-data/placement/availability-zone"
Expand Down
5 changes: 4 additions & 1 deletion dns_discover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package fargo
// MIT Licensed (see README.md) - Copyright (c) 2013 Hudl <@Hudl>

import (
. "github.com/smartystreets/goconvey/convey"
"testing"
"time"

. "github.com/smartystreets/goconvey/convey"
)

func TestGetNXDomain(t *testing.T) {
Expand All @@ -17,6 +18,8 @@ func TestGetNXDomain(t *testing.T) {
}

func TestGetNetflixTestDomain(t *testing.T) {
t.Skip("netflix domain discovery doesn't work")

Convey("Given domain txt.us-east-1.discoverytest.netflix.net.", t, func() {
// TODO: use a mock DNS server to eliminate dependency on netflix
// keeping their discoverytest domain up
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.override.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.8"

services:
eureka1:
ports:
- "127.0.0.1:8081:8080"

eureka2:
ports:
- "127.0.0.1:8082:8080"
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.8"

services:
eureka1:
build:
dockerfile: Dockerfile-v${EUREKA_VERSION:-1.1.147}
context: docker/
volumes:
- $PWD/docker/eureka-client-test-docker.properties:/tomcat/webapps/eureka/WEB-INF/classes/eureka-client-test.properties

eureka2:
build:
dockerfile: Dockerfile-v${EUREKA_VERSION:-1.1.147}
context: docker/
volumes:
- $PWD/docker/eureka-client-test-docker.properties:/tomcat/webapps/eureka/WEB-INF/classes/eureka-client-test.properties
12 changes: 6 additions & 6 deletions docker/Dockerfile-fargo-master
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM golang:1.6

ENV GOROOT=/usr/local/go
FROM golang:1.16

RUN go get github.com/tools/godep
RUN go get github.com/hudl/fargo

WORKDIR /go/src/github.com/hudl/fargo/
RUN godep restore
RUN git clone https://github.com/hudl/fargo.git /usr/local/src/fargo

WORKDIR /usr/local/src/fargo

RUN go mod download
2 changes: 2 additions & 0 deletions docker/eureka-client-test-docker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eureka.serviceUrl.default=http://eureka1:8080/eureka/v2/
eureka.vipAddress=eureka
16 changes: 16 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module github.com/hudl/fargo

go 1.16

require (
github.com/cenkalti/backoff/v4 v4.1.1
github.com/clbanning/mxj v1.8.4
github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2 // indirect
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8
github.com/miekg/dns v1.1.43
github.com/onsi/gomega v1.13.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/smartystreets/goconvey v1.6.4
gopkg.in/gcfg.v1 v1.2.3
gopkg.in/warnings.v0 v0.1.2 // indirect
)
Loading

0 comments on commit 3eb9752

Please sign in to comment.