Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CZID-8461] Start happy setup #75

Merged
merged 10 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added entities/.env.ecr
Empty file.
63 changes: 63 additions & 0 deletions entities/.happy/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"default_env": "dev",
"app": "entities",
"default_compose_env_file": ".env.ecr",
"environments": {
"dev": {
"aws_profile": "idseq-dev",
"aws_region": "us-west-2",
"k8s": {
"namespace": "czid-dev-happy-happy-env",
"cluster_id": "czid-dev-eks",
"auth_method": "eks"
},
"terraform_directory": ".happy/terraform/envs/dev",
"task_launch_type": "k8s"
},
"staging": {
"aws_profile": "idseq-dev",
"aws_region": "us-west-2",
"k8s": {
"namespace": "czid-staging-happy-happy-env",
"cluster_id": "czid-staging-eks",
"auth_method": "eks"
},
"terraform_directory": ".happy/terraform/envs/staging",
"task_launch_type": "k8s"
}
},
"services": [
"entities"
],
"features": {
"enable_dynamo_locking": true,
"enable_happy_api_usage": true,
"enable_ecr_auto_creation": true
},
"api": {},
"stack_defaults": {
"create_dashboard": false,
"routing_method": "CONTEXT",
"services": {
"entities": {
"build": {
"context": ".",
"dockerfile": "Dockerfile"
},
"health_check_path": "/graphql",
"name": "entities",
"memory": "1000Mi",
"cpu": "2",
"platform_architecture": "arm64",
"port": 8008,
"service_type": "INTERNAL"
}
},
"stack_defaults": "[email protected]:chanzuckerberg/happy//terraform/modules/happy-stack-eks?ref=main"
},
"tasks": {
"migrate": [
"migrate"
]
}
}
43 changes: 43 additions & 0 deletions entities/.happy/terraform/envs/dev/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
module "stack" {
source = "[email protected]:chanzuckerberg/happy//terraform/modules/happy-stack-eks?ref=main"
image_tag = var.image_tag
stack_name = var.stack_name
k8s_namespace = var.k8s_namespace
image_tags = jsondecode(var.image_tags)
stack_prefix = "/${var.stack_name}"
app_name = var.app
deployment_stage = "dev"
additional_env_vars = {
CERBOS_URL="http://cerbos:3592"
JWK_PUBLIC_KEY_FILE="/czid-platformics/entities/test_infra/fixtures/public_key.pem"
JWK_PRIVATE_KEY_FILE="/czid-platformics/entities/test_infra/fixtures/private_key.pem"
DEFAULT_UPLOAD_BUCKET="local-bucket"
BOTO_ENDPOINT_URL="http://motoserver.czidnet:4000"
AWS_REGION="us-west-2"
}
services = {
entities = {
health_check_path = "/graphql"
cpu = "2" # TODO: right size this as necessary
memory = "1000Mi" # TODO: right size this as necessary
name = "entities"
platform_architecture = "arm64"
port = 8008
service_type = "INTERNAL"
}
}
create_dashboard = false
routing_method = "CONTEXT"

tasks = {
# TODO: Fix migrate task to run properly post-deployment
migrate = {
image = "{entities}:${var.image_tag}"
memory = "1000Mi"
cpu = "100m"
cmd = ["/czid-platformics/entities/scripts/migrate.sh"]
}
}
}
20 changes: 20 additions & 0 deletions entities/.happy/terraform/envs/dev/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
output "dashboard" {
sensitive = false
value = module.stack.dashboard
}
output "service_ecrs" {
sensitive = false
value = module.stack.service_ecrs
}
output "service_endpoints" {
description = "The URL endpoints for services"
sensitive = false
value = module.stack.service_endpoints
}
output "task_arns" {
description = "ARNs for all the tasks"
sensitive = false
value = module.stack.task_arns
}
45 changes: 45 additions & 0 deletions entities/.happy/terraform/envs/dev/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
provider "aws" {
region = "us-west-2"
assume_role {
role_arn = "arn:aws:iam::${var.aws_account_id}:role/${var.aws_role}"
}
allowed_account_ids = ["${var.aws_account_id}"]
}
provider "aws" {
alias = "czi-si"
region = "us-west-2"
assume_role {
role_arn = "arn:aws:iam::626314663667:role/tfe-si"
}
allowed_account_ids = ["626314663667"]
}
data "aws_eks_cluster" "cluster" {
name = var.k8s_cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = var.k8s_cluster_id
}
provider "kubernetes" {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
}
data "kubernetes_namespace" "happy-namespace" {
metadata {
name = var.k8s_namespace
}
}
data "aws_ssm_parameter" "dd_app_key" {
name = "/shared-infra-prod-datadog/app_key"
provider = aws.czi-si
}
data "aws_ssm_parameter" "dd_api_key" {
name = "/shared-infra-prod-datadog/api_key"
provider = aws.czi-si
}
provider "datadog" {
app_key = data.aws_ssm_parameter.dd_app_key.value
api_key = data.aws_ssm_parameter.dd_api_key.value
}
35 changes: 35 additions & 0 deletions entities/.happy/terraform/envs/dev/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
variable "aws_account_id" {
type = string
description = "AWS account ID to apply changes to"
}
variable "k8s_cluster_id" {
type = string
description = "EKS K8S Cluster ID"
}
variable "k8s_namespace" {
type = string
description = "K8S namespace for this stack"
}
variable "aws_role" {
type = string
description = "Name of the AWS role to assume to apply changes"
}
variable "image_tag" {
type = string
description = "Please provide an image tag"
}
variable "image_tags" {
type = string
description = "Override the default image tags (json-encoded map)"
default = "{}"
}
variable "stack_name" {
type = string
description = "Happy Path stack name"
}
variable "app" {
type = string
description = "Happy App Name"
}
23 changes: 23 additions & 0 deletions entities/.happy/terraform/envs/dev/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
terraform {
required_version = ">= 1.3"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.14"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.20"
}
datadog = {
source = "datadog/datadog"
version = ">= 3.25.0"
}
happy = {
source = "chanzuckerberg/happy"
version = ">= 0.82.1"
}
}
}
26 changes: 26 additions & 0 deletions entities/.happy/terraform/envs/staging/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
module "stack" {
source = "[email protected]:chanzuckerberg/happy//terraform/modules/happy-stack-eks?ref=main"
image_tag = var.image_tag
stack_name = var.stack_name
k8s_namespace = var.k8s_namespace
image_tags = jsondecode(var.image_tags)
stack_prefix = "/${var.stack_name}"
app_name = var.app
deployment_stage = "staging"
services = {
entities = {
health_check_path = "/graphql/"
name = "entities"
path = "/graphql/*"
platform_architecture = "arm64"
port = 8008
priority = 0
service_type = "PRIVATE"
success_codes = "200-499"
}
}
create_dashboard = false
routing_method = "CONTEXT"
}
20 changes: 20 additions & 0 deletions entities/.happy/terraform/envs/staging/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
output "dashboard" {
sensitive = false
value = module.stack.dashboard
}
output "service_ecrs" {
sensitive = false
value = module.stack.service_ecrs
}
output "service_endpoints" {
description = "The URL endpoints for services"
sensitive = false
value = module.stack.service_endpoints
}
output "task_arns" {
description = "ARNs for all the tasks"
sensitive = false
value = module.stack.task_arns
}
45 changes: 45 additions & 0 deletions entities/.happy/terraform/envs/staging/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
provider "aws" {
region = "us-west-2"
assume_role {
role_arn = "arn:aws:iam::${var.aws_account_id}:role/${var.aws_role}"
}
allowed_account_ids = ["${var.aws_account_id}"]
}
provider "aws" {
alias = "czi-si"
region = "us-west-2"
assume_role {
role_arn = "arn:aws:iam::626314663667:role/tfe-si"
}
allowed_account_ids = ["626314663667"]
}
data "aws_eks_cluster" "cluster" {
name = var.k8s_cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = var.k8s_cluster_id
}
provider "kubernetes" {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
}
data "kubernetes_namespace" "happy-namespace" {
metadata {
name = var.k8s_namespace
}
}
data "aws_ssm_parameter" "dd_app_key" {
name = "/shared-infra-prod-datadog/app_key"
provider = aws.czi-si
}
data "aws_ssm_parameter" "dd_api_key" {
name = "/shared-infra-prod-datadog/api_key"
provider = aws.czi-si
}
provider "datadog" {
app_key = data.aws_ssm_parameter.dd_app_key.value
api_key = data.aws_ssm_parameter.dd_api_key.value
}
35 changes: 35 additions & 0 deletions entities/.happy/terraform/envs/staging/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
variable "aws_account_id" {
type = string
description = "AWS account ID to apply changes to"
}
variable "k8s_cluster_id" {
type = string
description = "EKS K8S Cluster ID"
}
variable "k8s_namespace" {
type = string
description = "K8S namespace for this stack"
}
variable "aws_role" {
type = string
description = "Name of the AWS role to assume to apply changes"
}
variable "image_tag" {
type = string
description = "Please provide an image tag"
}
variable "image_tags" {
type = string
description = "Override the default image tags (json-encoded map)"
default = "{}"
}
variable "stack_name" {
type = string
description = "Happy Path stack name"
}
variable "app" {
type = string
description = "Happy App Name"
}
23 changes: 23 additions & 0 deletions entities/.happy/terraform/envs/staging/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Auto-generated by 'happy infra'. Do not edit
# Make improvements in happy, so that everyone can benefit.
terraform {
required_version = ">= 1.3"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.14"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.20"
}
datadog = {
source = "datadog/datadog"
version = ">= 3.25.0"
}
happy = {
source = "chanzuckerberg/happy"
version = ">= 0.82.1"
}
}
}
Loading
Loading