Is it possible to change the channel that a running supervisor monitors?


#1

I currently have an issue open in GitHub (https://github.com/habitat-sh/habitat/issues/5802) because the hab pkg export docker -c <channel_name> does not change the channel from stable even if it has been set.

As a workaround is there a hab command I can use to update the supervisor to a different channel in my Docker image. For example:

docker exec -it mypkg hab sup update channel dev

Thanks


#2

I don’t have enough familiarity with docker to be 100% certain of this answer, but based on the init script the docker exporter uses, it appears you can pass arguments that will be passed through to hab sup run. In that case, you should just be able to use --channel <CHANNEL>, but since the hab sup run part is already baked in:

  -*) exec {{sup_bin}} run {{primary_svc_ident}} "$@";;

I believe the command would be:

docker exec -it exported-docker-image --channel dev

#3

The channel flag on the exporter does not (and probably should not) do what you’re asking of it, since that would be baking environment assumptions into the image itself. That flag is instead used to determine which channel to install your package (+dependencies?) from. Setting the channel for update watching is something that can and should be handled in your deployment of the image, exactly as @baumanj suggested or by setting the HAB_BLDR_CHANNEL environment variable.


#4

@HT154 Thanks very much for your answer, this is exactly what I was after.

@baumanj Thank you for your input as well, it got me thinking about how I can change the image after I have deployed it. @HT154 suggestion of the HAB_BLDR_CHANNEL makes things a little easier as I can put it into the Kubernetes manifest file.

I raised the issue on GitHub because I was not 100% sure what the channel option did, as I mentioned when I opened the post. I will close down the issue.

Thanks again.