I'm building the following setup for our team's app:
- A Heroku-like VM with Dokku running on it (and as a result git and Docker)
- I'm using another Docker container on the same machine to host the repo (via Gogs, but it really could be any github-clone)
- I want to use the Gogs repo as the main repo for the project and Dokku-spawned container as the deployed instance of the app
- I want this app to auto-redeploy as soon as code is pushed into the Gogs repo (basically I want a staging environment that's always in-sync with the master branch of our repository)
I'm trying to figure out how to set this up. Since the Gogs environment is a replica of GitHub and Dokku is a replica of Heroku, I added those 2 tags as well. Basically I'm trying to get GitHub to auto-deploy to Heroku on commit. I have access to webhooks and git hooks in Gogs.
Here are approaches I was considering, but I don't know how feasible each one is and which ones should be discarded in the interests of time/stability:
- Add a commit webhook to Gogs to trigger an API endpoint for some wrapper around another instance of git (which would effectively work as a wake-up ping), this wrapper would then pull the Gogs repo into its local repo and then push it to Dokku. (this seems a bit fragile to me)
- Write some sort of git hook into Gogs so that it pushes to Dokku directly. (this would be ideal, although I don't know if this is possible via Gogs' interface)
- have a periodic cron-job do the sync (I'm not a fan of this since I want to minimize the delay without adding overhead to the server, although a 30-second ping probably wouldn't be the end of the world)