This is an admin web application created to
- Support the Electronic version of the MCH Booklet that leverages the Android FHIR SDK
- Support Administration Functionality such as user management, reporting etc of the same application.
To run the app in a development environment,
- Install the dependencies at the root of the project directory
yarn install
This application uses the postgresql database and prisma for database migrations. Note that prisma will be installed as a dependency in later steps. Postgres needs to be installed, however. Please follow the installation guide for your specific platform. The steps outlined below are for a Linux platform. (If you already have installed postgresql, proceed to the database or user creation step).
- Install postgresql
sudo apt install postgresql
- Start the postgresql service
sudo systemctl start postgresql
or
sudo service postgresql start
- Switch to the postgres user and open the postgresql prompt
sudo -i -u postgres
psql
- Create a new user (matching the credentials of your database)
CREATE USER yourusername WITH PASSWORD 'yourpassword';
You can look to grant the necessary privileges to your created user
- Start the necessary docker compose services
Navigate to the api
directory
cd api/
- Load the environment variables
cp .env.example .env
Note: Ensure you do the same for the frontend in the ui
directory
- Start the compose services. Note: if the services were not already built, they will first before they start
sudo docker compose -f ../docker-compose-dev.yml up -d
- Create a new database (dbname should match the database name provided in the database configurations in your code)
CREATE DATABASE dbname;
You can now proceed to your IDE terminal (or where your project folder is open)
- Navigate into the
api
directory (if not there already)
cd api
- Run database migrations
yarn run prisma:migrate
Once the migrations are succesful, you can now proceed to run the application.
- Run the dev command which starts both the ui and backend servers (at the root of your project).
yarn dev
To run a production build
- Docker
- Docker Compose
Use Docker and docker-compose to build and run the images for the entire project or just for the respective repos.
docker-compose up -d --build
This should bring up the following application.
NOTE: By default, the HAPI FHIR server will be exposed on ports 8080.
http://[YOUR-IP-HERE]:8080 - Web UI for the HAPI FHIR application. http://[YOUR-IP-HERE]:8080/fhir/swagger-ui/ - Swagger UI Docs for the application's API.
docker build -t ./ui
or
yarn docker:build:ui
docker build -t ./api
or
yarn docker:build:api
Confirm the services are up and running.
docker-compose ps
If this is the case. Ensure to run Prisma migrations to apply any pending database schema changes with
./api/run-dev-migrations.sh