File size: 3,716 Bytes
ef4248d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

#!/bin/bash

echo "Setting up the Cybersecurity Framework..."

# Install Python dependencies
if [ -f "requirements.txt" ]; then
    echo "Installing Python dependencies..."
    pip install -r requirements.txt || {
        echo "Dependency installation failed. Please check your Python environment."
        exit 1
    }
else
    echo "requirements.txt not found!"
    exit 1
fi

# Ask the user for deployment options
echo "Select your deployment option:"
echo "1. Local Docker Setup"
echo "2. Deploy to AWS (via Docker)"
echo "3. Deploy to Azure (via Docker)"
echo "4. Deploy to Hugging Face Spaces"
echo "5. Deploy to DigitalOcean (via Docker)"
echo "6. Deploy to Google Cloud (via Docker)"
read -p "Enter the option number: " deploy_option

case $deploy_option in
    1)
        echo "Building and running the Docker container locally..."
        docker build -t archive-analyzer .
        docker run -p 7860:7860 archive-analyzer
        ;;
    2)
        echo "Building the Docker image for AWS..."
        docker build -t archive-analyzer .
        
        echo "Configuring 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 archive-analyzer || echo "Repository already exists."
        docker tag archive-analyzer:latest YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/archive-analyzer
        docker push YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/archive-analyzer
        
        echo "Deploying to AWS Elastic Beanstalk..."
        eb init -p docker archive-analyzer --region YOUR_AWS_REGION
        eb create archive-analyzer-env
        ;;
    3)
        echo "Building the Docker image for Azure..."
        docker build -t archive-analyzer .
        
        echo "Configuring 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 archive-analyzer:latest YOUR_AZURE_ACR_NAME.azurecr.io/archive-analyzer
        docker push YOUR_AZURE_ACR_NAME.azurecr.io/archive-analyzer
        
        echo "Deploying 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/archive-analyzer:latest
        ;;
    4)
        echo "Deploying to Hugging Face Spaces..."
        git init
        git remote add origin https://huggingface.co/YOUR_USERNAME/YOUR_PROJECT_NAME
        git add .
        git commit -m "Initial commit for Hugging Face Spaces"
        git push -u origin main
        echo "Hugging Face deployment completed. Visit your Hugging Face Spaces page to view the app."
        ;;
    5)
        echo "Building the Docker image for DigitalOcean..."
        docker build -t archive-analyzer .
        
        echo "Deploying to DigitalOcean..."
        doctl auth init
        doctl apps create --spec digitalocean-app.yaml
        ;;
    6)
        echo "Building the Docker image for Google Cloud..."
        docker build -t archive-analyzer .
        
        echo "Configuring Google Cloud..."
        gcloud auth configure-docker
        docker tag archive-analyzer gcr.io/YOUR_PROJECT_ID/archive-analyzer
        docker push gcr.io/YOUR_PROJECT_ID/archive-analyzer
        
        echo "Deploying to GKE..."
        kubectl apply -f google-k8s.yaml
        ;;
    *)
        echo "Invalid option. Exiting setup."
        exit 1
        ;;
esac

echo "Setup completed successfully!"