DistributedProofreaders / dproofreaders

Distributed Proofreaders is a web application intended to ease the process of converting public domain books into e-texts.
https://www.pgdp.net
GNU General Public License v2.0
46 stars 28 forks source link

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

Open cpeel opened 2 months ago

cpeel commented 2 months ago

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 commented 2 months ago

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.

chrismiceli commented 2 months ago

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.