iop/packages/go/hostsetup/templates.go
toki 445716cc3e feat(edge): runtime config refresh mechanism implementation
- Add configrefresh package for config classification, request handling
- Add bootstrap refresh_admin.go for admin-level config refresh
- Add edgevalidate package for config validation
- Update edge bootstrap runtime with refresh capabilities
- Update edge service layer with config refresh integration
- Update openai layer routes/chat_handler/server for config refresh
- Update edgecmd config handling with refresh support
- Update input manager, transport server, status provider
- Add edge.yaml config updates and go/config package changes
- Add hostsetup templates and test updates
- Update roadmap and phase documentation for runtime-reconnect-config-refresh
2026-06-21 21:35:50 +09:00

123 lines
2.6 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: 19092
control_plane:
enabled: false
wire_addr: ""
reconnect_interval_sec: 5
refresh:
enabled: false
listen: "127.0.0.1:19093"
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: 19092
control_plane:
enabled: false
wire_addr: ""
reconnect_interval_sec: 5
refresh:
enabled: false
listen: "127.0.0.1:19093"
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,
}
}