Repository navigation
Show and Tell: config file through git sync #1099
janitor-of-code
started this conversation in
Show and tell
Replies: 1 comment
|
Hello @janitor-of-code, |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Howdy!
I've set up homer in a rather specific way and thought to share that compose file as it might be interesting to some of yall.
The constraints I was working from are that we want all of our stacks as a single compose file each with everything that might change from instance to instance (such as URL, passwords, mail host) in a separate env file.
That way we can serve a bunch of instances through portainer and gitops with the same exact file and any updates and changes that must be made are delivered to any and all instances the same.
The first constraint was easy enough with compose configs:
Which we ran for over a year until I tackled the second constraint with a git-sync container bolted on:
# .env file TRAEFIK_HOST= GITSYNC_REPO= GITSYNC_PASSWORD= GIT_REPO_NAME=All it does is watching a repo containing the configuration file called
homer.yamland poll it every 3 hours.One issue was that git expects an empty folder to clone in while homer has a bunch of files in the folder that
config.ymlresides in.I worked around that by not syncing directly into said folder but adding yet another container that is just a bash shell creating a symbolic link between the file from git and the config file homer expects.
This container runs every restart once, however that shouldn't hurt anything.
This would be prettier if one could use a custom configuration path - #846 - but works just fine.
Other tidbits are that git-sync expects a username even if it is served a token. But since most server don't care about usernames I just added some nonsense as default.
And yes I now got 2+ distinct repos. 1 containing generic compose files with heavy use of variable extrapolation as the one above and 1 for each homer instance containing its config file.
The first is polled by portainer while the second are polled by that git-sync container.
Makes sense for my use cases.
All reactions