-
Notifications
You must be signed in to change notification settings - Fork 46
Deployment
To deploy and maintain Workbench, get comfortable with the wonderful world of containers.
Our Google Cloud Build builder publishes images to gcr.io/workbenchdata-ci/IMAGE:SHA1, where IMAGE is:
-
frontend-- serves Web requests -
fetcher-- runs "fetch" steps (the first steps of tabs, which request data from elsewhere) -
renderer-- renders all steps (producing tables) -
tusd-hooks-- helps with file uploads -
cron-- schedules runs automated updates - The
cronimage also powerscron-expired-session-deleter-- deletes old workflows that weren't created by logged-in users - The
cronimage also powerscron-lesson-workflow-deleter-- deletes old workflows that were created for lessons (since changes to the underlying lessons can make a bad user experience) - The
cronimage also powerscron-delta-deleter-- deletes old Undo operations (limits database cruft and empowers us to gradually revamp Workbench's innards)
SHA1 is the revision of the Git commit.
You can build your own images: PROJECT_ID=workbenchdata-ci TAG=dev docker buildx bake -f docker-bake.hcl
Deploy with Kubernetes.
See cjworkbench-deploy for deployment scripts.
Every workbench "Step" is built on a "Module". For instance, "Filter for column A value is null" is a "Step", and "filter" is the "Module".
To refresh the generic list of modules, run cjworkbench-deploy/refresh-suggested-modules ENVIRONMENT.
Most debugging sessions start like this. It's a good introduction to every facet of our environment:
kubectl exec -it frontend-deployment-xxxxxxxx-xxxxx app -- /opt/venv/django/bin/python ./manage.py shell
-
kubectl exec -it: we use Kubernetes -
frontend-deployment-xxxxxxxx-xxxxx: whenIMAGE=frontend, the Kubernetes deployment is calledfrontend-deployment. -
app: all our pods have a "main" container calledapp. -
/opt/venv/django: our Django images all have an/opt/venv/djangoPython virtualenv. Images that also invoke module code (renderer,fetcherand -- for now --frontendandtusd-hooks) have another virtualenv,/opt/venv/cjwkernel, which powers module code. -
bin/python: Our Django images all use Python 3. -
./manage.py: Django's startup script. Each image has a slightly differentsettings.py -
shell: Django command for a Python prompt.dbshellis another handy command, for a PostgreSQL prompt.
kubectl logs frontend-deployment-xxxxxxxx-xxxxx --follow ... or use your cloud environment's tools.