New dev environment

A quick announcement, we recently moved to a new environment for dev!

For brief background, we note three environments for where Wikijump can be deployed, local, which is any developer-run instance run off that computer, dev, which is like a staging environment, and prod, which will be the real production environment where actual data and users exist.

Before this change, we provisionally deployed our dev environment in a permanent virtual machine with Dokku installed on it. Then, on merge to develop, a GitHub action would push the code and a new Dokku build would run.

This worked, but had some limitations. For one, Dokku is per-machine, which means that it is definitely not a candidate for production, since we cannot automatically scale up / down worker machines — it’s a violation of the “cattle, not pets” practice. Any changes to the system were made via Dokku commands on that one host machine, which made it a pet since you couldn’t recreate everything from code.

The other limitation with Dokku is that it only permits one build at a time. This seems normal, but if you attempt to start a new build while another is running, then the second build will fail. This was causing builds on develop to fail even if nothing was wrong with it, if a PR was merged too close in time to another one. Timing merges like this should not be something developers have to worry themselves with.

So, what we’ve done is switch to DigitalOcean App Platform. This is a managed app service like several others available, but since I was already using DigitalOcean I decided to start with this one.

The code changes were not too significant, it was primarily adapting the Dockerfiles for the new environment. The primary issue was figuring out precisely how to get the system to accept the YAML configurations so that the secrets were provided, database was available, and the like. For instance, I initially tried using the “dev” database system but switched to the “prod” managed database system (at the cost of additional money).

Now that it is all set up, it automatically takes any changes which land on develop (cancelling any prior builds if there were any) and deploys it. It handles TLS certificates and DNS for us, provided you add the domains in the configuration.

You can see it deployed here: https://wikijump.dev (though it doesn’t look different from before, it just has a different backend).

The current canonical (i.e. DigitalOcean-assigned) domain is https://wikijump-qdpi9.ondigitalocean.app, though this is not necessarily permanent.

I have also added a custom domain to demonstrate the site/domain detection functionality: https://scpwiki.dev.

Author: aismallard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.