Making Nomad register services with consul in dev mode

This commit is contained in:
Diptanu Choudhury
2016-05-13 10:19:49 -07:00
parent 2216944676
commit b2c18168a4
3 changed files with 13 additions and 2 deletions

View File

@@ -69,7 +69,8 @@ func NewAgent(config *Config, logOutput io.Writer) (*Agent, error) {
}
if err := a.syncAgentServicesWithConsul(a.serverHTTPAddr, a.clientHTTPAddr); err != nil {
a.logger.Printf("[ERR] agent: unable to sync agent services with consul: %v", err)
} else {
}
if a.consulService != nil {
go a.consulService.PeriodicSync()
}
return a, nil

View File

@@ -140,6 +140,10 @@ type ConsulConfig struct {
// clients with Consul
ClientServiceName string `mapstructure:"client_service_name"`
// AutoRegister determines if Nomad will register the Nomad client and
// server agents with Consul
AutoRegister bool `mapstructure:"auto_register"`
// Addr is the address of the local Consul agent
Addr string `mapstructure:"addr"`
@@ -419,6 +423,11 @@ func DefaultConfig() *Config {
Addresses: &Addresses{},
AdvertiseAddrs: &AdvertiseAddrs{},
Atlas: &AtlasConfig{},
ConsulConfig: &ConsulConfig{
ServerServiceName: "nomad-server",
ClientServiceName: "nomad-client",
AutoRegister: true,
},
Client: &ClientConfig{
Enabled: false,
NetworkSpeed: 100,