Skip to content

Setup and Installation

PROJECT ZERO edited this page Jan 18, 2025 · 1 revision

Setup and Installation

Prerequisites

  • Python 3.8+
  • Docker (for containerized deployment)
  • AWS CLI, Azure CLI, Google Cloud SDK, or DigitalOcean CLI (for cloud deployment)

Installation

  1. Clone the repository:

    git clone https://github.com/your-repo/project-red-sword.git
    cd project-red-sword
  2. Install Python dependencies:

    pip install -r requirements.txt
  3. Set up environment variables:

    Create a .env file in the root directory and add your API keys:

    OPENAI_API_KEY=your-openai-api-key
    HUGGINGFACE_API_KEY=your-huggingface-api-key

Running the Application

To run the application locally, use the following command:

python app.py

Docker Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Run the Docker container:

    docker run -p 7860:7860 project-red-sword

Cloud Deployment

AWS Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Push the Docker image to AWS ECR:

    aws ecr get-login-password --region YOUR_AWS_REGION | docker login --username AWS --password-stdin YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com
    aws ecr create-repository --repository-name project-red-sword || echo "Repository already exists."
    docker tag project-red-sword:latest YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/project-red-sword
    docker push YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/project-red-sword
  3. Deploy to AWS Elastic Beanstalk:

    eb init -p docker project-red-sword --region YOUR_AWS_REGION
    eb create project-red-sword-env

Azure Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Push the Docker image to Azure ACR:

    az acr login --name YOUR_AZURE_ACR_NAME
    az acr create --resource-group YOUR_RESOURCE_GROUP --name YOUR_AZURE_ACR_NAME --sku Basic || echo "Registry already exists."
    docker tag project-red-sword:latest YOUR_AZURE_ACR_NAME.azurecr.io/project-red-sword
    docker push YOUR_AZURE_ACR_NAME.azurecr.io/project-red-sword
  3. Deploy to Azure App Service:

    az webapp create --resource-group YOUR_RESOURCE_GROUP --plan YOUR_APP_SERVICE_PLAN --name YOUR_APP_NAME --deployment-container-image-name YOUR_AZURE_ACR_NAME.azurecr.io/project-red-sword:latest

Google Cloud Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Push the Docker image to Google Container Registry:

    gcloud auth configure-docker
    docker tag project-red-sword gcr.io/YOUR_PROJECT_ID/project-red-sword
    docker push gcr.io/YOUR_PROJECT_ID/project-red-sword
  3. Deploy to Google Kubernetes Engine:

    kubectl apply -f google-k8s.yaml

DigitalOcean Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Deploy to DigitalOcean:

    doctl auth init
    doctl apps create --spec digitalocean-app.yaml

TABLE OF CONTENTS

Clone this wiki locally