Skip to content

Commit 939577f

Browse files
add data platform to uk-prod (#935)
* add data platform to uk * add data-platform to dashboard
1 parent c9b67f0 commit 939577f

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

terraform/nowcasting/production/main.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ This is the main terraform code for the UK platform. It is used to deploy the pl
1616
5.1 - PVSite database
1717
5.2 - PVSite API
1818
5.3 - PVSite ML bucket
19+
6.0 - Data Platform Database
20+
6.1 - Data Platform API
1921
2022
Variables used across all modules
2123
======*/
@@ -170,6 +172,7 @@ module "analysis_dashboard" {
170172
{ "name" : "REGION", "value": local.domain},
171173
{ "name" : "ENVIRONMENT", "value": local.environment},
172174
{ "name" : "SENTRY_DSN", "value" : var.sentry_dsn },
175+
{ "name" : "DATA_PLATFORM_HOST", "value": module.data_platform_api.api_url},
173176
]
174177
container-name = "analysis-dashboard"
175178
container-tag = var.internal_ui_version
@@ -238,3 +241,41 @@ module "pvsite_ml_bucket" {
238241
lifecycled_prefixes = []
239242
}
240243

244+
# 6.0 Data Platform - Database
245+
module "data_platform_database" {
246+
source = "github.com/openclimatefix/ocf-infrastructure//terraform/modules/storage/postgres?ref=23f3802"
247+
region = var.region
248+
environment = local.environment
249+
db_subnet_group_name = module.networking.private_subnet_group_name
250+
vpc_id = module.networking.vpc_id
251+
db_name = "dataplatform"
252+
rds_instance_class = "db.t3.small"
253+
allow_major_version_upgrade = true
254+
}
255+
256+
# 6.1 Data Platform - API
257+
module "data_platform_api" {
258+
source = "github.com/openclimatefix/ocf-infrastructure//terraform/modules/services/eb_app?ref=23f3802"
259+
domain = local.domain
260+
aws-region = var.region
261+
aws-environment = local.environment
262+
aws-subnet_id = module.networking.private_subnet_ids[0]
263+
aws-vpc_id = module.networking.vpc_id
264+
container-command = ["/dp-server"]
265+
container-env_vars = [
266+
{ "name" : "DATABASE_URL", "value" : module.data_platform_database.default_db_connection_url },
267+
{ "name" : "LOGLEVEL", "value" : "DEBUG" },
268+
]
269+
container-name = "data-platform"
270+
container-tag = var.data_platform_api_version
271+
container-registry = "ghcr.io/openclimatefix"
272+
eb-app_name = "data-platform-api"
273+
eb-instance_type = "t3.micro"
274+
s3_bucket = []
275+
container-port-mappings = [
276+
{"host":"50051", "container": "50051"},
277+
{"host":"80", "container": "50051"},
278+
]
279+
elbscheme="internal"
280+
elb_ports=["80","50051"]
281+
}

terraform/nowcasting/production/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ variable "airflow_url" {
7171
default = "not-set"
7272
}
7373

74+
variable "data_platform_api_version" {
75+
type = string
76+
description = "Docker verions for the data platform api"
77+
default = "0.15.0"
78+
}
7479

7580
variable "apitally_client_id" {
7681
description = "The client id for APItally"

0 commit comments

Comments
 (0)