This application:
- Leverages Java 1.8, Spring Boot 2.6, Maven, Redis, Thymeleaf, JQuery, Chart.js, Bootstrap as a technology stack
- Uses Redis as external session store
- Redis Streams as asynchronous processing engine for rejecting/approving appointments
- RedisJSON 2.0 redis module for storing appointment model objects
- RediSearch 2.2 redis module for indexing and searching through the JSON objects and aggregating the result for analytic purposes
- Optional: Can use RedisStack which has RediSearch and RediJSON included in it by default
Running the application
-
Using IDE like STS or IntelliJ
-
Clone the repo https://github.com/Redislabs-Solution-Architects/appointment-directory
-
Import the code into th IDE of your choice like STS or IntelliJ
-
Spin up a new or existing Redis Enterprise cluster using Redis Enterprise software OR Redis Enterprise Cloud OR run Redis Stack server on your local machine
-
Open the application.yml file and modify the redis server url, port and password variables. If password is not required, keep the value of spring.redis.auth as 'false'
-
Executing mandatory index scripts
Before using the application, connect to the Redis instance using redis-cli command line utility and execute following index scripts. This is necessary for the search feature to work.
FT.CREATE idx-status ON JSON SCHEMA $.status as status TAG
FT.CREATE idx-aptDate ON JSON SCHEMA $.appointmentDateTime as appointmentDateTime NUMERIC SORTABLE
FT.CREATE idx-desc ON JSON SCHEMA $.description as description TEXT
FT.CREATE idx-createdTime ON JSON SCHEMA $.createdTime as createdTime NUMERIC SORTABLE -
Run the application file 'AppointmentDirectoryApplication.java'
-
Finally shut down the Redis Enterprise server and application server once done
-
-
Using Kubernetes
Application can be deployed to Kubernetes cluster as well. For that respective YAML files are included. It contains:- the kubernetes deployment,
- configmap and
- service YAML file for loadbalancer type (for deploying on Cloud) make sure to execute above index scripts on redis server before running the application
-
Run with docker
(Install docker runtime if not installed)
Docker image for this application: abhishekcoder/appointment-directory:latest_Make sure Redis Enterprise server or RedisStack server is already running execute above index scripts on redis server before running the application
Execute the following command to run the application:
docker run -p 127.0.0.1:8080:8080 -e SPRING_REDIS_HOST=<REDIS_URL> -e SPRING_REDIS_PORT=<REDIS_PORT> -e SPRING_REDIS_PASSWORD=<REDIS_PSWD> abhishekcoder/appointment-directory:latest
For instance:
docker run -p 127.0.0.1:8080:8080 -e SPRING_REDIS_HOST=localhost -e SPRING_REDIS_PORT=6379 -e SPRING_REDIS_PASSWORD=e9gydixtEWqN4tYKgRnhUXysXADYJzZ9 abhishekcoder/appointment-directory:latest
-
Run with docker compose
(Install docker runtime if not installed)
This is the fastest way to spin-up the application and redis server. No need to execute any database scripts. All will be done by docker-compose utility behind the scene. Just execute the following command to run the application. This will create required docker objects including the needed containers one each for web-app and redis server. These containers are part of the same private network:docker compose up
Execute the following command to tier down the docker artifacts created above including the private network:
docker compose down
Snapshots of the application
Login page:
Appointment list page:
New appointment: