Code & Environment Setup
Code Repository
The source code is hosted in a private GitLab repository:
git clone git@gitlab.com:camcomtech-repos/engineering/cloud-adda/git-flow/microservices/cost-estimates.git
cd cost-estimates
API Documentation
The API documentation is available at Swagger UI when the application is running.
Database Dumps
You can download the database dumps from the links below:
Environment Setup
Create and activate a virtual environment:
Install dependencies:
Configure environment variables in .env
:
ENV=development
X_API_KEY=3cc17a23810aa075c2527bf5ee2b86ff
DATABASE_URL=mysql://root2:rootRoot12!@localhost/cost_estimates_dev
AUTOVERSE_VEHICLE_API_URL=https://iapi.testpitstop.com/v1.0/autoversepart/vehicle/search
AUTOVERSE_API_KEY=76XAPH97LWIROB31LFKFJICJ5EIP8ZRBM
AUTOVERSE_PART_DETAILS_API_URL=https://iapi.testpitstop.com/v1.0/autoversepart/spare/product/search/
Run the application:
Perform database migrations using Alembic:
The Alembic library is used to manage database schema changes on various environments. Below are sample commands to automatically generate migration files and to perform database upgrades or downgrades.
alembic revision --autogenerate -m "Initial migration"
alembic upgrade head # applies all the migrations on the database
alembic downgrade -1 # downgrades the last database migration
Run unit tests:
Environments and Deployments
We have multiple environments configured to meet different requirements.
The deployment process involves building a Docker image, pushing it to Docker Hub, pulling it onto the target VM, and restarting the relevant Docker services using Docker Compose commands. Deployments happen through CI/CD pipelining.
Development Environment
- Dev VM:
10.5.88.12
- Clone code from the
main
branch, create a new branch, make changes, push to Git, and raise a Merge Request (MR) tomain
. - The reviewer for this MR is Ompathi Madana.
- Once Ompathi verifies the changes, he will merge them into the
main
branch.
Dev Deployment Process
- The developer raises an MR and selects themselves as the reviewer.
- The MR should be labeled as
feature-main
. - Approve the request which triggers the CI/CD pipeline.
UAT Deployment
- UAT VM:
10.5.88.40
- Ompathi raises a new MR for UAT deployment (
main
toUAT
), triggering the UAT pipeline. - Vignesh selects the client for deployment and approves it.
- Upon approval, changes will be deployed on the UAT VM (
10.5.88.40
).