Skip to main content
coding intermediate

Generate Professional Deployment Scripts

Create production-ready deployment scripts for any platform. Automate builds, testing, and deployments with this comprehensive AI prompt.

Works with: chatgptclaudegemini

Prompt Template

Act as an experienced DevOps engineer and create a comprehensive deployment script for the following specifications: **Project Details:** - Application type: [APPLICATION_TYPE] - Target environment: [TARGET_ENVIRONMENT] - Deployment platform: [DEPLOYMENT_PLATFORM] - Programming language/framework: [TECH_STACK] **Requirements:** - Include pre-deployment checks (health checks, dependency validation) - Add proper error handling and rollback mechanisms - Implement logging and monitoring integration - Include environment-specific configurations - Add security best practices (secrets management, permission checks) - Create backup procedures before deployment - Include post-deployment verification steps **Additional Specifications:** [ADDITIONAL_REQUIREMENTS] **Output Format:** Provide the deployment script with: 1. Clear comments explaining each section 2. Configurable variables at the top 3. Functions for reusable code blocks 4. Error handling with meaningful messages 5. A README section explaining usage and prerequisites 6. Any necessary configuration files (docker-compose, k8s manifests, etc.) Make the script production-ready, following industry best practices for the specified platform and including proper exit codes, validation steps, and comprehensive error reporting.

Variables to Customize

[APPLICATION_TYPE]

Type of application being deployed

Example: Node.js REST API with PostgreSQL database

[TARGET_ENVIRONMENT]

Environment where the application will be deployed

Example: staging

[DEPLOYMENT_PLATFORM]

Platform or service used for deployment

Example: AWS ECS with Application Load Balancer

[TECH_STACK]

Programming language and framework details

Example: Node.js 18, Express.js, PostgreSQL 14

[ADDITIONAL_REQUIREMENTS]

Any specific requirements or constraints

Example: Must include database migration steps and Redis cache warming

Example Output

```bash #!/bin/bash # Node.js API Deployment Script for AWS ECS - Staging Environment # Author: DevOps Team # Version: 1.0 set -e # Configuration Variables APP_NAME="my-api" ENVIRONMENT="staging" ECS_CLUSTER="staging-cluster" ECS_SERVICE="my-api-service" DB_MIGRATION_TIMEOUT=300 REGION="us-east-1" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' log() { echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')] $1${NC}" } error() { echo -e "${RED}[ERROR] $1${NC}" >&2 exit 1 } # Pre-deployment checks log "Starting pre-deployment checks..." # Check AWS CLI and credentials aws sts get-caller-identity > /dev/null || error "AWS credentials not configured" # Backup current deployment log "Creating deployment backup..." aws ecs describe-services --cluster $ECS_CLUSTER --services $ECS_SERVICE > backup_$(date +%Y%m%d_%H%M%S).json # Build and push Docker image log "Building Docker image..." docker build -t $APP_NAME:$ENVIRONMENT . docker tag $APP_NAME:$ENVIRONMENT $ECR_REPOSITORY:$ENVIRONMENT aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $ECR_REPOSITORY docker push $ECR_REPOSITORY:$ENVIRONMENT # Run database migrations log "Running database migrations..." timeout $DB_MIGRATION_TIMEOUT npm run migrate || error "Database migration failed" # Deploy to ECS log "Deploying to ECS..." aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment # Wait for deployment to complete log "Waiting for deployment to stabilize..." aws ecs wait services-stable --cluster $ECS_CLUSTER --services $ECS_SERVICE # Post-deployment verification log "Running post-deployment health checks..." for i in {1..5}; do if curl -f http://$LOAD_BALANCER_URL/health; then log "Deployment successful!" exit 0 fi sleep 30 done error "Health check failed after deployment" ```

Pro Tips for Best Results

  • Always specify your exact tech stack and platform versions to get more accurate deployment scripts
  • Include your specific error handling requirements and rollback strategies in the additional requirements
  • Ask for environment-specific configurations if you need different settings for dev/staging/production
  • Request security best practices relevant to your cloud provider (AWS, GCP, Azure)
  • Specify if you need integration with specific CI/CD tools like Jenkins, GitHub Actions, or GitLab CI

Tags

Want 500+ Expert Prompts?

Get the Premium Prompt Pack — organized, tested, and ready to use.

Get it for $29

Related Prompts You Might Like