115 lines
2.5 KiB
Go
115 lines
2.5 KiB
Go
package hostsetup
|
|
|
|
// edgeConfigTemplate is the setup-installed edge config. systemd runs the edge
|
|
// binary as the `iop` service user, so this template must pin a
|
|
// service-writable log path. `/var/lib/iop/edge` is the default data dir
|
|
// created and chowned to `iop:iop` during setup; the runtime creates the
|
|
// `logs` subdirectory under it.
|
|
const edgeConfigTemplate = `edge:
|
|
id: "edge-local"
|
|
name: "Local Edge"
|
|
|
|
server:
|
|
listen: "0.0.0.0:9090"
|
|
advertise_host: ""
|
|
|
|
bootstrap:
|
|
listen: "0.0.0.0:18080"
|
|
artifact_base_url: ""
|
|
artifact_dir: "artifacts"
|
|
|
|
tls:
|
|
enabled: false
|
|
|
|
logging:
|
|
level: "info"
|
|
pretty: false
|
|
path: "/var/lib/iop/edge/logs/edge.log"
|
|
|
|
metrics:
|
|
port: 9092
|
|
|
|
control_plane:
|
|
enabled: false
|
|
wire_addr: ""
|
|
reconnect_interval_sec: 5
|
|
|
|
nodes: []
|
|
`
|
|
|
|
// edgeBundleConfigTemplate is the local bundle edge config emitted by
|
|
// `iop-edge config init`. The empty `logging.path` lets the running edge
|
|
// binary resolve logs to `<binary-dir>/logs/edge.log`, which matches the
|
|
// bundle-local UX where the user owns the binary directory.
|
|
const edgeBundleConfigTemplate = `edge:
|
|
id: "edge-local"
|
|
name: "Local Edge"
|
|
|
|
server:
|
|
listen: "0.0.0.0:9090"
|
|
advertise_host: ""
|
|
|
|
bootstrap:
|
|
listen: "0.0.0.0:18080"
|
|
artifact_base_url: ""
|
|
artifact_dir: "artifacts"
|
|
|
|
tls:
|
|
enabled: false
|
|
|
|
logging:
|
|
level: "info"
|
|
pretty: false
|
|
path: ""
|
|
|
|
metrics:
|
|
port: 9092
|
|
|
|
control_plane:
|
|
enabled: false
|
|
wire_addr: ""
|
|
reconnect_interval_sec: 5
|
|
|
|
nodes: []
|
|
`
|
|
|
|
const nodeConfigTemplate = `transport:
|
|
edge_addr: "localhost:9090"
|
|
token: "changeme"
|
|
|
|
logging:
|
|
level: "info"
|
|
pretty: false
|
|
|
|
metrics:
|
|
port: 9091
|
|
`
|
|
|
|
func EdgeSpec() AppSpec {
|
|
return AppSpec{
|
|
Name: "iop-edge",
|
|
Description: "IOP Edge — execution group controller",
|
|
DefaultConfig: "/etc/iop/edge.yaml",
|
|
DefaultDataDir: "/var/lib/iop/edge",
|
|
DefaultUnit: "/etc/systemd/system/iop-edge.service",
|
|
ConfigTemplate: edgeConfigTemplate,
|
|
}
|
|
}
|
|
|
|
// EdgeBundleConfigTemplate returns the bundle-local edge config template used
|
|
// by `iop-edge config init`. It keeps `logging.path` empty so the local
|
|
// running binary resolves logs under its own directory.
|
|
func EdgeBundleConfigTemplate() string {
|
|
return edgeBundleConfigTemplate
|
|
}
|
|
|
|
func NodeSpec() AppSpec {
|
|
return AppSpec{
|
|
Name: "iop-node",
|
|
Description: "IOP Node — runtime worker",
|
|
DefaultConfig: "/etc/iop/node.yaml",
|
|
DefaultDataDir: "/var/lib/iop/node",
|
|
DefaultUnit: "/etc/systemd/system/iop-node.service",
|
|
ConfigTemplate: nodeConfigTemplate,
|
|
}
|
|
}
|