Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
manedurphy committed Dec 14, 2021
0 parents commit dc76bc4
Show file tree
Hide file tree
Showing 10 changed files with 1,182 additions and 0 deletions.
27 changes: 27 additions & 0 deletions basic/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"fmt"
"net/http"
)

func main() {
var (
mux *http.ServeMux
server *http.Server
)
mux = http.NewServeMux()
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("healthy"))
})
server = &http.Server{
Addr: ":8080",
Handler: mux,
}

fmt.Println("server started on port 8080")
if err := server.ListenAndServe(); err != nil {
panic(err)
}
}
20 changes: 20 additions & 0 deletions basic/payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "scheduler-atlanta-01",
"tags": ["measurement-scheduler"],
"address": "127.0.0.1",
"meta": {
"location": "atlanta",
"region": "us-east-1"
},
"port": 8080,
"check": {
"name": "health-check",
"http": "http://localhost:8080/healthz",
"method": "GET",
"notes": "Health endpoint ensures that service is available",
"deregister_critical_service_after": "2m",
"timeout": "5s",
"tls_skip_verify": true,
"interval": "10s"
}
}
17 changes: 17 additions & 0 deletions configs/consul_client_01.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# The region of the Consul cluster
datacenter = "us-west-1"

# The data directory stores the Consul data
data_dir = "/opt/consul"

# The address to which Consul will bind client interfaces
client_addr = "0.0.0.0"

# Sets the instance to run in server mode
server = false

# The address to advertise to other nodes in the Consul cluster
advertise_addr = "{{ GetInterfaceIP `ens5` }}"

# The address of the node to join on start up
retry_join = ["172.31.107.196", "172.31.105.153", "172.31.110.188"]
17 changes: 17 additions & 0 deletions configs/consul_client_02.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# The region of the Consul cluster
datacenter = "us-west-1"

# The data directory stores the Consul data
data_dir = "/opt/consul"

# The address to which Consul will bind client interfaces
client_addr = "0.0.0.0"

# Sets the instance to run in server mode
server = false

# The address to advertise to other nodes in the Consul cluster
advertise_addr = "{{ GetInterfaceIP `ens5` }}"

# The address of the node to join on start up
retry_join = ["172.31.107.196", "172.31.105.153", "172.31.110.188"]
33 changes: 33 additions & 0 deletions configs/consul_server_01.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# The region of the Consul cluster
datacenter = "us-west-1"

# The data directory stores the Consul data
data_dir = "/opt/consul"

# The UI configuration
ui_config {
enabled = true
}

# Configures the ports
ports {
http = 3000
}

# The address to which Consul will bind client interfaces
client_addr = "0.0.0.0"

# Sets the instance to run in server mode
server = true

# Address for internal communication within the Consul cluster
bind_addr = "0.0.0.0"

# The address to advertise to other nodes in the Consul cluster
advertise_addr = "{{ GetInterfaceIP `ens5` }}"

# The number of expected servers
bootstrap_expect = 3

# The address of the node to join on start up
retry_join = ["172.31.107.196", "172.31.105.153", "172.31.110.188"]
28 changes: 28 additions & 0 deletions configs/consul_server_02.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The region of the Consul cluster
datacenter = "us-west-1"

# The data directory stores the Consul data
data_dir = "/opt/consul"

# The UI configuration
ui_config {
enabled = false
}

# The address to which Consul will bind client interfaces
client_addr = "0.0.0.0"

# Sets the instance to run in server mode
server = true

# Address for internal communication within the Consul cluster
bind_addr = "0.0.0.0"

# The address to advertise to other nodes in the Consul cluster
advertise_addr = "{{ GetInterfaceIP `ens5` }}"

# The number of expected servers
bootstrap_expect = 3

# The address of the node to join on start up
retry_join = ["172.31.107.196", "172.31.105.153", "172.31.110.188"]
68 changes: 68 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module service-discovery

go 1.17

require (
github.com/hashicorp/consul v1.10.5
github.com/hashicorp/consul/api v1.11.0
)

require (
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible // indirect
github.com/circonus-labs/circonusllhist v0.1.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/golang/protobuf v1.3.5 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/hashicorp/consul/sdk v0.8.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-retryablehttp v0.6.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-syslog v1.0.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/memberlist v0.2.4 // indirect
github.com/hashicorp/raft v1.3.2 // indirect
github.com/hashicorp/raft-autopilot v0.1.5 // indirect
github.com/hashicorp/serf v0.9.5 // indirect
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.1.41 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.0 // indirect
github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452 // indirect
github.com/mitchellh/mapstructure v1.4.1-0.20210112042008-8ebf2d61a8b4 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.4.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.9.1 // indirect
github.com/prometheus/procfs v0.0.8 // indirect
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.6.1 // indirect
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
Loading

0 comments on commit dc76bc4

Please sign in to comment.