Skip to content

wenichern/backstage-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Backstage Setup & Templates

Complete Backstage Golden Path template for AWS infrastructure provisioning with GitLab CI and Terraform Enterprise.

πŸ“ Folder Structure

backstage-setup/
β”œβ”€β”€ README.md                                    # This file - overview
β”‚
β”œβ”€β”€ backstage-golden-path/                       # ⭐ READY-TO-USE TEMPLATE
β”‚   β”œβ”€β”€ README.md                                # Quick start guide
β”‚   β”œβ”€β”€ SETUP-INSTRUCTIONS.md                    # Detailed setup steps
β”‚   β”œβ”€β”€ setup.sh                                 # Automated installation script
β”‚   β”œβ”€β”€ template.yaml                            # Backstage template definition
β”‚   └── content/                                 # Template content files
β”‚       β”œβ”€β”€ .gitlab-ci.yml                       # GitLab CI pipeline
β”‚       β”œβ”€β”€ catalog-info.yaml                    # Backstage catalog entry
β”‚       β”œβ”€β”€ terraform/                           # Terraform infrastructure
β”‚       β”‚   β”œβ”€β”€ main.tf                          # AWS resources (VPC, EC2, EKS)
β”‚       β”‚   β”œβ”€β”€ variables.tf                     # Configuration variables
β”‚       β”‚   └── outputs.tf                       # Infrastructure outputs
β”‚       └── scripts/                             # Deployment scripts
β”‚           β”œβ”€β”€ install-docker.sh                # Docker installation
β”‚           β”œβ”€β”€ install-kubectl.sh               # kubectl installation
β”‚           β”œβ”€β”€ install-helm.sh                  # Helm installation
β”‚           └── deploy-app.sh                    # Application deployment
β”‚
β”œβ”€β”€ backstage-golden-path-template.yaml          # Original template (reference)
β”œβ”€β”€ backstage-template-content/                  # Original content (reference)
└── backstage-golden-path-installation.md        # Complete deployment guide

πŸš€ Quick Start

For Mac POC (localhost:3000)

Run the automated setup script:

cd /Users/smarticle/backstage-setup/backstage-golden-path
./setup.sh

This will:

  1. Find your Backstage installation
  2. Copy template files to the correct location
  3. Show you the next steps

What You Need

Before running the setup:

  • βœ… Backstage running at http://localhost:3000
  • βœ… GitLab account + personal access token
  • βœ… Terraform Cloud account + API token
  • βœ… AWS credentials

πŸ“– Documentation

🎯 What This Template Does

User fills form in Backstage
        ↓
Creates GitLab repository
        ↓
GitLab CI Pipeline starts
        ↓
Stage 1: Terraform Enterprise provisions infrastructure
  - VPC, Subnets, Security Groups
  - EC2 instances
  - Optional EKS cluster
        ↓
Stage 2: Deploy applications
  - SSH to new EC2 instances
  - Install Docker, kubectl, Helm
  - Deploy applications
        ↓
Stage 3: Verify deployment
  - Run health checks
  - Report status
        ↓
View in Backstage catalog

πŸ—οΈ Architecture Components

Backstage Template

  • Form-driven infrastructure creation
  • Integrated with GitLab for repository creation
  • Automatic catalog registration
  • Pipeline status visibility

GitLab CI Pipeline

  • Validate: Terraform format and validation
  • Plan: Infrastructure planning
  • Provision: AWS resource creation (manual approval)
  • Deploy: Application deployment to EC2/EKS
  • Verify: Health checks and validation

Terraform Infrastructure

  • Virtual Private Cloud (VPC)
  • EC2 instances with security groups
  • Optional EKS cluster for Kubernetes
  • Configurable instance types and regions

Deployment Scripts

  • Automated Docker installation
  • Kubernetes tools (kubectl, Helm)
  • Application deployment automation
  • Health check scripts

πŸ› οΈ Usage

Step 1: Install Template

# Navigate to the template directory
cd /Users/smarticle/backstage-setup/backstage-golden-path

# Run setup script
./setup.sh

# Follow the prompts and instructions

Step 2: Configure Backstage

Add to your app-config.yaml:

catalog:
  locations:
    - type: file
      target: ./templates/aws-infrastructure-golden-path/template.yaml
      rules:
        - allow: [Template]

integrations:
  gitlab:
    - host: gitlab.com
      token: ${GITLAB_TOKEN}

Step 3: Set Environment Variables

export GITLAB_TOKEN="your-gitlab-personal-access-token"
export TFE_TOKEN="your-terraform-cloud-token"
export TFE_ORGANIZATION="your-terraform-org"

Step 4: Use in Backstage

  1. Open http://localhost:3000
  2. Click "Create" in sidebar
  3. Select "AWS Infrastructure Golden Path"
  4. Fill out the form
  5. Watch the magic happen! ✨

πŸ“Š Template Features

Infrastructure Options

  • AWS Regions: us-east-1, us-west-2, eu-west-1, ap-southeast-1
  • Environments: dev, staging, production
  • Instance Types: t3.micro, t3.small, t3.medium, t3.large
  • Kubernetes: Optional EKS cluster
  • Networking: Configurable VPC CIDR blocks

Deployment Options

  • EC2 instance deployment with Docker
  • Kubernetes deployment with kubectl
  • Helm chart deployment
  • Custom Docker images or build from Dockerfile

Pipeline Stages

  • Automated Terraform validation
  • Infrastructure planning with cost estimates
  • Manual approval for production changes
  • Automated deployment scripts
  • Health check verification
  • Rollback on failure

πŸ”§ Customization

Add Custom Terraform Modules

Edit backstage-golden-path/content/terraform/main.tf to add:

  • RDS databases
  • ElastiCache clusters
  • S3 buckets
  • CloudFront distributions
  • Lambda functions

Modify Pipeline Stages

Edit backstage-golden-path/content/.gitlab-ci.yml to:

  • Add testing stages
  • Include security scanning
  • Add notification steps
  • Customize deployment logic

Add More Scripts

Create new scripts in backstage-golden-path/content/scripts/:

  • Monitoring setup (CloudWatch, Datadog)
  • Security hardening
  • Application configuration
  • Database migrations

πŸ› Troubleshooting

Template not showing in Backstage?

# Verify files were copied
ls -la /path/to/backstage/templates/aws-infrastructure-golden-path/

# Check catalog configuration
cat /path/to/backstage/app-config.yaml | grep -A 10 "catalog:"

# Refresh catalog
curl -X POST http://localhost:3000/api/catalog/refresh

GitLab integration issues?

  • Verify token: echo $GITLAB_TOKEN
  • Check token scopes: api, read_repository, write_repository
  • Test GitLab API: curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/user

Backstage setup script fails?

Run manually:

# Find Backstage
ls -la ~ | grep backstage

# Copy files manually
BACKSTAGE_PATH="/path/to/your/backstage"
cp -r backstage-golden-path/* $BACKSTAGE_PATH/templates/aws-infrastructure-golden-path/

πŸ“š Additional Resources

AWS Documentation

Backstage Documentation

GitLab CI/CD

Terraform

🀝 Support & Contribution

For questions or issues:

  1. Check the detailed documentation in each folder
  2. Review the troubleshooting sections
  3. Consult the official documentation links above

πŸ“ Notes

  • The backstage-template-content/ folder contains the original template files (kept for reference)
  • The backstage-golden-path/ folder is the active, ready-to-use template
  • All scripts are tested on macOS and Amazon Linux 2

πŸŽ‰ Ready to Build!

Start by running:

cd backstage-golden-path
./setup.sh

Happy infrastructure provisioning! πŸš€