Source Code & Environments
The Source Code
The source code of the project is hosted in the gitlab at below URL. The backend code is in the aicamera_backend
directory.
Below are the technologies and libraries used in development and maintenance of the application.
- Python API library: Flask
- Database: Postgres SQL server
- ORM: SQL Alchemy
- DB Migrations: alembic
- Deployment: Docker services using docker-compose
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.
cd aicamera_backend
export DATABASE_URL=postgresql://aicamera_user:camcom1616@localhost/aicamera
alembic revision --autogenerate -m "test"
alembic upgrade head # applies all the migrations on the database
alembic downgrade -1 # downgrades the last database migrations
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.
Below are the details of the deployment commands for each environment, along with the corresponding details of build VM and environments.
AI Camera PROD environment
- AI Camera Domain: https://aicamera.camcom.ai/
- Git branch:
prod
- Build VM: 10.5.88.16
- Deployment VM: 10.5.88.13
- Build commands
cd ~/Jenkins/prod-ai-enabled-camera-webrtc/ git checkout prod git pull docker build -t camcomtech/aicamera_prod:latest . cd image_uploader docker build -t camcomtech/aicamera_image_uploader_prod:latest . docker push camcomtech/aicamera_prod:latest docker push camcomtech/aicamera_image_uploader_prod:latest
- Deployment commands
AI Camera UAT environment
- AI Camera Domain: https://aicamera.staging.camcom.ai/
- Git branch:
staging
- Build VM: 10.5.88.16
- Deployment VM: 10.5.88.9
- Build commands
cd ~/Jenkins/staging-ai-enabled-camera-webrtc/ git checkout staging git pull docker build -t camcomtech/aicamera_staging:latest . cd image_uploader docker build -t camcomtech/aicamera_image_uploader_staging:latest . docker push camcomtech/aicamera_staging:latest docker push camcomtech/aicamera_image_uploader_staging:latest
-
Deployment commands
-
TriNetra (Generic flow): https://trinetra.uat.camcom.ai -
Hyundaiin
pilot with video capture (Deprecated, new UI will be offered to them while performing UAT) - TriNetra (ERGO flow): https://trinetra.uat-new.camcom.ai - QOALA ID with encrypted links and multiple capture configurations
AI Camera Demo environment
- AI Camera: https://aicamera.demo.camcom.ai/
- Git branch:
dev
- Build VM: 10.5.88.16
- Deployment VM: 10.5.88.9
- Build commands: The latest
dev
version of AI Camera Docker images are used because the demo environment undergoes frequent changes. - Deployment commands
AI Camera Dev environment
The dev
environment is used to test feature changes and bug fixes before merging them into the main
branch and subsequently merge into staging
and prod
branches.
- AI Camera Domain: https://aicamera.dev.camcom.ai/ - dev environment and pilot environment.
- AI Camera Domain: https://aicamera.dev1.camcom.ai/ - setup to test the the hot fixes on the PROD code, not used actively.
- Git branch:
main
- Build VM: 10.5.88.16
- Deployment VM: 10.5.88.16
-
Build and deployment commands
cd ~/Jenkins/dev-ai-enabled-camera-webrtc/ git fetch origin merge-requests/<merge-request-id>/head && git checkout FETCH_HEAD docker build -t camcomtech/aicamera_dev:latest . cd image_uploader docker build -t camcomtech/aicamera_image_uploader_dev:latest . cd ~/Jenkins/aicamera_dev/ docker compose up -d docker push camcomtech/aicamera_dev:latest docker push camcomtech/aicamera_image_uploader_dev:latest
-
TriNetra (Generic flow): https://aicamera.new.review.camcom.ai/en/aicamera (Deprecated)
- TriNetra (ERGO flow): https://trinetra.dev.camcom.ai/en/ergoba
AI Camera EU Pilot environment
- AI Camera Domain: https://aicamera-api.uat.camcom.ai/
- TriNetra: https://aicamera.uat.camcom.ai/en/ergobaltic
-
TO-BE-FILLED-IN
-
https://trinetra.360.dev.camcom.ai/ - CAAS mobile view for EU-ERGO