Giter VIP home page Giter VIP logo

backstage-terraform's Introduction

Backstage Terraform demo

This is your newly scaffolded Backstage App, Good Luck!

Local environment

To start the app, create your .env file from the .env.template file and insert these required env variables:

  • your AWS credentials
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
  • BUCKET_NAME: the name of the bucket for techdocs
  • GITHUB_TOKEN: your Github token to allow Backstage to connect to your repositories
  • your Github Oauth app for Backstage authentication:
    • AUTH_GITHUB_CLIENT_ID
    • AUTH_GITHUB_CLIENT_SECRET

Then run:

make

This will build the docker image and start the containers for the application and the database, after the build finishes you can visit the application at:

localhost:3000

Infrastructure

This demo uses Terraform to define and manage the AWS infrastructure that Backstage will use.
All the Terraform files are in the terraform directory, here's a list of the modules and the relative services:

  • vpc: 1 VPC, 2 subnets, 1 internet gateway and 1 route table
  • alb: 1 security group and 1 Application Load Balancer
  • rds: 1 security group and 1 RDS PostgreSQL instance
  • s3: 1 private bucket
  • ssm: 8 Parameter Store secrets
  • iam: 3 policies, 1 role
  • ecr: 1 ECR repository
  • ecs: 1 cluster, 1 Cloudwatch log group, 1 task definition and 1 service

AWS deploy

To deploy your Backstage application on AWS with Terraform you must first set these env variables:

  • TF_VAR_github_token
  • TF_VAR_github_client_id
  • TF_VAR_github_client_secret
  • TF_VAR_access_key_id
  • TF_VAR_secret_access_key

Then run make to build the Terraform container

To let Terraform work, you need to manually create an S3 bucket in which Terraform will save the state of your infrastructure.
Once created, save the bucket name by replacing the {{BUCKET-NAME}} placeholder in the terraform / terraform.tf file.

The setup is now complete. To deploy, enter the terraform container by typing make terraform-cli and then:

terraform init
terraform apply

As soon as Terraform is done, build your Backstage Docker image and push it on the Elastic Container Registry.
To build and tag the image run:

docker build . -f packages/backend/Dockerfile --tag backstage
docker tag backstage {{AWS-ACCOUNT-ID}}.dkr.ecr.eu-west-1.amazonaws.com/backstage-image:1.0.0

Then login on ECR with:

  aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin {{AWS-ACCOUNT-ID}}.dkr.ecr.eu-west-1.amazonaws.com

To push the image run:

docker push {{AWS-ACCOUNT-ID}}.dkr.ecr.eu-west-1.amazonaws.com/backstage-image:1.0.0

remember to replace {{AWS-ACCOUNT-ID}} with your AWS account id!

After that, you should wait a few minutes for ECS to be up and running, then you can visit the application by typing the URL of your Load Balancer.

Enjoy!

backstage-terraform's People

Contributors

francescoben avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.