This documentation provides an overview of the SentiMovie
FastAPI application codebase. This application is designed to provide sentiment analysis and explanation for given text inputs using multiple models.
This repository contains a CI/CD pipeline for testing, building, and deploying images using GitHub Actions. The pipeline includes the following stages: test, build, and deployment of multiple components.
This workflow is triggered on push
events to the repository. It consists of three main stages: test
, build
, and darkube_deploy
.
The test
stage is responsible for running unit tests for the application. It sets up the required environment and dependencies, installs dependencies from the specified requirements files, and then runs the unit tests.
The build
stage is dependent on the successful completion of the test
stage. It performs the following actions:
- Checks out the repository code.
- Builds and pushes Docker images for various components:
- Model A
- MLflow
- Model B
- Broker
The images are built using the code from the appropriate directories and tagged with the short SHA of the commit. The built images are pushed to the specified Docker registry.
The darkube_deploy
stage is dependent on the successful completion of the build
stage. It deploys the built Docker images using the Darkube CLI. The deployment is performed for the following components:
- MLflow
- Model
- Model B
- Broker
The deployment is triggered using the Darkube CLI, with the specified ref
, token
, app-id
, image-tag
, and other parameters. The deployment process is executed for each component separately.
The following environment variables are used in the workflow:
REGISTRY
: The Docker registry URL.REGISTRY_PASSWORD
: The password for authenticating with the Docker registry.REGISTRY_USER
: The username for authenticating with the Docker registry.APP_NAME_MODEL
,APP_NAME_MLFLOW
,APP_NAME_MODEL_B
,APP_NAME_API
: Names of the different application components.DARKUBE_DEPLOY_TOKEN_MLFLOW
,DARKUBE_DEPLOY_TOKEN_MODEL
,DARKUBE_DEPLOY_TOKEN_MODEL_B
,DARKUBE_DEPLOY_TOKEN_API
: Darkube deployment tokens for different components.DARKUBE_APP_ID_MLFLOW
,DARKUBE_APP_ID_MODEL
,DARKUBE_APP_ID_MODEL_B
,DARKUBE_APP_ID_API
: Darkube application IDs for different components.
To use this CI/CD pipeline for your own project, follow these steps:
- Update the workflow file
.github/workflows/cicd.yml
as needed. - Configure the environment variables according to your project requirements.
- Set up Darkube CLI on your deployment environment if you haven't already.
- Push changes to your repository.
The workflow will automatically trigger on each push
event to the repository. It will test, build, and deploy the specified Docker images based on the configured components.
Please ensure that you review and adjust the pipeline configuration according to your project's specific needs before using it in a production environment.
Note: This README provides an overview of the CI/CD pipeline. For detailed information on each stage and the deployment process, refer to the workflow definition file (ci-cd-pipeline.yml
) and the respective deployment scripts in your repository.