simplify
This commit is contained in:
parent
e5cfd6f4fb
commit
825c18b6d6
@ -15,6 +15,8 @@ ENV MONITORD_PATH = "./oc-monitord"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY conf/docker_schedulerd.json /etc/oc/schedulerd.json
|
||||
|
||||
COPY --from=monitord /app/oc-monitord .
|
||||
COPY --from=builder /app/oc-schedulerd .
|
||||
COPY conf/docker_schedulerd.json /etc/oc/schedulerd.json
|
||||
|
26
conf/conf.go
26
conf/conf.go
@ -9,7 +9,6 @@ import (
|
||||
|
||||
type Config struct {
|
||||
MonitorPath string
|
||||
OcCatalogUrl string
|
||||
MongoUrl string
|
||||
DBName string
|
||||
Logs string
|
||||
@ -21,7 +20,6 @@ var instance *Config
|
||||
var once sync.Once
|
||||
|
||||
const defaultConfigFile = "/etc/oc/schedulerd.json"
|
||||
const localConfigFile = "./conf/local_schedulerd.json"
|
||||
|
||||
func init() {
|
||||
configFile := ""
|
||||
@ -33,28 +31,18 @@ func init() {
|
||||
logs.Info("Config file found : " + defaultConfigFile)
|
||||
configFile = defaultConfigFile
|
||||
}
|
||||
l1, err := onion.NewFileLayer(localConfigFile, nil)
|
||||
if err == nil {
|
||||
logs.Info("Local config file found " + localConfigFile + ", overriding default file")
|
||||
configFile = localConfigFile
|
||||
}
|
||||
if configFile == "" {
|
||||
if configFile == "" || l2 == nil {
|
||||
logs.Info("No config file found, using env")
|
||||
o = onion.New(l3)
|
||||
} else if l1 == nil && l2 == nil {
|
||||
o = onion.New(l1, l2, l3)
|
||||
} else if l1 == nil {
|
||||
} else {
|
||||
o = onion.New(l2, l3)
|
||||
} else if l2 == nil {
|
||||
o = onion.New(l1, l3)
|
||||
}
|
||||
GetConfig().MonitorPath = o.GetStringDefault("MONITORD_PATH", "../oc-monitord/oc-monitord")
|
||||
GetConfig().OcCatalogUrl = o.GetStringDefault("oc-catalog", "https://localhost:49618")
|
||||
GetConfig().Logs = o.GetStringDefault("loglevel", "info")
|
||||
GetConfig().LokiUrl = o.GetStringDefault("loki_url", "http://127.0.0.1:3100")
|
||||
GetConfig().NatsUrl = o.GetStringDefault("nats_url", "http://127.0.0.1:4222")
|
||||
GetConfig().MongoUrl = o.GetStringDefault("mongo_url", "mongodb://127.0.0.1:27017")
|
||||
GetConfig().DBName = o.GetStringDefault("database_name", "DC_myDC")
|
||||
GetConfig().Logs = o.GetStringDefault("LOG_LEVEL", "info")
|
||||
GetConfig().LokiUrl = o.GetStringDefault("LOKI_URL", "http://127.0.0.1:3100")
|
||||
GetConfig().NatsUrl = o.GetStringDefault("NATS_URL", "http://127.0.0.1:4222")
|
||||
GetConfig().MongoUrl = o.GetStringDefault("MONGO_URL", "mongodb://127.0.0.1:27017")
|
||||
GetConfig().DBName = o.GetStringDefault("MONGO_DATABASE", "DC_myDC")
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
{
|
||||
"oc-catalog" : "http://oc-catalog:49618/",
|
||||
"loki_url" : "http://192.168.1.18:3100"
|
||||
"LOKI_URL" : "http://loki:3100",
|
||||
"MONGO_URL":"mongodb://mongo:27017/",
|
||||
"MONGO_DATABASE":"DC_myDC",
|
||||
"NATS_URL": "nats://nats:4222"
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"oc-catalog" : "http://localhost:49618/",
|
||||
"logs" : "",
|
||||
"mongo_url": "mongodb://127.0.0.1:27017"
|
||||
}
|
@ -3,6 +3,7 @@ package daemons
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"oc-schedulerd/conf"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -72,7 +73,7 @@ type ScheduleManager struct {
|
||||
// on workflows' scheduling. Messages must contain
|
||||
// workflow execution ID, to allow retrieval of execution infos
|
||||
func (s *ScheduleManager) ListenForWorkflowSubmissions() {
|
||||
nc, err := nats.Connect(nats.DefaultURL)
|
||||
nc, err := nats.Connect(conf.GetConfig().NatsUrl)
|
||||
if err != nil {
|
||||
s.Logger.Error().Msg("Could not connect to NATS")
|
||||
return
|
||||
|
39
docker-compose.tools.yml
Normal file
39
docker-compose.tools.yml
Normal file
@ -0,0 +1,39 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
nats:
|
||||
image: 'nats:latest'
|
||||
container_name: nats
|
||||
ports:
|
||||
- 4222:4222
|
||||
command:
|
||||
- "--debug"
|
||||
networks:
|
||||
- scheduler
|
||||
- catalog
|
||||
loki:
|
||||
image: 'grafana/loki'
|
||||
container_name: loki
|
||||
ports :
|
||||
- "3100:3100"
|
||||
networks:
|
||||
- scheduler
|
||||
grafana:
|
||||
image: 'grafana/grafana'
|
||||
container_name: grafana
|
||||
ports:
|
||||
- '3000:3000'
|
||||
networks:
|
||||
- scheduler
|
||||
volumes:
|
||||
- ./conf/grafana_data_source.yml:/etc/grafana/provisioning/datasources/datasource.yml
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=pfnirt # Change this to anything but admin to not have a password change page at startup
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_DISABLE_INITIAL_ADMIN_PASSWORD_CHANGE=true
|
||||
|
||||
networks:
|
||||
scheduler:
|
||||
external: true
|
||||
catalog:
|
||||
external: true
|
@ -1,39 +1,16 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
nats:
|
||||
image: 'nats:latest'
|
||||
container_name: nats
|
||||
ports:
|
||||
- 4222:4222
|
||||
command:
|
||||
- "--debug"
|
||||
networks:
|
||||
- scheduler
|
||||
- catalog
|
||||
loki:
|
||||
image: 'grafana/loki'
|
||||
container_name: loki
|
||||
ports :
|
||||
- "3100:3100"
|
||||
networks:
|
||||
- scheduler
|
||||
grafana:
|
||||
image: 'grafana/grafana'
|
||||
container_name: grafana
|
||||
ports:
|
||||
- '3000:3000'
|
||||
networks:
|
||||
- scheduler
|
||||
volumes:
|
||||
- ./conf/grafana_data_source.yml:/etc/grafana/provisioning/datasources/datasource.yml
|
||||
oc-schedulerd:
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=pfnirt # Change this to anything but admin to not have a password change page at startup
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_DISABLE_INITIAL_ADMIN_PASSWORD_CHANGE=true
|
||||
- MONGO_DATABASE=DC_myDC
|
||||
image: 'oc-schedulerd:latest'
|
||||
ports:
|
||||
- 9001:8080
|
||||
container_name: oc-schedulerd
|
||||
networks:
|
||||
- catalog
|
||||
|
||||
networks:
|
||||
scheduler:
|
||||
external: true
|
||||
catalog:
|
||||
external: true
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user