@@ -43,8 +43,9 @@ const IMAGE: &str = "getobelisk/obelisk:0.25.1-ubuntu";
4343const OBELISK_TOML_PATH : & str = formatcp ! ( "{VOLUME_MOUNT_PATH}/obelisk.toml" ) ;
4444const OBELISK_BIN_PATH : & str = "/obelisk/obelisk" ;
4545const REGION : Region = Region :: Ams ;
46- const WEBHOOK_PORT : u16 = 9090 ;
47- const DEPLOYED_HEALTHCHECK_PATH : & str = "/obeliskhealthcheck" ;
46+ const WEBHOOK_INTERNAL_PORT : u16 = 9090 ;
47+ const HEALTHCHECK_INTERNAL_PORT : u16 = 9091 ;
48+ const HEALTHCHECK_EXTERNAL_PORT : u16 = 444 ;
4849
4950fn allocate_ip ( app_name : & str ) -> Result < ( ) , AppInitModifyError > {
5051 activity_fly_http:: ips:: allocate (
@@ -238,14 +239,26 @@ fn launch_final_vm(app_name: &str) -> Result<(), AppInitModifyError> {
238239 volume: VOLUME_NAME . to_string( ) ,
239240 path: VOLUME_MOUNT_PATH . to_string( ) ,
240241 } ] ) ,
241- services : Some ( vec ! [ ServiceConfig {
242- internal_port: WEBHOOK_PORT ,
243- protocol: ServiceProtocol :: Tcp ,
244- ports: vec![ PortConfig {
245- port: 443 ,
246- handlers: vec![ PortHandler :: Tls ] ,
247- } ] ,
248- } ] ) ,
242+ services : Some ( vec ! [
243+ // Expose health check server as https://[::]:HEALTHCHECK_EXTERNAL_PORT
244+ ServiceConfig {
245+ internal_port: HEALTHCHECK_INTERNAL_PORT ,
246+ protocol: ServiceProtocol :: Tcp ,
247+ ports: vec![ PortConfig {
248+ port: HEALTHCHECK_EXTERNAL_PORT ,
249+ handlers: vec![ PortHandler :: Tls ] ,
250+ } ] ,
251+ } ,
252+ // expose webhook server as default https
253+ ServiceConfig {
254+ internal_port: WEBHOOK_INTERNAL_PORT ,
255+ protocol: ServiceProtocol :: Tcp ,
256+ ports: vec![ PortConfig {
257+ port: 443 ,
258+ handlers: vec![ PortHandler :: Tls ] ,
259+ } ] ,
260+ } ,
261+ ] ) ,
249262 } ,
250263 Some ( REGION ) ,
251264 )
@@ -311,7 +324,7 @@ impl Guest for Component {
311324
312325 for _ in 0 ..max_healthcheck_attempts {
313326 match http_get:: get_resp ( & format ! (
314- "https://{app_name}.fly.dev{DEPLOYED_HEALTHCHECK_PATH }"
327+ "https://{app_name}.fly.dev:{HEALTHCHECK_EXTERNAL_PORT }"
315328 ) ) {
316329 Ok ( http_get:: Response {
317330 status_code,
@@ -367,6 +380,8 @@ fn get_secret_keys(config: ObeliskConfig) -> HashSet<String> {
367380// FIXME: Insecure, use proper TOML serializer.
368381fn serialize_obelisk_toml ( config : & ObeliskConfig ) -> String {
369382 const WEBHOOK_SERVER_NAME : & str = "webhook_server" ;
383+ const HEALTHCHECK_SERVER_NAME : & str = "healthcheck_server" ;
384+
370385 let mut toml_string = format ! (
371386 r#"
372387sqlite.directory = "{VOLUME_MOUNT_PATH}/obelisk-sqlite"
@@ -385,15 +400,19 @@ sqlite.pragma = {{ "cache_size" = "3000" }}
385400enabled = true
386401level = "WARN,obelisk=info"
387402
403+ [[http_server]]
404+ name = "{HEALTHCHECK_SERVER_NAME}"
405+ listening_addr = "0.0.0.0:{HEALTHCHECK_INTERNAL_PORT}"
406+
388407[[webhook_endpoint]]
389408name = "webhook_healthcheck"
390409location.oci = "docker.io/getobelisk/components_flyio_webhook_healthcheck:2025-10-01@sha256:6fbc11b80b441ae6e642327b1ec0ceba85b2868d85dbce2d99d0d7b14a525c8c"
391- http_server = "{WEBHOOK_SERVER_NAME }"
392- routes = ["{DEPLOYED_HEALTHCHECK_PATH} "]
410+ http_server = "{HEALTHCHECK_SERVER_NAME }"
411+ routes = [""]
393412
394413[[http_server]]
395414name = "{WEBHOOK_SERVER_NAME}"
396- listening_addr = "0.0.0.0:{WEBHOOK_PORT }"
415+ listening_addr = "0.0.0.0:{WEBHOOK_INTERNAL_PORT }"
397416
398417"#
399418 ) ;
0 commit comments