Getting Gogs/Github to auto-deploy to Dokku/Heroku on commit

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.

  • How do I push my git repository to dokku?
  • How to set the root application directory?
  • Error when deploying with git (dokku) - timeout / broken pipe
  • How to deploy dokku app with secret yaml configuration file without committing the file?
  • dokku asking for password
  • Git and gitignore and dokku
  • 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)

  • GET data from GitHub is Possible, GET data from dribbble doesn't work
  • fatal: cannot create directory at /root/wp-content/cache/page_enhanced/… No such a file or directory
  • Git version in Visual Studio 2013?
  • Unable to Git-add with force
  • What's the best way to look up why/when changes were made in a git?
  • Revert git repo to previous commit
  • Git Baby is a git and github fan, let's start git clone.