Skip to content

Commit e015984

Browse files
committed
Add deployer type node to the codebase
1 parent cb4794b commit e015984

File tree

18 files changed

+1287
-2
lines changed

18 files changed

+1287
-2
lines changed

ansible/roles/dataiku-dss/files/dataiku-api-manager/dataiku_api_manager/main.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def main():
2525
system_config.load_system_config()
2626
dss_config = Config(
2727
aws_region=system_config.aws_settings["aws_region"],
28-
sub_categories=['api', 'design', 'automation'],
28+
sub_categories=['api', 'design', 'automation', 'deployer'],
2929
my_category=system_config.node_type
3030
)
3131
dss_config.load_data(system_config.get_config_data())
@@ -77,6 +77,8 @@ def main():
7777
if system_config.node_type == 'api':
7878
configurator.action_store_admin_api_token()
7979

80+
if system_config.node_type == 'deployer':
81+
configurator.action_store_admin_api_token()
8082

8183
if __name__ == "__main__":
8284
# execute only if run as a script
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Uncomment to retrieve PAT from AWS Parameter Store
2+
#data "aws_ssm_parameter" "github_pat" {
3+
# name = "/dss/github_personal_access_token"
4+
#}
5+
6+
# Uncomment to retrieve PAT from Hasihcorp Vault
7+
#data "vault_generic_secret" "github_pat" {
8+
# path = var.vault_path_github_api_key
9+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module "codebuild_automation" {
2+
source = "../../../../modules/codebuild-packer"
3+
# source = "osodevops/dataiku-dss/codebuild-packer#123456"
4+
additional_build_variables = { "NODE_TYPE": "deployer" }
5+
encrypt_ami = var.encrypt_ami
6+
kms_key_arn = var.kms_key_arn
7+
instance_type = var.packer_instance_type
8+
packer_file_location = var.packer_file_location
9+
project_name = var.project_name
10+
region = var.aws_region
11+
root_volume_size = var.root_volume_size
12+
shared_ami_users = var.shared_ami_users
13+
source_image_account_no = var.source_image_account_no
14+
source_image_name = var.source_image_name
15+
source_repository_url = var.source_repository_url
16+
subnet_name_filter = var.build_subnet_name_filter
17+
vpc_name = var.vpc_name
18+
# github_api_token = data.aws_ssm_parameter.github_pat.value # Uncomment to provide PAT from Parameter Store
19+
# github_api_token = data.vault_generic_secret.github_pat # Uncomment to provide PAT from Vault
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
provider "aws" {
2+
region = var.aws_region
3+
default_tags {
4+
tags = var.common_tags
5+
}
6+
}
7+
8+
#provider "vault" {
9+
# address = var.vault_address
10+
# auth_login {
11+
# path = "auth/${var.vault_env}/login"
12+
# method = "aws"
13+
# parameters = {
14+
# role = var.vault_role
15+
# }
16+
# }
17+
# skip_tls_verify = true
18+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = "~> 1.7.0"
3+
4+
backend "s3" {
5+
bucket = "MY-BUCKET-NAME"
6+
dynamodb_table = "MY-DYNAMODB-LOCKING-TABLE-tf-state-lock"
7+
region = "MY-AWS-REGION"
8+
key = "dss/codebuild/deployer/terraform.tfstate"
9+
encrypt = true
10+
}
11+
12+
required_providers {
13+
aws = {
14+
source = "hashicorp/aws"
15+
version = "~> 5.0"
16+
}
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# AWS region for resources
2+
aws_region = "YOUR-AWS-REGION"
3+
4+
# Name of the VPC subnets to use in building
5+
build_subnet_name_filter = "*Private*"
6+
7+
# Tags to add to all Terraform resources that support them
8+
common_tags = {
9+
Application = "CodeBuild"
10+
Environment = "tooling"
11+
Function = "Dataiku AMI building"
12+
Tooling = "Terraform"
13+
}
14+
15+
# Size and type of the instance used to build the image.
16+
packer_instance_type = "t3.xlarge"
17+
18+
# Name of the project as it will appear in CodeBuild
19+
project_name = "build-dss-ami-deployer"
20+
21+
# Volume size for the root partition during the build process
22+
root_volume_size = "40"
23+
24+
# Additional AWS account numbers to share the final AMI to
25+
shared_ami_users = ""
26+
27+
# Owning account of the source image
28+
source_image_account_no = "amazon"
29+
30+
# Name of the source image to base the DSS build on
31+
source_image_name = "amzn2-ami-hvm-*.*.*.*-*-gp2"
32+
33+
# Repository used to get the ansible and packer build code
34+
source_repository_url = "https://github.com/osodevops/terraform-aws-dataiku-platform"
35+
36+
# Name of the VPC to use for AMI builds
37+
vpc_name = "MY-VPC"
38+
39+
# Vault configuration
40+
# To enable vault as a store for the github token, uncomment vault blocks in these files:
41+
# - provider.tf
42+
# - data.tf
43+
# - main.tf
44+
vault_env = "MY-VAULT-ENVIRONMENT"
45+
vault_role = "MY-VAULT-ROLE"
46+
vault_address = "https://MY-VAULT-URL"
47+
vault_skip_tls = true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
variable "aws_region" {
2+
description = "The AWS region in which all resources will be created"
3+
type = string
4+
}
5+
6+
variable "build_subnet_name_filter" {
7+
description = "Used to filter by 'Name' tag for the subnets we will be building in"
8+
type = string
9+
default = "Private*"
10+
}
11+
12+
variable "common_tags" {
13+
description = "A collection of common tags to be added to resources."
14+
type = map(string)
15+
}
16+
17+
variable "encrypt_ami" {
18+
description = "Encrypt AMI after successful build."
19+
type = string
20+
default = false
21+
}
22+
23+
variable "kms_key_arn" {
24+
description = "If Encrypt_ami set to true then you must pass in the arn of the key you wish to encrypt disk with."
25+
type = string
26+
default = ""
27+
}
28+
29+
variable "packer_file_location" {
30+
description = "The file path of the .json packer to build."
31+
type = string
32+
default = "packer/dataiku-dss.json"
33+
}
34+
35+
variable "packer_instance_type" {
36+
description = "Instance type used by packer to build"
37+
type = string
38+
default = "m5a.2xlarge"
39+
}
40+
41+
variable "project_name" {
42+
description = "Name of the CodeBuild Project"
43+
type = string
44+
}
45+
46+
variable "root_volume_size" {
47+
description = "Specify the root volume size for the built image"
48+
type = string
49+
default = "150"
50+
}
51+
52+
variable "shared_ami_users" {
53+
description = "List of user accounts to share the built AMI with"
54+
type = string
55+
default = ""
56+
}
57+
58+
variable "source_image_account_no" {
59+
description = "Account number owning the source image for the packer build"
60+
type = string
61+
default = "amazon"
62+
}
63+
64+
variable "source_image_name" {
65+
description = "Name of an AMI to base the build on"
66+
type = string
67+
default = "amzn2-ami-hvm-*.*.*.*-*-gp2"
68+
}
69+
70+
variable "source_repository_url" {
71+
description = "The source repository for the packer and ansible build code"
72+
type = string
73+
}
74+
75+
variable "vpc_name" {
76+
description = "Name of the VPC we will be building in"
77+
type = string
78+
}
79+
80+
variable "vault_env" {
81+
description = "the vault environment variable."
82+
type = string
83+
}
84+
85+
variable "vault_role" {
86+
description = "the vault role to enable permissions to access the vault installation."
87+
type = string
88+
}
89+
90+
variable "vault_address" {
91+
description = "the vault host address pointing to the vault installation."
92+
type = string
93+
}
94+
95+
variable "vault_path_github_api_key" {
96+
description = "Vault path of the github api key secret"
97+
type = string
98+
default = ""
99+
}
100+
101+
variable "vault_skip_tls" {
102+
description = "Whether to skip TLS verification for simple Vault installations"
103+
type = bool
104+
default = true
105+
}

terraform/environments/common/dss/iam/terraform.tfvars

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ common_tags = {
66
}
77

88
# Creates security groups named "<item>-access" for use in cross-node access
9-
security_group_target_names = ["automation", "api", "design"]
9+
security_group_target_names = ["automation", "api", "design", "deployer"]
1010

1111
# The name (not ID) of the VPC we are deploying to
1212
vpc_name = "MY-VPC-NAME"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module "dss_design" {
2+
source = "../../../../modules/dss-node"
3+
ami_name_filter = var.ami_name_filter
4+
ami_owner_account = var.ami_owner_account
5+
asg_desired_capacity = var.asg_desired_capacity
6+
aws_region = var.aws_region
7+
cloudwatch_alarm_topic_name = var.cloudwatch_alarm_sns_topic_name
8+
data_volume_device_name = var.data_volume_device_name
9+
data_volume_encrypt = var.data_volume_encrypt
10+
data_volume_iops = var.data_volume_iops
11+
data_volume_kms_key = var.data_volume_kms_key
12+
data_volume_mount_point = var.data_volume_mount_point
13+
data_volume_size = var.data_volume_size
14+
data_volume_type = var.data_volume_type
15+
dlm_target_instance_tag = var.dlm_target_instance_tag
16+
dr_target_instance_tag = var.dr_target_instance_tag
17+
dss_node_type = var.dss_node_type
18+
dss_s3_config_bucket = var.dss_s3_config_bucket
19+
dss_s3_config_key = var.dss_s3_config_key
20+
dss_service_port = var.dss_service_port
21+
dss_service_protocol = var.dss_service_protocol
22+
environment = var.environment
23+
instance_allowed_ips = var.instance_allowed_ips
24+
instance_type = var.instance_type
25+
lb_allowed_ips = var.lb_allowed_ips
26+
lb_allow_security_groups = var.lb_allow_security_groups
27+
lb_certificate_arn = var.lb_certificate_arn
28+
lb_enable_load_balancer = var.lb_enable_load_balancer
29+
lb_enable_deletion_protection = var.lb_enable_deletion_protection
30+
lb_health_check_path = var.lb_health_check_path
31+
lb_health_check_port = var.lb_health_check_port
32+
lb_health_check_protocol = var.lb_health_check_protocol
33+
lb_health_check_response_code = var.lb_health_check_response_code
34+
lb_https_port = var.lb_https_port
35+
lb_internal = var.lb_internal
36+
lb_logs_s3_enabled = var.lb_logs_s3_enabled
37+
lb_log_s3_bucket_name = var.lb_log_s3_bucket_name
38+
private_subnet_name_filter = var.private_subnet_name_filter
39+
public_subnet_name_filter = var.public_subnet_name_filter
40+
r53_enable_private_zone = var.r53_enable_private_zone
41+
r53_enable_public_zone = var.r53_enable_public_zone
42+
r53_zone_name = var.r53_zone_name
43+
root_volume_size = var.root_volume_size
44+
s3_allow_instance_bucket = var.s3_allow_instance_bucket
45+
s3_create_instance_bucket = var.s3_create_instance_bucket
46+
s3_instance_bucket_name = var.s3_instance_bucket_name
47+
s3_session_logging_bucket_arn = var.s3_session_logging_bucket_arn
48+
ssh_key_name = var.ssh_key_name
49+
vpc_name = var.vpc_name
50+
}
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
provider "aws" {
2+
region = var.aws_region
3+
default_tags {
4+
tags = var.common_tags
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = "~> 1.7.0"
3+
4+
backend "s3" {
5+
bucket = "MY-BUCKET-NAME"
6+
dynamodb_table = "MY-DYNAMODB-LOCKING-TABLE-tf-state-lock"
7+
region = "MY-AWS-REGION"
8+
key = "dss/preprod/deployer/terraform.tfstate"
9+
encrypt = true
10+
}
11+
12+
required_providers {
13+
aws = {
14+
source = "hashicorp/aws"
15+
version = "~> 5.0"
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)