-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contrib: add git-sync container #3099
Conversation
Why is this more useful than a shell script written around git? Does this provide any semblance of atomicity? what happens to things that are using the repo while it update? They can get one file from version A and another from version B. Please think about what you are trying to do with this - I don't think it has been thought through fully. |
@thockin, I had a shell script + cron before, but @brendanburns convinced me to turn it into a small go program. The added value is that you can ping it over HTTP to force a pull. For atomicity, maybe we could fetch over a bare repo and checkout into a subdirectory named after the hash, with a HEAD symlink that is updated atomically. |
I need this for a sample I'm working on, sent it as a PR because I thought it might be more generally useful. Happy to move it to the sample repo if you think it's not in its current form. |
Now we're talking. Apps can still get one file from version A and another On Mon, Dec 22, 2014 at 1:31 PM, Johan Euphrosine notifications@github.com
|
I think it is under-specced in its current form. On Mon, Dec 22, 2014 at 1:37 PM, Johan Euphrosine notifications@github.com
|
They could use http://golang.org/pkg/path/filepath/#EvalSymlinks to resolve to a stable location.
Check the creation timestamp on the HEAD symlink? |
Let's leave signaling to a later date. Plenty of webservers check file timestamps and invalidate caches when serving files, you could easily use this as-is with something like nginx. However, I think that the container you build should be completely parameterizable via environment variables. I don't care if you edit the go code to pick them up, or you add a startup script to do it. |
(and most people don't care about atomic update of their PHP files) |
We should cut corners where doing so saves us significant time. I don't On Mon, Dec 22, 2014 at 2:01 PM, Brendan Burns notifications@github.com
|
@brendanburns |
@thockin added the symlink and individual checkout logic. |
It does complicate serving the directory from nginx quite a bit, you'd have to override nginx conf to resolve symbolic link and set HEAD as the new root. I wonder if it would make sense to have 2 modes triggered by a flag:
|
What's our bar for contrib? Anyway, a good starting point would be matching our existing git volume functionality: I'd like to eliminate that from our API and just rely on a sidecar container instead. |
One key difference with the existing git volume functionality is that it refresh the git repo periodically. Would you rather start with a simpler approach that just populate the git repo on startup and address the question of atomic update (that @thockin raised and that I tried to address in the 2 last commits) later? |
If that would help get this in sooner, yes. :-) |
PTAL, simplified the logic a lot, no more sync loop. Just initially populate the volume at a given rev. |
Some notes about offline discussion with @bgrant0607 and @thockin. There is multiple ways we can approach periodic sync w/ this sidekick container:
Additionally there is multiple ways we can synchronise the side kick with the other containers in the same pod to make sure we don't serve partial data while the first sync is in progress:
I'm happy to file different issues for those ideas, but I think there is some value to discuss them in context first. |
PTAL, added demo for usage of the sidekick container, see the README |
Let me know if you'd prefer to have the two in separate PRs. |
Thanks! LGTM. We should merge to make it easier for people to play with. |
contrib: add git-sync container
git-sync is a command that periodically sync a git repository to a local directory.
It can be used to source a container volume with the content of a git repo.
Usage
In addition to the periodic pull, it will refresh sync the git repository if a HTTP request is made against
:8080/${GIT_SYNC_HANDLER}
.