PokeAPI/ditto

Where to host the ditto updater bot

tdmalone opened this issue · 9 comments

From PokeAPI/pokeapi#353:

@sargunv:

IIRC there's also a DigitalOcean account being used to host the API right now
...
I do plan on finding somewhere to host the ditto updater bot, so that's probably something worth transferring if you don't want to depend on something only I control. It should run fine on their smallest container (I plan on testing that today).

I have a couple of questions @sargunv:

  • In terms of simplifying PokeAPI's infrastructure, can the updater bot be run in CI at all? (I haven't had a good look at how it works yet)
  • If not, so that we don't need to manage/maintain/keep track of any servers, would it be something that could run on a PaaS (which is kinda almost 'serverless' 😛) such as Heroku?

It can run anywhere that can run a Docker container in privileged mode. Ideally the platform would be able to schedule the run somehow, or otherwise run based on certain conditions such as a webhook.

The reason I ask about CI is because the webhook is basically just a push to GitHub, right? Which would mean it's a perfect candidate for a CI job.

But a privileged container... hmm. Travis won't run privileged Docker containers; I'm not sure if Circle does.

It needs to be privileged because it launches PokeAPI and its dependencies in an inner container. It should be possible to set up the whole system without inner containers, but I'd prefer not to work on doing that. It would involve setting up an environment with two different Python projects: one python2, one python3, and postgres. I'm fine just running it on my own server or on a $5/month DigitalOcean droplet. If DigitalOcean will still sponsor us, that's even better.

It also needs write access to the repo, which I currently accomplish by mounting a suitable .ssh folder as a volume at /root/.ssh in the container at runtime. GitHub access tokens may work too.

CircleCI can run privileged containers if the CI job runs on a VM instead of a container: https://circleci.com/docs/2.0/executor-types/#overview.

If it's possible, my vote is for a CI system as well, because:

  1. Other contributors can make changes to it
  2. Increases the bus factor if say you go on vacation

@Naramsim As for bus factor, I've included a readme in the updater folder showing exactly how to run it. It's really nothing more than ensuring the bot have the right access to the repo and then running a privileged container.

I'll check out CircleCI. Looks like they offer 1500 build minutes for free, which is enough for a daily build if it's not drastically slower than on my machine. Clone does take a while since it's pulling every single object once.

The bot now runs on CircleCI.

Although we should move it from here to a separate repo or to pokeapi, imho.