hercules-ci / arion

Run docker-compose with help from Nix/NixOS
Apache License 2.0
622 stars 48 forks source link

Updating/pulling containers on NixOS module deployment. #210

Open tsk547 opened 1 year ago

tsk547 commented 1 year ago

I've recently migrated my home server to NixOS and decided to use arion for my container management because it made it easy to convert my docker-compose files into something I could use declaratively in my configuration.nix. I'm using arion as a NixOS. I have a file for each container (or multiple containers if I need a database container for that service), that get imported into virtualisation.arion.projects.

What would the proper way be to update/pull those containers? I can't use the arion command because it expects an arion-pkgs.nix and arion-compose.nix, which I'm not using. Is it best to just pull the containers individually with docker pull and then restart the arion-.service?

Also, is there a way to have arion just pull the containers when the service starts/restarts? That would actually be ideal for me.

roberth commented 1 year ago

I don't really use it that way, but I guess it would be nice to have an option that does such things. Here's where the NixOS service performs arion up. We could add to that.

https://github.com/hercules-ci/arion/blob/51ed7054c1c42cd7bb4bf98190554c3482b81128/nixos-module.nix#L42

tsk547 commented 1 year ago

What about maybe implementing pull_policy as an arion option? https://github.com/compose-spec/compose-spec/blob/master/spec.md#pull_policy

It's a feature already built into docker-compose and it would let you define it on a container by container bases.

Noodlez1232 commented 5 months ago

I want to implement this, but I have a bit of a question. I'm not sure if I can just simply plop the option here and if it'll just simply get propagated through to the docker-compose file