@@ -51,7 +51,6 @@ const MINIO_PORT: u16 = 9000;
5151
5252const VM_NAME_FINAL : & str = "obelisk" ;
5353const VOLUME_MOUNT_PATH : & str = "/volume" ;
54- const FINAL_IMAGE : & str = "getobelisk/obelisk:0.25.4-ubuntu-litestream" ;
5554const OBELISK_TOML_PATH : & str = formatcp ! ( "{VOLUME_MOUNT_PATH}/obelisk.toml" ) ;
5655const OBELISK_BIN_PATH : & str = "/obelisk/obelisk" ;
5756const LITESTREAM_CONFIG_PATH : & str = formatcp ! ( "{VOLUME_MOUNT_PATH}/litestream.yml" ) ;
@@ -64,6 +63,10 @@ const HEALTHCHECK_EXTERNAL_PORT: u16 = 444;
6463const SLEEP_BETWEEN_RETRIES : Duration = Duration :: from_secs ( 10 ) ;
6564const SLEEP_AFTER_TEMP_VM_SHUTDOWN : Duration = Duration :: from_secs ( 5 ) ;
6665
66+ fn obelisk_image ( obelisk_version : & str ) -> String {
67+ format ! ( "getobelisk/obelisk:{obelisk_version}-ubuntu-litestream" )
68+ }
69+
6770fn allocate_ip ( app_name : & str ) -> Result < ( ) , AppInitModifyError > {
6871 activity_fly_http:: ips:: allocate_unsafe (
6972 app_name,
@@ -108,6 +111,7 @@ fn wait_until_started(app_name: &str, machine_id: &str) -> Result<(), AppInitMod
108111// If minio is enabled, configure litestream.yml
109112fn setup_volume (
110113 app_name : & str ,
114+ obelisk_version : & str ,
111115 obelisk_toml : & str ,
112116 minio_machine_id : Option < & str > ,
113117) -> Result < ( ) , AppInitModifyError > {
@@ -128,7 +132,7 @@ fn setup_volume(
128132 app_name,
129133 VM_NAME_TEMP ,
130134 & MachineConfig {
131- image : FINAL_IMAGE . to_string ( ) ,
135+ image : obelisk_image ( obelisk_version ) ,
132136 guest : Some ( GuestConfig {
133137 cpu_kind : Some ( CpuKind :: Shared ) ,
134138 cpus : Some ( 1 ) ,
@@ -326,7 +330,11 @@ fn minio_configure(app_name: &str, machine_id: &str) -> Result<(), AppInitModify
326330 Ok ( ( ) )
327331}
328332
329- fn start_final_vm ( app_name : & str , litestream : bool ) -> Result < ( ) , AppInitModifyError > {
333+ fn start_final_vm (
334+ app_name : & str ,
335+ obelisk_version : & str ,
336+ litestream : bool ,
337+ ) -> Result < ( ) , AppInitModifyError > {
330338 let entrypoint = if litestream {
331339 Some ( vec ! [ "/usr/bin/litestream" . to_string( ) ] )
332340 } else {
@@ -350,7 +358,7 @@ fn start_final_vm(app_name: &str, litestream: bool) -> Result<(), AppInitModifyE
350358 app_name,
351359 VM_NAME_FINAL ,
352360 & MachineConfig {
353- image : FINAL_IMAGE . to_string ( ) ,
361+ image : obelisk_image ( obelisk_version ) ,
354362 guest : Some ( GuestConfig {
355363 cpu_kind : Some ( CpuKind :: Shared ) ,
356364 cpus : Some ( 1 ) ,
@@ -487,6 +495,7 @@ impl Guest for Component {
487495 fn prepare (
488496 org_slug : String ,
489497 app_name : String ,
498+ obelisk_version : String ,
490499 config : ObeliskConfig ,
491500 minio : bool ,
492501 ) -> Result < ( ) , AppInitModifyError > {
@@ -503,7 +512,12 @@ impl Guest for Component {
503512 } else {
504513 None
505514 } ;
506- setup_volume ( & app_name, & obelisk_toml, minio_machine_id. as_deref ( ) ) ?;
515+ setup_volume (
516+ & app_name,
517+ & obelisk_version,
518+ & obelisk_toml,
519+ minio_machine_id. as_deref ( ) ,
520+ ) ?;
507521 Ok ( ( ) )
508522 }
509523
@@ -517,8 +531,12 @@ impl Guest for Component {
517531 Ok ( ( ) )
518532 }
519533
520- fn start_final_vm ( app_name : String , litestream : bool ) -> Result < ( ) , AppInitModifyError > {
521- start_final_vm ( & app_name, litestream)
534+ fn start_final_vm (
535+ app_name : String ,
536+ obelisk_version : String ,
537+ litestream : bool ,
538+ ) -> Result < ( ) , AppInitModifyError > {
539+ start_final_vm ( & app_name, & obelisk_version, litestream)
522540 }
523541
524542 fn wait_for_health_check (
@@ -532,6 +550,7 @@ impl Guest for Component {
532550 fn app_init (
533551 org_slug : String ,
534552 app_name : String ,
553+ obelisk_version : String ,
535554 config : ObeliskConfig ,
536555 secrets_deadline_secs : u16 ,
537556 health_check_deadline_secs : u16 ,
@@ -540,13 +559,13 @@ impl Guest for Component {
540559 ) -> Result < ( ) , AppInitError > {
541560 // Launch sub-workflows by using import.
542561 // In case of any error including a trap (panic), delete the whole app.
543- workflow_import:: prepare ( & org_slug, & app_name, & config, minio)
562+ workflow_import:: prepare ( & org_slug, & app_name, & obelisk_version , & config, minio)
544563 . map_err ( |err| cleanup ( & app_name, err, skip_cleanup_on_error) ) ?;
545564
546565 workflow_import:: wait_for_secrets ( & app_name, & config, secrets_deadline_secs)
547566 . map_err ( |err| cleanup ( & app_name, err, skip_cleanup_on_error) ) ?;
548567
549- workflow_import:: start_final_vm ( & app_name, minio)
568+ workflow_import:: start_final_vm ( & app_name, & obelisk_version , minio)
550569 . map_err ( |err| cleanup ( & app_name, err, skip_cleanup_on_error) ) ?;
551570
552571 workflow_import:: wait_for_health_check ( & app_name, health_check_deadline_secs)
0 commit comments