-
-
Notifications
You must be signed in to change notification settings - Fork 14
Incubator usage
The following documentation is a comprehensive list of steps to deploy incubator. The documentation includes:
- Software Installation Instructions
- Instructions to set up Incubator environment
- Using Terraform to deploy to Incubator
- Starting your own incubator
- Instructions for setting up Terragrunt # LEGACY
Find your corresponding platform here https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html and make sure to install CLI Version 2.
Confirm aws installation with aws --version
.
aws --version
<< aws-cli/2.13.27
- Sign in to the AWS console and create an Acess Key for your user following these instructions. Copy these keys for the next step. If you do not have an AWS account yet or receive an error when trying to create the key, reach out in the # ops slack channel for help. In these cases someone needs to make an account and give you the correct permissions before you can continue.
- Run the following command which will prompt you to fill in the Access Key and Secret Access Key that was copied from the previous step.
aws configure --profile hfla-incubator
//response
AWS Access Key ID [None]: <insert access key id>
AWS Secret Access Key [None]: <insert secret accesskey>
Default Region Name [None]: us-west-2
Default output format [None]: <press Enter for a default output>
- Verify with
aws sts --profile hfla-incubator get-caller-identity
You should see a response that looks like this:
{
"UserId": "ABCDEFGH12345",
"Account": "1234567891011",
"Arn": "arn:aws:iam::1234568791011:user/[email protected]"
}
The latest Terraform won't apply for incubator applications, instead Terraform version 0.15.1
needs to be installed. This assumes a package manager like Homebrew is installed.
brew update
brew install [email protected]
sudo apt-get update
sudo apt-get install terraform=0.15.1
Confirm installation with terraform --version
.
terraform --version
<< Terraform v0.15.1
<< on linux_amd64
Clone the incubator repo from here https://github.com/hackforla/incubator using preferred method.
git clone https://github.com/hackforla/incubator
export AWS_PROFILE=hfla-incubator
3.) Verify everything is ready for you to be able to develop your desired project with Terraform by running the following 3 commands:
cd terraform-incubator/{project}/{environment}
terraform init
terraform plan
You should get a response from the terraform plan that looks like this:
If you do, you're ready to develop. If you get an Error, post it in the # ops slack channel and ask for help. The error may be simply that your AWS Profile doesn't have the right permissions for the project you're working on which we're working on fixing across the board.
We're still in the process of migrating projects from Terragrunt to Terraform. If you need to work with the old configuration for whatever reason, there are extra configuration steps that you'll need to follow to get set up.
https://terragrunt.gruntwork.io/docs/getting-started/install/
brew update
brew install terragrunt
Confirm installation with terragrunt --version
terragrunt --version
terragrunt version v0.32.1
Every project will own their own project.hcl
file, in their devops 1password vault.
When they want to do deployment with it, the team's ops delegate will share it with the vault "Ops-project hcl files"
It should have a name similar to this: ctj_project.hcl - last updated 2022-07-20
After it's used by the ops team, it should be deleted from the ops team members local machine.
locals {
// General Variables
project_name = "project-name-here"
environment = "stage"
// ALB
aws_managed_dns = false
host_names = [""]
path_patterns = ["/*"]
// ECS
application_type = "fullstack"
launch_type = "FARGATE"
// RDS (Database)
postgres_database = {
// no RDS credentials here
// this is only for creating a new db
}
// Container variables
container_image = "035866691871.dkr.ecr.us-west-2.amazonaws.com/civictechjobs-fullstack-stage:latest"
desired_count = 1
container_port = 8000 // should match server used by application
container_memory = 512
container_cpu = 256
health_check_path = "/"
container_env_vars = {
// key : value
// any env variables necessary for the docker container_image
// RDS info here
}
}
Under /incubator
, select the corresponding environment to deploy to. For example, to deploy a Django application into Hack For LA's AWS account within a dev
environment, one should create a
incubator/project-dev/django-application-example
directory for the codebase.
project.hcl
helps provide environmental variables and configuration for the incubator deployed application. This file will have aspects such as the host_names, container settings, and health checks url routes.
There should also be a terragrunt.hcl
within the directory as well, but it doesn't need to be configured. This file will will copy the Terraform configurations specified by the source parameter, along with any files in the
working directory, into a temporary folder, and execute Terraform commands in that folder.
terragrunt init
terragrunt plan
terragrunt apply
After apply
one can examine AWS ECS console for activity.
To remove application from AWS ECS:
terragrunt destroy
-
AWS access/credentials
- It's recommended to have Administrator access to ensure proper permissions
- Documentation
-
Binaries
-
Hosted Zone in AWS Route53 via 2 methods
- Have a domain registered in AWS
- Configure Route53 as your DNS service
-
Terraform State and Lock files requires pre-created resources Documentation
- S3 Bucket for storing state file
- DynamoDB Table for storing lock files (recommended default: terraform-locks)
- see examples folder for how to properly set
-
Database Credentials for RDS Database, create file in
REPO_ROOT/incubator/rds.hcl
locals {
db_username="postgres"
db_password="super-secret-password"
}
- Documentation can be found in the incubator repository installation-instructions/documentation directory
- Topics
- Adding-Project.md
- Deploying-With-Incubator.md
- Getting-Started.md
- Installation-Instructions.md
- Known_Common_Errors.md
- Setting-Up-Incubator-Environment.md
- Topics