dproofreaders icon indicating copy to clipboard operation
dproofreaders copied to clipboard

Enable a better local dev experience with vargrant and/or docker/rancher

Open cpeel opened this issue 1 year ago • 2 comments

Doing local development on the DProofreaders codebase is hard. The only prescribed method right now is the development VM which is big and bulky and requires VirtualBox or VMWorkstation / Fusion (the last two are now free for personal use, though).

It would be easier if we could use vagrant or docker containers (via Docker Desktop (paid) or Rancher Desktop (free)). With the addition of the new "JSON" forum backend type (see https://github.com/DistributedProofreaders/dproofreaders/pull/953) we no longer need phpBB for the vast majority of feature development too. That means that our bear minimum set of requirements are MySQL and PHP because technically PHP has a built-in web browser (php -S) so we don't even need Apache. This is used in the smoke tests so it works to some degree.

One of the challenges is going to be bootstrapping data into MySQL. The smoketests use a test_tables.sql file which loads some data and a users.json for the forums. A starting point might be to flesh those out to look more like the data in the developer VM and use those both for smoke tests and for local dev. Ideally we'd have some way of programmatically creating some of this without a DB dump but that shouldn't block this effort.

This ticket is a bit open-ended but success would be an initial way of doing development locally without needing the VM.

cpeel avatar Jun 28 '24 20:06 cpeel

As a datapoint, I would lean towards a container-based approach where a docker-compose.yml would bring up a MySQL and PHP/Apache container with local volume mounts pointing to the code and configs and to persist the database. This will still require us figuring out how to install & use composer although there is a docker container for that too.

cpeel avatar Jun 28 '24 20:06 cpeel

I started a branch here a while ago: https://github.com/chrismiceli/dproofreaders/tree/docker with this being the important commit: https://github.com/chrismiceli/dproofreaders/commit/e932b86dde7794fa2c2b0ff8beea9b81063cdad1 but I didn't get the database populated sufficiently.

I found someone else had a docker repo that used curl to initialize the DB you can see here: https://github.com/fhs/dproofreaders-docker particularly in this script https://github.com/fhs/dproofreaders-docker/blob/master/app/bin/create-admin.bash

I think we' could use the unit test script or API to populate the database more reliably.

chrismiceli avatar Jun 28 '24 21:06 chrismiceli

It would be easier if we could use vagrant or docker containers (via Docker Desktop (paid) or Rancher Desktop (free)).

The Docker paid license is only necessary for commercial activity (and even then there's a carve-out for small companies). For our purposes it's free.

https://docs.docker.com/subscription/desktop-license/

Docker Desktop is free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open source projects.

tangledhelix avatar May 18 '25 20:05 tangledhelix