An app to manage patient records, consultations, appointments, lab reports, ...
The stack (provided by Meteor):
The tests are declared via Mocha thanks to
meteor-testing:mocha
.
π‘ We would replace Mocha by AVA or Jest here and now if only there was a Meteor package for that.
User Interface tests are facilitated by
@testing-library/react
,
@testing-library/dom
,
and
@testing-library/user-event
.
β οΈ Code coverage is currently both incomplete and broken most probably due to a TypeScript/Istanbul incompatibility.
In what follows, dev
refers to the development machine, and prod
refers to
the production machine.
curl https://install.meteor.com | sh
git clone gh:infoderm/patients
cd patients
meteor npm ci
This will run the linter and the type checker on staged files before each commit.
meteor npm run install-hooks
To lint source files we use xo
with
configuration inside package.json
. You can run the linter with
meteor npm run lint
You can attempt to autofix some errors with
meteor npm run lint-and-fix
The entire code base is checked for type errors with tsc
, the
TypeScript compiler. You can run the type
checker with
meteor npm run tsc
To run it in watch mode during development use
meteor npm run tsc:watch
You can set host and port via the
$HOST
and$PORT
environment variables (defaultlocalhost:12348
).
meteor npm run test
To run client tests non-interactively you can use
NB: this uses
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
meteor npm run test:dev:non-interactive
You can set host and port via the
$HOST
and$PORT
environment variables (defaultlocalhost:12348
).
meteor npm run test -- --once
β οΈ We recommend using thechromium
executable of your distribution. Installation of the puppeteerchromium
executable can be avoided by placing the linepuppeteer_skip_chromium_download=true
in your~/.npmrc
. If you wish to use thechromium
executable that comes withpuppeteer
remove the assignment of the variablePUPPETEER_EXECUTABLE_PATH
.
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium meteor npm run ci:test
You can set host and port via the
$HOST
and$PORT
environment variables (defaultlocalhost:12345
).
meteor npm run dev
You can set host and port via the
$HOST
and$PORT
environment variables (defaultlocalhost:12345
).
meteor npm run bundle-visualizer
meteor npm run upgrade
Some dependencies need manual upgrade. Their versions depends on the used Meteor version. Hereunder are the information links for the latest stable release of Meteor:
NB: @types/mongodb
does not need explicit pinning because it is a dependency
of @types/meteor.
Direct ESM dependencies cannot be added and CJS dependencies cannot be upgraded to ESM. See the relevant discussion.
ssh-keygen -m PEM -t rsa -b 4096 -a 100 -f .ssh/meteorapp
pacman -S docker
systemctl enable --now docker
useradd -m meteorapp
gpasswd -a meteorapp wheel
gpasswd -a meteorapp docker
Append it to /home/meteorapp/.ssh/authorized_keys
.
Remember: chmod .ssh 700
and chmod .ssh/authorized_keys 640
.
Install dependencies, custom certificates, and MongoDB on server:
meteor npm run setup-deploy
meteor npm run build-and-upload
meteor npm run deploy
TAG=vYYYY.MM.DD meteor npm run deploy
π§ This is work in progress. π§
ROOT_URL=https://example.local IMAGE_TAG=v1 \
docker compose \
--env-file .env -f compose.yaml \
--env-file .deploy/ghcr.io/.env -f .deploy/ghcr.io/compose.yaml \
config
The current backup system requires age
and the encryption/decryption key at
~/key/patients
on the production machine. It saves the database as an
encrypted (age
) compressed MongoDB archive (--archive --gzip
).
sh .backup/fs/backup.sh
sh .backup/restore.sh
The backup system uses encrypted (age
) compressed MongoDB archives
(--archive --gzip
). They can be restored with
age --decrypt -i "$KEYFILE" < 'patients.gz.age' |
mongorestore --drop --nsInclude 'patients.*' --archive --gzip
The backup system uses encrypted gzipped TAR archives. They can be processed by
first decrypting with age
to obtain a .gz
file, then decompressing and
unarchiving with tar xzf
to obtain a dump
directory, and finally using
mongorestore --drop --db patients
to restore the database.