Dev Environment Setup Instructions

Dev Environment Setup Instructions

How to run OpenELIS Global from source for development. Everything runs through scripts/dev-stack in the main repository. The repository's README and docs/dev_setup.md are the source of truth when they change. For the big picture first, read OpenELIS Global Architecture and Technology Stack.

1. Prerequisites

Install these on your machine:

  • Git, Python 3, curl and gettext (envsubst).

  • Docker with Docker Compose (Docker Desktop on macOS and Windows).

  • Java 21 and Maven, to build the backend WAR.

  • Node.js only if you run browser tests or frontend tools on your machine. The frontend build itself runs inside Docker.

You do not need to install mkcert yourself: scripts/dev-stack up installs it when it is missing, to give you trusted local HTTPS.

2. Get the code

git clone https://github.com/DIGI-UW/OpenELIS-Global-2.git cd OpenELIS-Global-2 bash scripts/setup-workspace.sh # once per clone: initializes the submodules

Run every scripts/dev-stack command from the root of this repository. Each clone gets its own containers, ports and data, so you can run several checkouts side by side.

3. Start the stack

scripts/dev-stack up # full stack (the default) scripts/dev-stack up --setup light # database, webapp, frontend and proxy only scripts/dev-stack url # print the address to open

Setup

What runs

Use it for

Setup

What runs

Use it for

--setup full (default)

Database, webapp, frontend, proxy, FHIR server, Analyzer Bridge and analyzer simulator.

Work on integrations, analyzers, referrals, EQA exchange or anything that uses FHIR.

--setup light

Database, webapp, frontend and proxy.

Every lab workflow: patients, orders, results, validation, reports, storage, administration. Uses less memory. Switching setups keeps the same database.

up builds the backend WAR from your checkout (mvn clean package) and runs it, with the frontend source, in the published development images (tag develop). It pulls the latest images on the first up in each terminal and whenever an image is missing; later runs in the same terminal reuse the local images and print their build date. On the first start on a machine it asks once for your administrator password, to trust the local development certificate; run it in an interactive terminal.

Open the address that scripts/dev-stack url prints and log in as admin with the password adminADMIN!. The legacy screens are at the same address followed by /api/OpenELIS-Global/.

4. Everyday work

You changed

Do this

You changed

Do this

Frontend code (frontend/src)

Nothing: the page reloads in the browser.

Backend code, Liquibase or properties

Run scripts/dev-stack up again.

Frontend dependencies, a Dockerfile, vite.config.ts, or the Analyzer Bridge or mock source

Run scripts/dev-stack up --build to build the images from your checkout instead of pulling them.

Nothing, you just want to restart quickly

Run scripts/dev-stack up --skip-build to reuse the last WAR and images.

Nothing, but you want the newest published images now

Run scripts/dev-stack up --pull.

scripts/dev-stack status # containers and addresses scripts/dev-stack logs -f oe.openelis.org # follow the webapp log eval "$(scripts/dev-stack env)" # export the stack's addresses into your shell scripts/dev-stack down # stop, keep the data scripts/dev-stack down --volumes --yes # stop and delete this checkout's data

5. Options and settings

Options of up:

Option

What it does

Option

What it does

--setup full / --setup light

Which services start (see section 3).

--module <folder>

Builds a module from its source folder and deploys it into the stack. Repeat for several modules (section 6).

--build

Builds the container images from this checkout instead of pulling the published ones.

--skip-build

Builds and pulls nothing; reuses the last WAR and images.

--pull

Pulls the latest published images now, even when this terminal already pulled them. Cannot be combined with --build or --skip-build.

--no-wait

Returns without waiting for the login page.

--no-scenarios

Does not create the analyzer test scenarios.

Settings go in front of the command for one run, or as lines in the .env file at the root of the repository to keep them:

Setting

Default

What it does

Setting

Default

What it does

DEV_STACK_IMAGE_TAG

develop

Tag of the published development images, for example a release such as 3.4.0.

DEV_STACK_TLS

local-ca

local-ca (trusted local certificates), self-signed (no mkcert; the browser warns) or letsencrypt (a public domain).

DEV_STACK_HTTPS_PORT / DEV_STACK_HTTP_PORT

a free port

Set 443 and 80 to open the stack at https://localhost (only one stack at a time can use them).

LETSENCRYPT_DOMAIN

localhost

Domain the stack answers on, for a development server reachable from outside.

6. Work on a module

Modules are developed in their own repository. Run the stack from the core checkout and pass the module's folder:

cd OpenELIS-Global-2 scripts/dev-stack up --setup light --module ../openelis-module-specimen-followup

Each run builds the module JAR, deploys it and restarts the webapp. The module's pages run from its own Vite dev server, so page edits reload in the browser. After a Java, Liquibase or manifest change, run the same command again. Start from the example module openelis-module-specimen-followup; the full guide is docs/modules.md.

7. Run the tests

Tests

Command

Tests

Command

Backend unit and integration tests (JUnit, Testcontainers)

mvn test or one class: mvn test -Dtest=MyServiceTest

Frontend unit tests (Vitest)

cd frontend && npx vitest run <path>

End-to-end tests (Playwright) against your stack

scripts/dev-stack playwright <spec> or cd frontend && npm run pw:test -- --project=core-app <spec>

Everything CI runs, on a committed change

scripts/run-ci-checks.sh

Skip tests in a Maven build with both flags: mvn clean install -DskipTests -Dmaven.test.skip=true. Format before every commit: mvn spotless:apply and cd frontend && npm run format.

8. Build without the stack

To produce the artifacts only:

scripts/run-java21 mvn -f dataexport/pom.xml install -DskipTests -Dmaven.test.skip=true scripts/run-java21 mvn package -DskipTests -Dmaven.test.skip=true # target/OpenELIS-Global.war cd frontend && npm ci --legacy-peer-deps && npm run build # frontend/dist

Running these outside Docker is not a supported development setup: the stack above provides the database, FHIR server, certificates and properties the application needs.

9. Troubleshooting

Problem

What to do

Problem

What to do

Something is missing or misconfigured

Run scripts/dev-stack doctor: it checks the prerequisites without starting anything.

The browser shows a certificate warning

Open the address that scripts/dev-stack url prints. Restart a browser that was already open before the first start. With DEV_STACK_TLS=self-signed the warning is expected.

A backend build fails

Read the first compiler or dependency error in the output. Do not prune all Docker or Maven caches as a fix.

You need a clean database

scripts/dev-stack down --volumes --yes, then scripts/dev-stack up.

Questions: open an issue on GitHub or ask on the community channels listed under Get Help.