Pull new container images
vk496 opened this issue · 3 comments
Hello and thank you for your amazing project!
I have TrueNas with a custom app (container tag latest). Everything works fine, but I miss the ability to autoupdate that app the same way is done with TrueNas/Truecharts apps.
It's possible? There is some manual way of doing it?
I could create a PR for that feature if I know more details about how to do it.
BR,
Valentin
Thank You!
Custom Apps do Receive Updates
- There is no version change, since the helm chart for the app, nor the custom-app app version (which is NOT the prowlarr version) have an update.
- I am not 100% sure when these are pulled, it has to do with something outside of the control of HeavyScript
- It does not always work. (See below)
You May Need to Enable it
You can enable image updates in the application settings
If None Of That Works
Occasionally I have ran into apps that, for whatever reason do not show that there is an update available, even days after the update has been released on the repository the container is from. A work-around is:
- Change
Container Pullpolicy
to always
- Schedule a cron job to restart the container with HeavyScript occasionally. I.E. Once a week or so, ensuring at least once a week the new container is grabbed.
bash /path/to/heavyscript/heavy_script.sh app --restart APPNAME
Thank you!
For first case, I think its a chart update, which triggers the update. Because Ive never saw a popup like that before, only app versions. (also, could be this: helm/helm#5696 (comment))
For the second one, I didn't realize that I have that enabled. So its sure thats its not working or buggy. Thats why I opened here a issue :)
3rd case, that works more or less. But for my case, I cant interrupt the service except if is for updating, so I came out with this script that I trigger every 10min (works with private repos too :) ) that I would like to share
#!/bin/bash
# Copyright Valentin @vk496
# For https://github.com/Heavybullets8/heavy_script/issues/155
set -e
image_name="registry.gitlab.com/test_org/test"
image_tag="latest"
image_namespace="ix-test"
image_app="test"
# username[:password]
repo_auth="gitlab+deploy-token-1234:gldt-abc-def-hij"
if [[ $repo_auth != "" ]]; then
ctr_auth="-u $repo_auth"
fi
k3s ctr image pull $ctr_auth $image_name:$image_tag
image_sha_latest=$image_name@$(k3s ctr image ls | grep $image_name:$image_tag | awk '{print $3}')
echo $image_sha_latest
image_sha_current=$(k3s kubectl -n $image_namespace get pod --field-selector=status.phase==Running -o jsonpath="{..imageID}")
# k3s kubectl rollout restart deployment sacacitas
if [[ $image_sha_current ]] && [[ $image_sha_latest != image_sha_current ]]; then
echo Need updade!
# /usr/local/bin/heavyscript app -r $image_app
k3s kubectl -n $image_namespace rollout restart deployment -l app.kubernetes.io/instance=$image_app
else
echo Last version running
fi
PS: I think this could be a very elegant way to do it
midclt call chart.release.get_instance "$app_name" | jq
have
...
"update_available": false,
"human_version": "registry.gitlab.com/test_org/test:latest_2403.0.0",
"human_latest_version": "registry.gitlab.com/test_org/sacacitas:latest_2403.0.0",
"container_images_update_available": false,
I think manipulating update_available
or container_images_update_available
with PullAlways
Pullpolicy, would work pretty smooth with heavyscript cronjobs