Digital Marketplace Runner (‘dmrunner’)

Running the Digital Marketplace code locally involves running 4 backing services (nginx, OpenSearch, Redis and Postgres), 2 APIs (data and search), and 4 frontend apps (admin, buyer, supplier, user). It has a further set of mostly decentralised/loosely documented dependencies such as Node, NPM, AWS CLI, etc. This can make it a fairly laborious and inconsistent task for a new developer to quickly know what to install and how to get up and running.

The dmrunner was developed during a firebreak to try to make it easier to get new developers up and running, sanity-check certain dependencies, and make it simpler to start and maintain the full suite of Digital Marketplace code.

Repository

The code for the runner is at: https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-runner

See the readme for setup and usage instructions.

Debugging

The dmrunner supports dropping into pdb (but not ipdb) shells. Edit your code and insert import pdb; pdb.set_trace() and wait for the app to be reloaded, then trigger the relevant code (e.g. by visiting the appropriate page in your browser) and wait for dmrunner to attach you to the process. While an app has a PDB shell active, you will no longer be in dmrunner command mode and your input will instead go directly to the debugger. Use normal pdb commands as you will; when the debugging session terminates (either by quitting out, or by changing the code in the app and triggering a reload) you should drop back to dmrunner’s command mode.

Possible improvements

It should be possible to integrate nix so that all of the apps use the default.nix files to run. This would remove the requirement for a number of dependencies to be installed globally on the host system (e.g. Postgres, …) and should provide a more reproducible and generally-simpler setup. The end goal would be that users only need to clone the dmrunner repo, install Nix, Docker for Mac, and they’d be good to go.

The code could use some refactoring. As mentioned above this was developed in a firebreak and initially intended to be a personal utility. As more people come to rely on the code refactoring would become useful. DMRunner, in its current incarnation, is likely to require exponentially more support as more users rely on it. This means that the value in refactoring to make the code easier to understand grows at a similar rate.