I'm using Portainer to watch my Docker compose stacks and restart them with new image versions when the corresponding docker-compose.yml changes. My docker-compose.yml is inside a Github repo and portainer watches this file for changes (checkes every 5 minutes). I run portainer inside a docker container as well. This works fine.
Here is the challenge: When I restart portainer, the other stacks keep running (which is good). But the restarted portainer forgets that these stacks are managed by him. So he looses the connection to the Github repo and does not watch for changes anymore.
Plus I have to configure this through the web ui manually. I would much rather configure this in some sort of config file. I don't care if I configure this directly in portainer's own docker-compose.yml or I mount a config file into the container. Or even some CLI calls to set this up. The goal is to configure portainer completely as code. This way my whole setup is infrastructre as code (because the stacks that portainer manage are already docker-compose.yml files).
Anyone got an idea how I can configure portainer through config files?