Skip to content

Commit b3b2d29

Browse files
committed
fix reload prometheus config
1 parent 8d981c9 commit b3b2d29

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

startos/actions/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async function writeSettings(effects: T.Effects, input: InputSpec) {
100100
},
101101
],
102102
})
103-
103+
104104
await reloadPrometheusConfig.run({
105105
effects,
106106
input: {},

startos/actions/reloadPrometheusConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { manifest } from '../manifest'
12
import { sdk } from '../sdk'
23

34
export const reloadPrometheusConfig = sdk.Action.withoutInput(
@@ -20,7 +21,7 @@ export const reloadPrometheusConfig = sdk.Action.withoutInput(
2021

2122
// execution function
2223
async ({ effects }) => {
23-
const status = await sdk.getStatus(effects, { packageId: 'grafana' })
24+
const status = await sdk.getStatus(effects, { packageId: manifest.id })
2425

2526
if (status.main === 'running') {
2627
await reloadPrometheus()

startos/main.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,18 @@ export const main = sdk.setupMain(async ({ effects, started }) => {
9090
exec(`chmod g+w ${jsonExporterSubcontainer.rootfs}/config`)
9191

9292
// grafana provisioning
93-
exec(`cp ${grafanaSubcontainer.rootfs}/assets/provisioning/datasources/prometheus.yml ${grafanaSubcontainer.rootfs}/etc/grafana/provisioning/datasources/prometheus.yml`)
94-
exec(`cp ${grafanaSubcontainer.rootfs}/assets/provisioning/dashboards/dashboards.yml ${grafanaSubcontainer.rootfs}/etc/grafana/provisioning/dashboards/dashboards.yml`)
95-
exec(`cp ${grafanaSubcontainer.rootfs}/assets/dashboards/axeos.json ${grafanaSubcontainer.rootfs}/etc/grafana/dashboards/axeos.json`)
93+
exec(
94+
`cp ${grafanaSubcontainer.rootfs}/assets/provisioning/datasources/prometheus.yml ` +
95+
`${grafanaSubcontainer.rootfs}/etc/grafana/provisioning/datasources/prometheus.yml`,
96+
)
97+
exec(
98+
`cp ${grafanaSubcontainer.rootfs}/assets/provisioning/dashboards/dashboards.yml ` +
99+
`${grafanaSubcontainer.rootfs}/etc/grafana/provisioning/dashboards/dashboards.yml`,
100+
)
101+
exec(
102+
`cp ${grafanaSubcontainer.rootfs}/assets/dashboards/axeos.json ` +
103+
`${grafanaSubcontainer.rootfs}/etc/grafana/dashboards/axeos.json`,
104+
)
96105

97106
const healthReceipts: T.HealthCheck[] = []
98107

@@ -103,7 +112,7 @@ export const main = sdk.setupMain(async ({ effects, started }) => {
103112
runAsInit: true,
104113
env: {},
105114
ready: {
106-
display: 'JSON Exporter',
115+
display: null,
107116
fn: () =>
108117
sdk.healthCheck.checkPortListening(effects, 7979, {
109118
successMessage: 'JSON Exporter is ready',
@@ -147,14 +156,14 @@ export const main = sdk.setupMain(async ({ effects, started }) => {
147156
ready: {
148157
display: 'Grafana', // If null, the health check will NOT be displayed to the user. If provided, this string will be the name of the health check and displayed to the user.
149158
// The function below determines the health status of the daemon.
159+
gracePeriod: 60000,
150160
fn: () =>
151161
sdk.healthCheck.checkWebUrl(
152162
effects,
153163
'http://axeos-monitor-aio.startos:' + uiPort,
154164
{
155-
timeout: 60000,
156165
successMessage: 'Grafana is ready',
157-
errorMessage: 'Grafana is unreachable',
166+
errorMessage: 'Grafana is unreachable',
158167
},
159168
),
160169
},

0 commit comments

Comments
 (0)