Please also see the contribution guide in the root folder.
- Install Docker
- Install NodeJS
- Install Yarn
- Create an
.env
file with required variables (see.env.example
)
- Open a terminal in the
lab-server
directory - Run
yarn
to install the project dependencies - Start the server using
yarn start:dev
(usesdocker compose up -d
) - To test the application, send a GET request to
http://localhost:8081/api/v1/health
in order to verify that the lab server is up and running (or different port, if changed in.env
) - Complete the Keycloak setup (local) and MinIO and test user setup (local)
- If everything was setup correctly you can (1) get an access token from
Keycloak and (2) use this token to make a request to the lab server under the
route
http://localhost:8081/api/v1/star-alleles
- Open
http://localhost:28080
in your browser to access the keycloak admin console (or different port, if changed in.env
; make sure to also adapt the port inKEYCLOAK_AUTH_SERVER_URL
accordingly) - Login using the credentials
KEYCLOAK_USER
andKEYCLOAK_PASS
configured in the.env
file - Create a realm called
KEYCLOAK_REALM
(see.env
or usepharme-realm-export.json
for default settings; handles step 4, but need to regenerateKEYCLOAK_SECRET
in 4.1.2) - Create clients (one for the backend and one for the frontend)
- For the backend with name
KEYCLOAK_CLIENT_ID
(see.env
)access-type
"bearer only" (uncheck all other types, see StackOverflow)- In the credentials tab (enable "Client authentication" and save to
enable tab, see StackOverflow)
create a secret and update the
.env
valueKEYCLOAK_SECRET
accordingly
- For the frontend with the name
pharme-app
(asclientId
inapp/lib/login/pages/cubit.dart
)access-type
"public" ("Client authentication" off)- Set the redirect URI to
*
(for testing)
- In
Authentication > Required actions
disableVerify Profile
- For the backend with name
- Create a user for testing (you can choose username and password freely, no roles are required); when setting the password, set "Temporary" to "OFF"
- For more information see this guide (the important steps are described above; most of the steps described in the guide, including the application configuration in NestJS, are irrelevant for this setup)
To check all endpoints of your local Keycloak instance, send a GET request to
(for example with Postman):
http://localhost:28080/auth/realms/pharme/.well-known/openid-configuration
In order to check the admin console, send a GET request to:
http://localhost:28080/auth/
To receive authentication tokens, send a POST request to:
http://localhost:28080/auth/realms/pharme/protocol/openid-connect/token
with
the following body (x-www-form-urlencoded):
Type | Value |
---|---|
grant_type | password |
username | <username-of-your-user> |
password | <password-of-your-user> |
client_id | pharme-app |
Please make sure that if using localhost
to get the token, the host configured
in .env
also needs to be localhost
, not 127.0.0.1
. Otherwise, requesting
data with the will result in an wrong ISS
error.
- Open
http://localhost:9001
(or different port, if changed in.env
) in your browser - Open the administration console. Login with the credentials
MINIO_ROOT_USER
andMINIO_ROOT_PASSWORD
set in the.env
file. - Create a bucket called
alleles
- Add an alleles file to the
alleles
bucket using the MinIO admin console - Adapt the test user data in
src/seeder/users.json
(if not present, create based onsrc/seeder/users.example.json
) to include a user with thesub
of the Keycloak user created earlier; adapt theallelesFile
name to the file name you uploaded - Run the seeder with
yarn seed:run
Only works on Linux due to network_mode: host
setting.
From the project root, run
docker compose --file lab-server/docker-compose.yml --profile production up -d
to start all components.
The API and other components will be available under the ports specified in
the .env
file.