Skip to content

Commit c7dcb0f

Browse files
Merge branch 'main' into data-platform-api
2 parents a0cd98c + 35ea9c0 commit c7dcb0f

File tree

2 files changed

+95
-3
lines changed

2 files changed

+95
-3
lines changed

terraform/nowcasting/development/main.tf

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is the main terraform code for the UK platform. It is used to deploy the pl
99
0.5 - S3 bucket for forecasters
1010
0.6 - Database
1111
1.1 - API
12+
1.2 - UK-National API
1213
2.1 - NWP Consumer Secret
1314
2.2 - Satellite Consumer Secret
1415
2.3 - PV Secret
@@ -17,10 +18,11 @@ This is the main terraform code for the UK platform. It is used to deploy the pl
1718
5.1 - PVSite database
1819
5.2 - PVSite API
1920
5.3 - PVSite ML bucket
20-
6.1 - Open Data PVnet
21-
7.0 - API Open Quartz Solar
21+
6.1 - Open Data PVnet (dev only)
22+
7.0 - API Open Quartz Solar (dev only)
2223
8.0 - Data Platform Database
2324
8.1 - Data Platform API
25+
9.0 - Primaries API
2426
2527
Variables used across all modules
2628
======*/
@@ -100,6 +102,7 @@ module "api" {
100102
{ "name" : "ADJUST_MW_LIMIT", "value" : "1000" },
101103
{ "name" : "N_HISTORY_DAYS", "value" : "2" },
102104
{ "name" : "ENVIRONMENT", "value" : local.environment },
105+
{ "name" : "APITALLY_CLIENT_ID", "value" : var.apitally_client_id},
103106
]
104107
container-name = "nowcasting_api"
105108
container-tag = var.api_version
@@ -114,6 +117,41 @@ module "api" {
114117
max_ec2_count = 2
115118
}
116119

120+
# 1.2
121+
module "uk-national-quartz-api" {
122+
source = "../../modules/services/eb_app"
123+
domain = local.domain
124+
aws-region = var.region
125+
aws-environment = local.environment
126+
aws-subnet_id = module.networking.public_subnet_ids[0]
127+
aws-vpc_id = module.networking.vpc_id
128+
container-command = ["quartz-api"]
129+
container-env_vars = [
130+
{ "name" : "SOURCE", "value" : "dataplatform" },
131+
{ "name" : "ROUTERS", "value" : "uk_national" },
132+
{ "name" : "PORT", "value" : "80" },
133+
{ "name" : "SENTRY_DSN", "value" : var.sentry_dsn_api },
134+
{ "name" : "ENVIRONMENT", "value": local.environment},
135+
{ "name" : "DATA_PLATFORM_HOST", "value": module.data_platform_api.api_url},
136+
{ "name" : "DATA_PLATFORM_PORT", "value": "50051"},
137+
{ "name" : "AUTH0_DOMAIN", "value" : var.auth_domain },
138+
{ "name" : "AUTH0_AUDIENCE", "value" : var.auth_api_audience },
139+
{ "name" : "AUTH0_RULE_NAMESPACE", "value" : "https://openclimatefix.org"},
140+
{ "name" : "AUTH0_CLIENT_ID", "value": var.auth_client_id},
141+
{ "name" : "APITALLY_CLIENT_ID", "value" : var.apitally_client_id},
142+
# legacy, we shouldnt need this in the future,
143+
# but we need this for status in the mean time
144+
{ "name" : "DB_URL", "value" : module.database.forecast-database-secret-url },
145+
{ "name" : "HOST_URL", "value":"http://uk-development-uk-national-quartz-api.eu-west-1.elasticbeanstalk.com"}
146+
]
147+
container-name = "quartz-api"
148+
container-tag = var.uk-national-quartz-api
149+
container-registry = "ghcr.io/openclimatefix"
150+
eb-app_name = "uk-national-quartz-api"
151+
s3_bucket = []
152+
}
153+
154+
117155
# 2.1
118156
resource "aws_secretsmanager_secret" "nwp_consumer_secret" {
119157
name = "${local.environment}/data/nwp-consumer"
@@ -317,3 +355,35 @@ module "data_platform_api" {
317355
elbscheme="internal"
318356
elb_ports=["80","50051"]
319357
}
358+
359+
360+
# 9.0 Primaries API
361+
module "quartz-api" {
362+
source = "../../modules/services/eb_app"
363+
domain = local.domain
364+
aws-region = var.region
365+
aws-environment = local.environment
366+
aws-subnet_id = module.networking.public_subnet_ids[0]
367+
aws-vpc_id = module.networking.vpc_id
368+
container-command = ["quartz-api"]
369+
container-env_vars = [
370+
{ "name" : "SOURCE", "value" : "dataplatform" },
371+
{ "name" : "ROUTERS", "value" : "substations" },
372+
{ "name" : "PORT", "value" : "80" },
373+
{ "name" : "DB_URL", "value" : module.database.forecast-database-secret-url },
374+
{ "name" : "AUTH0_DOMAIN", "value" : var.auth_domain },
375+
{ "name" : "AUTH0_AUDIENCE", "value" : var.auth_api_audience },
376+
{ "name" : "AUTH0_CLIENT_ID", "value": var.auth_client_id},
377+
{ "name" : "SENTRY_DSN", "value" : var.sentry_dsn_api },
378+
{ "name" : "ENVIRONMENT", "value": local.environment},
379+
{ "name" : "DATA_PLATFORM_HOST", "value": module.data_platform_api.api_url},
380+
{ "name" : "DATA_PLATFORM_PORT", "value": "50051"},
381+
{ "name" : "APITALLY_CLIENT_ID", "value" : var.apitally_client_id},
382+
{ "name" : "HOST_URL", "value":"http://uk-development-quartz-api.eu-west-1.elasticbeanstalk.com"}
383+
]
384+
container-name = "quartz-api"
385+
container-tag = var.quartz-api
386+
container-registry = "ghcr.io/openclimatefix"
387+
eb-app_name = "quartz-api"
388+
s3_bucket = []
389+
}

terraform/nowcasting/development/variables.tf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ variable "airflow_auth_username" {
3838
default = "not-set"
3939
}
4040

41+
variable "auth_client_id" {
42+
description = "The Auth client id that should be used"
43+
default = "not-set"
44+
}
45+
4146
variable "airflow_auth_password" {
4247
description = "The Auth username for airflow that should be used"
4348
default = "not-set"
@@ -86,4 +91,21 @@ variable "data_platform_api_version" {
8691
type = string
8792
description = "Docker verions for the data platform api"
8893
default = "update-build-location"
89-
}
94+
}
95+
96+
variable "quartz-api" {
97+
type = string
98+
description = "Docker image tag for the quartz api"
99+
default = "0.3.4"
100+
}
101+
102+
variable "uk-national-quartz-api" {
103+
type = string
104+
description = "Docker image tag for the uk national quartz api"
105+
default = "0.3.4"
106+
}
107+
108+
variable "apitally_client_id" {
109+
description = "The client id for APItally"
110+
default = ""
111+
}

0 commit comments

Comments
 (0)