Page MenuHomePhabricator

Provision a hot-reload local development environment in k8s for kartotherian
Open, Needs TriagePublic

Description

There's currently no best practice for how to set up such an environment. Play with the kartotherian chart's values-devel.yaml and see what can be done.

Investigate alternative hot reload implementations:

(1) [ ] Set up IDE to rebuild chart and redeploy in a convenient way. Trigger rebuild on file change or hotkey.

  • Has the advantage of matching production more closely.
  • Need to stabilize the services' external port number, or rewire each time in MediaWiki local settings.
  • Script to kubectl un/install
  • Requires publishing the built image to a local or a private docker registry.
    • To set up a local registry:
      • minikube addons enable registry
      • Forward registry from minikube to docker with:
      • docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"
  • Wrap rebuild in fswatch
  • VSCode "kubernetes" extension can find pods and helm releases
  • Port to IDEA environment
  • Status: Verified each step, now they should be documented and if possible, packaged.

(2) [ ] "nodemon" entrypoint within the container and mount source directory from host

  • Requires the developer to mount source dir thus:
  • minikube mount /home/.../kartotherian:/srv/kartotherian
  • The existing dev environment does this: nodemon --ext js,json,yaml --signal SIGHUP server.js -c config.docker.yaml
  • Status: Almost got this working, except hot refresh is still elusive. Maybe "notify" is unavailable.

We'll also want a way to import a bit of sample map data into postgis, but that can be a follow-up task.

Event Timeline

Change 865653 had a related patch set uploaded (by Awight; author: Awight):

[operations/deployment-charts@master] [WIP] Pull devel image from a local registry

https://gerrit.wikimedia.org/r/865653

Change 865655 had a related patch set uploaded (by Awight; author: Awight):

[operations/deployment-charts@master] [WIP] mount the local source directory

https://gerrit.wikimedia.org/r/865655

Change 865656 had a related patch set uploaded (by Awight; author: Awight):

[operations/deployment-charts@master] [WIP] Install node_modules inside of container

https://gerrit.wikimedia.org/r/865656

awight renamed this task from Provision a hot-refresh local development environment in k8s for kartotherian to Provision a hot-reload local development environment in k8s for kartotherian.Dec 7 2022, 2:27 PM
awight updated the task description. (Show Details)

Mostly, it would be helpful to get conceptual feedback. I'm not aware of any Wikimedia standards, or even emerging industry standards, for how to develop an image in an ergonomic way. Do either of the alternatives proposed in the task description seem reasonable? Should we discourage this and continue using the kartodock repo which is easier to tune for local development?