(Draft) RFC: Develop Github Bot that would help reviewing PRs

Me and @Zaveryukha have an idea to develop a bot (possibly during the next sprint) that would help with reviewing PRs by deploying a particular PR somewhere (similar to Magento bot).

In comments to some pull-request you mention this bot, and it would deploy this particular PR somewhere to the cloud and provide you with a public link. After some time this link will be destroyed.
We could also deploy current release to serve as a demo site.

I believe that should help with review process a lot and help people who are actually not deep into coding to test the PRs by clicking through. But would speed it up as well for normal developers.

Technical details

Here’s my idea how to build an MVP for this, spending the least amount of time and money possible.
And yes, I’m a complete n00b at this stuff, so feedback is welcome.

We can use ProBot to build Github bots.
This bot would listen to comments mentioning it on PRs e.g. `

@neos-bot give me test instance

Then this bot would build a Docker image and deploy it to our Kubernetes cloud. When deployment finishes it should post a comment in that pull request with a link to newly deployed instance.

We can use Digital Ocean Kubernetes setup for hosting. It’s super easy to setup and for 10$/month we could manage to run a bunch of docker containers simultaneously.

ProBot bot is a nodejs app that can run in a container on the same K8s cluster. It should listen on some public port for an http request from github.
It can build Docker images and control K8s by issuing appropriate shell commands (or should we use K8s REST api? Would it be able to reach it from inside the pod?).

We can have a single shared database container to save some resources, though ofc that would require a bit more complicated setup to clean up old databases etc.

3 Likes

Hey Dmitri,

nice initiative :smiley:

please don’t use shell commands, you can easily reach K8S REST API from within the container: https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#accessing-the-api-from-a-pod

All the best,
Sebastian

1 Like

Hey @dimaip,

small addendum, the Pricing page on DO says “Kubernetes cluster can be deployed for as little as $30 per month.”. It’s not a no-go, just wanted to sync us here :slight_smile:

Alternatively, it might be an option to just use a Cloud Provider’s API to spin up completely new machines; without any kubernetes etc – as our staging instances won’t live forever. We could use https://www.hetzner.de/cloud - which is 1/4th the cost of DigitalOcean. It might be less reliable; but for staging instances it should be perfectly fine.

This might reduce the number of moving parts quite a bit; we could simply use Ansible + Rsync to deploy the code to an instance. WDYT?

All the best,
Sebastian

30$ is for the cluster of 3 nodes. It’s recommended for production usage, but I managed to get it to run on a cluster of 1 node just fine.

The advantage of K8s cluster is that there we can run a number of staging instances (as far as the RAM allows), and still pay only 10$.

I’ve also thought about some serverless solution that wouldn’t require an instance to be running all the time, but then I thought that it might be a good idea to keep at least one instance always running to serve as a demo site anyways.

Hey @dimaip,

if you want to go the Kubernetes route, something like https://github.com/deislabs/osiris might be useful :slight_smile:

All the best,
Sebastian

1 Like

This idea is really awesome. If you need help (I also never did something like that) than just ping me :slight_smile:

1 Like