Red Hat massages management site.
This guide will be using the default settings. By using environmental variables (see below) you can easily configure the application. To run the application you'll need to download Java, PostgreSQL, Keycloak, Maven and Node.js.
- Create and start a local PostgreSQL database on port
5432
with username and password set topostgres
. - Start the Keycloak standalone server on port
9090
(offset1010
). Also setup a new administrator console account. - Configure Keycloak based on the Keycloak setup below. For more information visit the official Keycloak documentation.
- Clone or download the GitHub repository to your computer.
- Move the downloaded client configuration
keycloak.json
file to thereact-ui/public
folder. - In the root folder of the project run
mvn clean package
to build your application. - Also populate the database scheme with
java -jar target/Massages-<VERSION>.jar db migrate config.yml
. - Then you can start the application by running
java -jar target/Massages-<VERSION>.jar server config.yml
. - To check that your application is actually running go to
http://localhost:8080
.
Replace <VERSION>
with the version of your build (can be found in pom.xml
).
The application requires Keycloak server to be configured (environmental variables are supported).
In the Keycloak administration console you need to create a new realm called Massages
. In this realm 2 new authorization clients need to be created:
api-client
for server communication that hasbearer-only
Access Type.ui-client
for client communication that haspublic
Access Type with a single Valid Redirect URI set tohttp://localhost:8080/*
.
Then switch to the Roles tab and create 2 new roles: admin
(for administrators) and user
(for normal users).
Afterwards you can create new users with given roles in the Users tab, but before using the authentication server you need to remove SSL verification in realm's Login settings. There you can also enable other features like registration on the login page etc.
After disabling the SSL verification go back to ui-client
setup, select its Installation tab and downlaod the JSON configuration file, which you will need to configure the UI client later.
Example Keycloak realm setup with default values can be found here and should be importable to the administration console. Example client configuration JSON can be found here and should be also fully reusable in a local setup.
The application supports these environmental variables for the database:
VARIABLE | MEANING | DEFAULT VALUE |
---|---|---|
RM_DB_USERNAME | Database username | postgres |
RM_DB_PASSWORD | Database password | postgres |
RM_DB_URL | Database address | jdbc:postgresql://localhost:5432/postgres |
The application supports these environmental variables for server Keycloak configuration:
VARIABLE | MEANING | DEFAULT VALUE |
---|---|---|
KC_REALM | Keycloak realm name | massages |
KC_SERVER | Keycloak server URL | http://localhost:9090/auth |
KC_RESOURCE | Application resource name | api-client |
KC_SECRET | Keycloak secret | b4a1ee69-6441-49a0-b653-e2875234c0ef |
The application supports these environmental variables for the SMTP server:
VARIABLE | MEANING | DEFAULT VALUE |
---|---|---|
SMTP_APP_URL | Client application url | http://localhost:8080 |
SMTP_SERVER | SMTP server name | localhost |
SMTP_PORT | SMTP server port | 587 |
SMTP_USERNAME | SMTP username | – |
SMTP_PASSWORD | SMTP password | – |
SMTP_FROM_EMAIL | SMTP sender email | portal@massages.com |
SMTP_FROM_NAME | SMTP sender name | admin |
The application can be easily started using Docker using its Dockerfile. The container needs to be connected to a database to be usable, however.