feat: shifting to VMs!
This commit is contained in:
@@ -1,15 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Shuffle",
|
"name": "Shuffle",
|
||||||
"description": "Security Automation Platform",
|
"description": "Security Automation Platform",
|
||||||
"repository": "https://github.com/shuffle/shuffle",
|
"repository": "https://github.com/Shuffle/Shuffle",
|
||||||
"env": {
|
"ref": "2.0.0",
|
||||||
"SERVICE_NAME": {
|
"scripts": {
|
||||||
"description": "Name of the Cloud Run service",
|
"postclone": "chmod +x startup.sh && ./startup.sh"
|
||||||
"value": "shuffle-app"
|
|
||||||
},
|
|
||||||
"REGION": {
|
|
||||||
"description": "GCP region to deploy to",
|
|
||||||
"value": "us-central1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
# cloudbuild.yaml
|
|
||||||
steps:
|
|
||||||
# Create and set permissions for database directory
|
|
||||||
- name: 'gcr.io/cloud-builders/docker'
|
|
||||||
entrypoint: 'bash'
|
|
||||||
args:
|
|
||||||
- '-c'
|
|
||||||
- |
|
|
||||||
mkdir -p shuffle-database && chmod -R 777 shuffle-database
|
|
||||||
|
|
||||||
# Build images using docker-compose
|
|
||||||
- name: 'docker/compose'
|
|
||||||
args: ['build']
|
|
||||||
|
|
||||||
# Push images to Container Registry
|
|
||||||
- name: 'docker/compose'
|
|
||||||
args: ['push']
|
|
||||||
|
|
||||||
# Start services and perform health checks
|
|
||||||
- name: 'docker/compose'
|
|
||||||
entrypoint: 'bash'
|
|
||||||
args:
|
|
||||||
- '-c'
|
|
||||||
- |
|
|
||||||
# Start services
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
# Initial wait for services to start
|
|
||||||
echo "Waiting 30 seconds for initial startup..."
|
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Check for restarting containers
|
|
||||||
ATTEMPTS=30
|
|
||||||
for i in $(seq 1 $ATTEMPTS); do
|
|
||||||
RESTARTING_CONTAINERS=$(docker ps --filter "status=restarting" --format "{{.Names}}")
|
|
||||||
if [ -n "$RESTARTING_CONTAINERS" ]; then
|
|
||||||
echo "The following containers are restarting:"
|
|
||||||
echo "$RESTARTING_CONTAINERS"
|
|
||||||
docker-compose logs
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "No containers are restarting. Attempt $i/$ATTEMPTS."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo "No containers were found in a restarting state after $ATTEMPTS checks."
|
|
||||||
|
|
||||||
# Health check via HTTP endpoint
|
|
||||||
echo "Performing HTTP health check..."
|
|
||||||
RESPONSE=$(curl -s http://localhost:3001)
|
|
||||||
if echo "$RESPONSE" | grep -q "Shuffle"; then
|
|
||||||
echo "Health check passed: 'Shuffle' found in response."
|
|
||||||
else
|
|
||||||
echo "Health check failed: 'Shuffle' not found in response."
|
|
||||||
echo "Response received:"
|
|
||||||
echo "$RESPONSE"
|
|
||||||
docker-compose logs
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Deploy to Cloud Run if all checks pass
|
|
||||||
- name: 'gcr.io/cloud-builders/gcloud'
|
|
||||||
args:
|
|
||||||
- 'run'
|
|
||||||
- 'deploy'
|
|
||||||
- '${_SERVICE_NAME}'
|
|
||||||
- '--image'
|
|
||||||
- 'gcr.io/$PROJECT_ID/${_SERVICE_NAME}'
|
|
||||||
- '--platform'
|
|
||||||
- 'managed'
|
|
||||||
- '--region'
|
|
||||||
- '${_REGION}'
|
|
||||||
- '--allow-unauthenticated'
|
|
||||||
|
|
||||||
# Timeouts and options
|
|
||||||
timeout: '1800s'
|
|
||||||
options:
|
|
||||||
machineType: 'E2_HIGHCPU_8'
|
|
||||||
logging: CLOUD_LOGGING_ONLY
|
|
||||||
Reference in New Issue
Block a user