@@ -59,14 +59,6 @@ interface PathResolution {
5959 instancesFile: string ;
6060}
6161
62- /**
63- * Health check service
64- */
65- interface HealthService {
66- name: string ;
67- url: string ;
68- }
69-
7062/**
7163 * Get configuration from various sources
7264 * @param opts - Command line options
529521
530522 // Step 5: Start services
531523 console . log ( opts . demo ? "Step 5: Starting monitoring services..." : "Step 5: Starting monitoring services..." ) ;
532- const code2 = await runCompose ( [ "up" , "-d" ] ) ;
524+ const code2 = await runCompose ( [ "up" , "-d" , "--force-recreate" ] ) ;
533525 if ( code2 !== 0 ) {
534526 process . exitCode = code2 ;
535527 return ;
@@ -631,11 +623,13 @@ mon
631623 . description ( "health check for monitoring services" )
632624 . option ( "--wait <seconds>" , "wait time in seconds for services to become healthy" , parseInt , 0 )
633625 . action ( async ( opts : { wait : number } ) => {
634- const services : HealthService [ ] = [
635- { name : "Grafana" , url : "http://localhost:3000/api/health" } ,
636- { name : "Prometheus" , url : "http://localhost:59090/-/healthy" } ,
637- { name : "PGWatch (Postgres)" , url : "http://localhost:58080/health" } ,
638- { name : "PGWatch (Prometheus)" , url : "http://localhost:58089/health" } ,
626+ const services = [
627+ { name : "Grafana" , container : "grafana-with-datasources" } ,
628+ { name : "Prometheus" , container : "sink-prometheus" } ,
629+ { name : "PGWatch (Postgres)" , container : "pgwatch-postgres" } ,
630+ { name : "PGWatch (Prometheus)" , container : "pgwatch-prometheus" } ,
631+ { name : "Target DB" , container : "target-db" } ,
632+ { name : "Sink Postgres" , container : "sink-postgres" } ,
639633 ] ;
640634
641635 const waitTime = opts . wait || 0 ;
@@ -653,20 +647,16 @@ mon
653647 allHealthy = true ;
654648 for ( const service of services ) {
655649 try {
656- // Use native fetch instead of requiring curl to be installed
657- const controller = new AbortController ( ) ;
658- const timeoutId = setTimeout ( ( ) => controller . abort ( ) , 5000 ) ;
659-
660- const response = await fetch ( service . url , {
661- signal : controller . signal ,
662- method : 'GET' ,
663- } ) ;
664- clearTimeout ( timeoutId ) ;
650+ const { execSync } = require ( "child_process" ) ;
651+ const status = execSync ( `docker inspect -f '{{.State.Status}}' ${ service . container } 2>/dev/null` , {
652+ encoding : 'utf8' ,
653+ stdio : [ 'pipe' , 'pipe' , 'pipe' ]
654+ } ) . trim ( ) ;
665655
666- if ( response . status === 200 ) {
656+ if ( status === 'running' ) {
667657 console . log ( `✓ ${ service . name } : healthy` ) ;
668658 } else {
669- console . log ( `✗ ${ service . name } : unhealthy (HTTP ${ response . status } )` ) ;
659+ console . log ( `✗ ${ service . name } : unhealthy (status: ${ status } )` ) ;
670660 allHealthy = false ;
671661 }
672662 } catch ( error ) {
0 commit comments