Tamanu is an open-source patient-level electronic health records system for mobile and desktop.
The Meta service provides:
- a server discovery service for the Tamanu mobile app
- a server list and health check page
- a range of active versions
- download URLs to available artifacts for active versions
We have a container image for linux/amd64 and linux/arm64:
ghcr.io/beyondessential/tamanu-meta:5.7.4
- Install Rustup, which will install Rust and Cargo.
- Install just command runner
- Clone the repo via git:
$ git clone [email protected]:beyondessential/tamanu-meta-server.git- Install development dependencies:
$ just install-depsThis will install cargo-nextest, cargo-leptos, diesel CLI, cargo-release, git-cliff, and watchexec.
- Create a new blank postgres database.
- Optionally set the
DATABASE_URLenvironment variable (if your database isn't named the defaulttamanu_meta):
$ export DATABASE_URL=postgres://localhost/tamanu_meta_dev- Run migrations:
$ just migrate- Build the project:
$ just check- Run public server:
$ cargo watch-public- Run private server:
$ just watch-private- Run other binaries:
$ cargo run --bin binary_name_here- Tests:
$ just test- Lints:
$ just lint- Format, lint, and test in one command:
$ just devSee all available commands:
$ just --listWe recommend using Rust Analyzer or Rust Rover for development.
- Create a migration:
$ just migration some_name_here-
Write the migration's
up.sqlanddown.sql -
Run the pending migrations:
$ just migrate- Test your down:
$ just migrate-redoYou'll need to have kubectl installed and authorised.
# just download-db {database name} {kubernetes namespace} [dump file]
$ just download-db tamanu_meta tamanu-meta-prod(You need write access to the main branch directly)
On the main branch:
$ just release minor(or use patch or major instead of minor)
The public-server binary serves the public API and views, which are expected to be exposed to
the internet (in production behind an ingress gateway or reverse proxy).
The mtls-certificate (or ssl-client-cert) header should contain a PEM-encoded (optionally URL-encoded) X509 certificate.
To get a certificate, run:
$ just identityThis will write the identity.crt.pem and identity.key.pem.
You can then put it in an environment variable:
$ export MTLS_CERT="$(jq -sRr @uri identity.crt.pem)"and then use curl like:
$ curl -H "mtls-certificate: $MTLS_CERT" ...In production, the header should be set from a client certificate, as terminated by a reverse proxy or load balancer, and any matching header on the incoming requests should be stripped.
- Nginx: use the
$ssl_client_escaped_certvariable. - Caddy: use the
{http.request.tls.client.certificate_pem}placeholder.