add env variables for dev EB deployment

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-29 11:00:31 -04:00
parent a81e83458d
commit 67f6c4c8be
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
5 changed files with 76 additions and 6 deletions

View File

@ -77,9 +77,13 @@ secrets:
echo "Saving secrets to: terraform.tfvars"
@echo "\
# secrets extracted from password-store\n\
aws_access_key = \"$(shell pass cloud/AWS/access-key)\"\n\
aws_secret_key = \"$(shell pass cloud/AWS/secret-key)\"\n\
gandi_api_token = \"$(shell pass cloud/Gandi/api-token)\"\n\
aws_access_key = \"$(shell pass cloud/AWS/access-key)\"\n\
aws_secret_key = \"$(shell pass cloud/AWS/secret-key)\"\n\
gandi_api_token = \"$(shell pass cloud/Gandi/api-token)\"\n\
dap_ps_admin_user = \"$(shell pass service/app/admin-user)\"\n\
dap_ps_admin_pass = \"$(shell pass service/app/admin-pass)\"\n\
dap_ps_smtp_user = \"$(shell pass cloud/AWS/ses/smtp-user)\"\n\
dap_ps_smtp_pass = \"$(shell pass cloud/AWS/ses/smtp-secret-key)\"\n\
" > terraform.tfvars
cleanup:

35
main.tf
View File

@ -64,6 +64,39 @@ resource "aws_key_pair" "admin" {
/* ENVIRONMENTS ---------------------------------*/
variable "dev_env" {
type = "map"
default = {
PORT = 4000
ENVIRONMENT = "DEV"
RATE_LIMIT_TIME = 15
/* Access */
ADMIN_USER = "${var.dap_ps_admin_use}"
ADMIN_PASSWORD = "${var.dap_ps_admin_use}"
/* BlockChain */
BLOCKCHAIN_CONNECTION_POINT = "wss://ropsten.infura.io/ws/v3/8675214b97b44e96b70d05326c61fd6a"
DISCOVER_CONTRACT = "0x17e7a7330d23fc6a2ab8578a627408f815396662"
MAX_REQUESTS_FOR_RATE_LIMIT_TIME = 1
/* IPFS */
IPFS_HOST = "ipfs.infura.io"
IPFS_PORT = 5001
IPFS_PROTOCOL = "https"
/* Email */
EMAIL_USER = "${dap_ps_smtp_user}"
EMAIL_PASSWORD = "${dap_ps_smtp_pass}"
EMAIL_HOST = "email-smtp.us-east-1.amazonaws.com"
EMAIL_PORT = 465
EMAIL_TLS = "true"
APPROVER_MAIL = "dapps-approvals@status.im"
APPROVE_NOTIFIER_MAIL = "dapps-approvals@status.im"
/* CloudWatch TODO */
CLOUDWATCH_ACCESS_KEY_ID = "This is for production, if you have logging set up (AWS Cloudwatch)"
CLOUDWATCH_REGION = "This is for production, if you have logging set up (AWS Cloudwatch)"
CLOUDWATCH_SECRET_ACCESS_KEY = "This is for production, if you have logging set up (AWS Cloudwatch)"
}
}
module "dev" {
source = "./modules/aws-eb-env"
name = "dev-dap-ps"
@ -75,6 +108,8 @@ module "dev" {
/* Scaling */
autoscale_min = 1
autoscale_max = 2
/* Environment */
env_vars = "${var.dev_env}"
}
module "prod" {

View File

@ -59,9 +59,10 @@ module "eb_environment" {
ssh_source_restriction = "0.0.0.0/0"
associate_public_ip_address = "true"
/* Hosting */
/* Application */
application_port = 4000
http_listener_enabled = "true"
env_vars = "${var.env_vars}"
/* Scaling */
instance_type = "t2.micro"

View File

@ -1,40 +1,54 @@
variable "name" {
description = "Name of this environment to be used in all resources."
type = "string"
}
variable "stage" {
description = "Name of stage, used for DNS entry for this environment."
type = "string"
}
variable "gandi_zone_id" {
description = "ID of the zone in Gandi DNS registrar."
type = "string"
}
variable "dns_domain" {
description = "Name of domain for this environment."
type = "string"
}
variable "stack_name" {
description = "Name of application stack for ElasticBeanstalk."
type = "string"
}
variable "keypair_name" {
description = "Name of the AWS key pair for SSH access."
type = "string"
}
variable "max_availability_zones" {
description = "Maximum number of availability zones that can be used in Subnet."
default = "2"
type = "string"
}
variable "env_vars" {
description = "Environment variables to be defined in the ElasticBeanstalk environment."
type = "map"
}
/* Scaling --------------------------------------*/
variable "autoscale_min" {
description = "Minimum instances autoscaling will create."
default = 1
default = "1"
type = "string"
}
variable "autoscale_max" {
description = "Maximum instances autoscaling will create."
default = 2
default = "2"
type = "string"
}

View File

@ -69,6 +69,22 @@ variable dap_ps_app_bucket_name {
default = "dev-dap-ps-app"
}
variable dap_ps_admin_user {
description = "Name of admin user for Dapp Store application."
}
variable dap_ps_admin_pass {
description = "Password for admin user for Dapp Store application."
}
variable dap_ps_smtp_user {
description = "User for accessing AWS SES SMTP endpoint."
}
variable dap_ps_smtp_pass {
description = "Password for accessing AWS SES SMTP endpoint."
}
/* SES FORWARDER --------------------------------*/
variable ses_forwarder_bucket_name {