Service setup
Installation guide for CREDEBL Platform Services
Before installing the CREDEBL Platform services, it is essential to ensure that your environment meets certain prerequisites. Properly setting up these requirements will help facilitate a smooth installation process and optimal performance of the platform. This includes preparing your system with the necessary software dependencies, configuring the required network settings, and ensuring adequate hardware resources. Following these guidelines will help prevent potential issues and ensure that the CREDEBL Platform services are installed and operate as intended.
System requirements
Here is the list of software needed to get started:
Git (>= 2.34.1)
Docker (>= 24.0.5)
Docker Compose (>= 2.20.3)
Prerequisites
Here is the list of prerequisites software we will need for CREDEBL:
PostgreSQL (>= 14)
NATS (>= 2.6.4)
REDIS (>= 7.4)
Keycloak (>= 25.0.6)
Schema file server (optional)
Clone Repository
Clone the platform repository from GitHub:
Environment Variables
To help you quick start, a .env.demo is already present at the root of the platform repository. To getting started, rename .env.demo to .env
Please find your-ip in the .env file, and replace all occurrences it with your machine's Ip address.
Apart from the already present variables, you need to add few variables generated from the below prerequisites like the PostgreSQL, Keycloak, Sendgrid, AWS S3, etc at the respective steps.
PostgreSQL
PostgreSQL is a powerful, open-source object-relational database system known for its robustness and advanced features. This guide provides instructions for installing and configuring PostgreSQL both natively and using Docker. Installing PostgreSQL
Initially we'll need to install postures on the host or on docker
Access the PostgreSQL and create user and database
NATS
The CREDEBL platform utilizes NATS for message-driven data exchange between its micro-services.
REDIS
The CREDEBL platform leverages Redis as an in-memory data store, primarily for caching and queuing.
Keycloak
Run Keycloak using Docker
This command installs and starts Keycloak locally and makes it accessible at:
Initial Keycloak Configuration
Open the Keycloak Administration Console.
Login using:
Username:
adminPassword:
admin
Click on the Keycloak dropdown at the top-left corner.
Create a new realm named:
Create adminClient
Go to Clients under Manage from the left sidebar.
Click on Create Client.
Set:
Click Next.
Enable the following:
Client Authentication = ON
Service Accounts Roles = ON
Direct Access Grants = ON
Click Next.
Configure the following values:
Valid Front end redirect URIs
Example: http://localhost:3000/*
Root URL
Example: http://localhost:8080/
Web Origins
Example: http://localhost:8080/
Save the client details.
Configure Service Account Roles for adminClient
Open the
adminClient.Go to the Service Account Roles section.
Click on Assign Role.
Select Filter by Clients from the dropdown.
Assign the following roles:
Realm Roles Settings
Under the
credebl-platformrealm, select:
Click on Create Role.
Create a role with:
SSO Session Settings:
Set SSO Session Idle to 2 days. This is the expiration time of the refresh token if the user is idle on the platform. We can configure this as per our need.
To navigate to SSO Session, go to Realm settings option on left sidebar under configure, now under the Sessions tab you can see SSO Session Idle.\
Update the .env
Update the .env file for the Keycloak details:
To set the env variable KEYCLOAK_MANAGEMENT_CLIENT_SECRET
Go to the
credebl-platformrealm.Navigate to:
Clients →
adminClientOpen the Credentials tab
Copy the client secret for
ADMIN_KEYCLOAK_SECRET
Additional Keycloak Configuration for v2.2.0
If you are upgrading to v2.2.0 or later, apply the following additional changes.
Create credeblClient
Go to Clients under Manage.
Click on Create Client.
Set:
Click Next.
Enable the following:
Client Authentication = ON
Service Accounts Roles = ON
Direct Access Grants = ON
Click Next.
Configure the same Redirect URIs, Root URL, and Web Origins used for
adminClient.Save the client details.
Configure Service Account Roles for credeblClient
Open the
credeblClient.Go to the Service Account Roles section.
Click on Assign Role.
Select Filter by Clients from the dropdown.
Assign the same roles configured for
adminClient:
Enable Unmanaged Attributes
Go to:
Locate:
If it is disabled, enable it.
Realm Roles Settings
Under the
credebl-platformrealm, select:
Click on Create Role.
Create a role with:
Update the .env
Update the .env file with the following Keycloak configuration details:
To set the environment variables KEYCLOAK_MANAGEMENT_CLIENT_SECRET and ADMIN_KEYCLOAK_SECRET:
Go to the
credebl-platformrealm.Navigate to:
Clients →
credeblClientOpen the Credentials tab
Copy the client secret for
KEYCLOAK_MANAGEMENT_CLIENT_SECRET
Navigate to:
Clients →
adminClientOpen the Credentials tab
Copy the client secret for
ADMIN_KEYCLOAK_SECRET
SendGrid
Create a SendGrid account, generate an API key, and grant necessary permissions for sending emails.
Add the send grid key in the
.env
AWS S3
To utilize all functionalities of CREDEBL, total of 3 S3 buckets are required for;
Storing Organization logo during creating and updating an organization
Bulk issuance of credentials
Storing connection URL generated from Agent and creating shortened URL
According to the AWS_S3_STOREOBJECT_BUCKET name, as per the AWS S3 path style, add domain to access objects from the bucket and save it, as it is utilized for the another .env variable
Schema File Server
Clone Repository
Clone the platform repository from GitHub:
Environment Variables
To help you quick start, a .env.demo is already present at the root of the platform repository. To getting started, rename .env.demo to .env
Please find JWT_TOKEN_SECRET in the .env file and replace its value with a base64-encoded JWT token.
Service Setup
Build the Docker Image
Run the Docker Container
-d: Run container in detached mode--env-file .env: Load environment variables from the.envfile-p 4000:4000: Map host port 4000 to container port 4000-v "$PWD/app/schemas:/app/schemas": Mount the localapp/schemasdirectory into the container--name schema-file-server: Assign a name to the containerschema-file-server: The name of the Docker image
Update .env and agent.env
Update the schema file server token and URL in both the .env and agent.env files.
Agent Setup
The Docker image built during this process is used to launch agents for new organizations on the CREDEBL platform.The Docker image name is set as an environment variable during the platform setup in a later step.
The default image for agent is ghcr.io/credebl/credo-controller:latest refering to latest release of the credo-controller. Refer here: https://github.com/credebl/credo-controller/pkgs/container/credo-controller
SSO (Single Sign-On) (Applicable for V 2.1.0 onwards)
If applications consuming CREDEBL want to use SSO feature, additional environment variables need to be set on the backend side as well.Please refer to the
env.demofile for the required values when running the Platform.As part of session management, for users who want to use the client ID / client secret based token generation feature, we have updated the response to include cookies. Using these cookies, users can fetch their session details.
To fetch the session details, call the following API while passing the stored cookies in the request headers
:/auth/sessionDetails
For more details visit this - https://docs.credebl.id/docs/~/revisions/IXcpHdsfgTsukxV376wG/references/releases/v.2.1.0
Installations
Make sure the .env file is set with all the required environment variables as per the sample file and the env guide give above.
Before you start the services make sure to update the credebl-master-table.json present at location, libs/prisma-service/prisma/data sendgrid details as well as your ip-address
At the root of the platfrom repo:
Now seed the db, before starting the services using the following:
Since, you are in the '/prisma-service', move back to the root
Start the services:
Install the pnpm package using the following command if it isn’t already installed on your machine:
Install dependencies
To start the API gateway
To start all microservices using below command followed by microservice name, example: start user service.
Access the Platform API by navigating to http://localhost:5000
Last updated
