Docker-Compose

How to run Hook0 locally with Docker Compose for development purposes

Run docker-compose

Here are the commands you need to run:

docker build -f self-hosted/docker/Dockerfile.api . -t hook0-api:latest
docker build -f self-hosted/docker/Dockerfile.frontend . -t hook0-frontend:latest

cd self-hosted/docker/
docker-compose up -d postgres keycloak

Configure API

Most of the application is configured, only 2 variable are missing for the API.

To obtain these variables we need to run the docker-compose one time.

Then access to http://localhost:8080 (Keycloak admin console, username: admin, password: admin)

Once you are connected, you can search for the value of variables :

  • KEYCLOAK_OIDC_PUBLIC_KEY
  • KEYCLOAK_CLIENT_SECRET

The first one is in Realm Settings

1840

Clic on public key and get the value.
In self-hosted/docker/api.env KEYCLOAK_OIDC_PUBLIC_KEY will be equal to:

KEYCLOAK_OIDC_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
<copied_value>
-----END PUBLIC KEY-----"

For the second you have to go on client hook0-api, copy the value and set KEYCLOAK_CLIENT_SECRET variable:

1840 1840

Once you have done all of this, execute :

docker-compose up -d api frontend

Then visit http://localhost:8001/
(Pssst: You will need to create a user http://localhost:8080/admin/master/console/#/hook0/users/add-user :smiley:)