iop/packages/hostsetup/templates.go
toki 5bb8a4bc85 feat: edge local dev config and observability improvements
- Add edge node bootstrap and runtime configuration
- Update observability with test coverage
- Add hostsetup test and template updates
- Add m-edge-local-dev-config-runtime task tracking
2026-05-28 05:44:43 +09:00

101 lines
2.2 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:
artifact_base_url: ""
tls:
enabled: false
logging:
level: "info"
pretty: false
path: "/var/lib/iop/edge/logs/edge.log"
metrics:
port: 9092
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:
artifact_base_url: ""
tls:
enabled: false
logging:
level: "info"
pretty: false
path: ""
metrics:
port: 9092
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,
}
}