Run artifact fetch and docker load, before bringing down previous allocation

Is it possible to download an artifact before shutting down the previous allocation? I hit a chicken and egg problem, I’d like to fetch my container images through my ingress job and then from Hydra. But I can’t make those two jobs fetch their images from themselves because when the artifact is being downloaded the services are already down and unreachable. Is there a way around this? Thanks!

Hi @MagicRB :wave:

I’m not sure if I follow your specific use case, so correct me if I’m wrong.

Are you looking to preload Docker images fetched from Hydra before the current allocations are shutdown?

If that’s the case, I think you would need to build something on top of Nomad to coordinate this flow. You could have a system job that monitors Hydra for new images and preloads them.

Then you will need to coordinate with Nomad when to stop and start the new allocations. Maybe you could use a Consul KV as a way to track the latest preloaded image?

Once your system job preloads the image it could write a key in Consul, then your job would have a template that cause the allocation to block until that key exists. Using canaries you can make sure old allocs are not destroyed until new ones are created.

Is this the type of solution you are looking for?

This sounds perfect, over complicated and fun, I’ll give it a try. Thanks! I’ll try to implement something like this but I’ll probably git a few blockers here and there.


Let us know how it goes :grinning_face_with_smiling_eyes: