🗄️Server
Tech stack
Git
Java 17.x
Apache Maven 3.8.x
Docker 20.10.xx
Docker-compose 1.29.x
GitHub
The code for the server can be found in this repository: SPICE Server
Installation
To bring the Spice back-end up and running, there are few prerequisite that has to be done. You can either follow the commands or access the official documentation by clicking the hyperlink.
To install git in
ubuntu
run the following command or click Git Official site.
To install git in
windows
visit Git Official site.To install java in
ubuntu
run the following command or click Java Official site.
To install java in
windows
visit Java Official site.
To install Java in
windows
visit Java Official site.To download and install
maven
inubuntu
click Maven Official site - Download and Maven Official site - Install.After installing the maven zip file open the download folder and extract it.
To set the maven home path
Ubuntu
run the following command.
Paste the following lines in .bashrc file.
Then save the .bashrc file.
To apply the changes in the .bashrc file run the following command.
Note: Once you have executed the script mentioned above, please restart the machine.
To verify the maven installation, run the following command and check the version
To download
maven
inwindows
visit Maven Official site - Download.To install
maven
inwindows
visit Maven Official site - Install.To install docker follow steps in the Docker Official Docs.
To install docker-compose in
ubuntu
follow steps in the Docker Compose Official Docs.
Setup
Clone the spice-opensource repository.
Configuration
To run the application, you should pass the necessary configuration via environment properties. To achieve this, create a .env file and pass your own values for the following properties.
Note: Please paste the .env file inside the specified directory.
/spice-opensource/spice-server/
.env file
.env
The .env
file is used to store environment variables for the project. These variables are used to configure the application and contain sensitive information such as passwords, API keys, and other credentials.
Please note that the .env
file should never be committed to version control, as it contains sensitive information that should not be shared publicly. Instead, you should add the .env
file to your .gitignore file to ensure that it is not accidentally committed.
To use the application, you will need to create a .env
file in the root directory of the project and add the necessary environment variables. You can refer to the above file for an example of the required variables and their format.
The values provided in the instructions are for demonstration purposes only and will not work as-is. You will need to replace them with actual values that are specific to your environment.
Note: After checking out the project, please ensure that you update the relevant properties and values in env.example, and then rename it to .env.
.env description
PROJECT_PATH
: This property specifies the file path to the project's backend directory in the server.
DATABASE_URL
: This property contains the JDBC connection URL for the PostgreSQL database server with the server timezone set to UTC, with the database name.
DATABASE_USERNAME
: This property contains the username used to connect to the PostgreSQL database server.
DATABASE_PASSWORD
: This property contains the password to connect to the PostgreSQL database server.
DATABASE_NAME
: This property contains the name of the PostgreSQL database used by the project.
NOTIFICATION_PROJECT_PATH
: This property specifies the file path to the notification project.
REDIS_PASSWORD
: This property contains the password used to authenticate with the Redis server.
REDIS_HOST
: This property contains the IP address of the Redis server.
REDIS_PORT
: This property contains the port number used by the Redis server.
HERE_MAP_API_KEY
: This property contains the API key required to access the HERE Maps API.
IS_CLOUD
: This property indicates whether the project should retrieve the API Key from the cloud to use it with the HERE Maps API.
API_KEY_PATH
: This property specifies the path to the API key required to access the HERE Maps API.
SERVER_REGION
: This property specifies the region where the Amazon S3 buckets should create.
MAIL_SEND
: The Application uses this property to indicate whether it sends emails.
ENABLE_SMS_NOTIFICATION
: This property indicates whether SMS notifications are enabled in the Application.
SHEDLOCK_EMAIL_START
: This property specifies the start time for the email shedlock job.
SHEDLOCK_EMAIL_STOP
: This property specifies the stop time for the email shedlock job.
IS_NEXT_MEDICAL_REVIEW_JOB
: This property indicates whether the next medical review job is enabled.
IS_NEXT_BP_JOB
: This property indicates whether the next blood pressure job is enabled.
IS_NEXT_BG_JOB
: This property indicates whether the next blood glucose job is enabled.
SHEDLOCK_OUTBOUND_START
: This property specifies the start time for the outbound shedlock job.
SHEDLOCK_OUTBOUND_STOP
: This property specifies the stop time for the outbound shedlock job.
SHEDLOCK_SMS_START
: This property specifies the start time for the SMS shedlock job.
SHEDLOCK_SMS_STOP
: This property specifies the stop time for the SMS shedlock job.
SWAGGER_ENABLED
: This property indicates whether Swagger UI is enabled in the project.
LOCAL_FILE_SYSTEM_PATH
: This property specifies the path to the directory on the server where prescription signatures are stored.
IS_PRESCRIPTION_SIGNATURE_UPLOADED_TO_S3
: This property indicates whether prescription signatures uploaded to S3 bucket.
Alternative solution to AWS services using open-source and free service.
For more information refer link.
Deployment
Run the following commands in the below path.
Build a clean-install using maven /spice-opensource/spice-server
Build docker images by the following command.
Once the images are built, run the docker containers by the following docker command.
Validation
Once the deployment of the application is successful, you can confirm the connectivity of the Back-end by logging into the application. To accomplish this, you may choose any API Testing tool. In this particular case, the Postman API Platform was utilized as an example.
Endpoint
POST {{ipAdd}}:8762/auth-service/session
Request Body
This endpoint allows users to sign-in into the application. The request body should be in the form-data format and include the following fields:
username
: superuser@test.compassword
: 1be35bc75f8316c2b5e48203d93ab3043b4774a7ab4a9e9eebf963c283cde32ddfb95aa843aee3d345f78a551a069200f013cd98904011ea6fb0cd08087d4841
The response contains two values: Authorization and TenantId. You must use these values in the subsequent requests.
Swagger:
Access the Swagger UI documentation in the project using the following URL.
http://localhost:8762/webjars/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config
Note: The credentials displayed in the tables are for demonstration purposes only and should not be used in a production environment. If you need to remove, modify, or add new user credentials, you can create a new script file containing the necessary DDL or DML queries in the below specified location. It's important to note that attempting to update the existing script file may result in a checksum error.
user-service/src/main/resources/db/migration
Last updated