Our project is dedicated to developing a system for efficiently managing parking facilities in a town. This system streamlines the handling of parking sessions, encompassing the initiation and ending of sessions, calculating parking fees, and processing payments.
-
Parking Session Initiation:
- A vehicle owner enters a parking facility and starts a parking session.
- The Session Management Service records the session details like the spot number and entry time.
-
Parking Session Termination:
- The session ends when the vehicle exits the facility.
- The Pricing Service calculates the parking fee based on the total duration of the parking.
-
Payment Processing:
- The vehicle owner is charged upon session termination.
-
** SessionOrchestrator:**
- Orchestrator executes the whole flow for session start and stop.
We are starting with a straightforward approach:
- Synchronous Communication: Using RESTful API calls for inter-service communication.
- Eventual Consistency: api calls immediately return and offload task to a background task/event.
- Orchestration-based Coordination: Centralized control for whole flow.
The backend is composed of three main services:
-
Session Management Service:
- Manages the start and end of parking sessions.
- Tracks the specific details of each vehicle's parking.
-
Pricing Service:
- Calculates parking fees based on session duration and spot location.
-
Payment Service:
- Handles transactions after parking sessions.
- Supports various payment methods including credit cards and digital wallets.
- Docker and Docker Compose installed on your machine.
-
Clone the Repository:
- Ensure you have the project repository cloned or downloaded on your machine.
-
Navigate to the Project Directory:
- Change directory to the root of the project where the
docker-compose.yml
file is located.
- Change directory to the root of the project where the
-
Run Docker Compose:
- Execute the following command to start the services defined in the Docker Compose file:
docker-compose up
- Execute the following command to start the services defined in the Docker Compose file:
The docker-compose.yml
file defines the following services:
-
session Orchestration API (
orchestrator-api
):- Built from the Dockerfile in
src/SessionOrchestrator
. - Accessible on port
9012
.
- Built from the Dockerfile in
-
Sessions API (
sessions-api
):- Built from the Dockerfile in
src/Sessions/Sessions.API
. - Accessible on port
5056
.
- Built from the Dockerfile in
-
Product Pricing API (
productpricing-api
):- Built from the Dockerfile in
src/ProductPricing/ProductPricing.API
. - Accessible on port
5055
.
- Built from the Dockerfile in
-
Payments API (
payments-api
):- Built from the Dockerfile in
src/Payments/Payments.API
. - Accessible on port
9011
.
- Built from the Dockerfile in
-
Database Services:
- Three PostgreSQL instances for
sessions-db
,payments-db
, andproductpricing-db
. - Accessible on ports
5436
,5435
, and5437
respectively.
- Three PostgreSQL instances for
-
Jaeger Tracing (
jaeger
):- Used for tracing and monitoring.
- UI accessible on port
16686
.
Each service is configured with specific environment variables for database connections and inter-service communication. These are set in the environment
section of each service in the docker-compose.yml
file.
Run the following command:
docker-compose up
./go start-valid-session
# above command will return a sessionId
Stop the session using the following endpoint:
./go stop-session {sessionId}
# SessionId is received in start-valid-session command