Skip to content

Commit 30f1298

Browse files
save batches for india foreacst (#758)
* save batches for india foreacst * fix * upgrade version
1 parent 7045011 commit 30f1298

File tree

1 file changed

+63
-35
lines changed

1 file changed

+63
-35
lines changed

terraform/india/production/main.tf

Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# 1.3 - ECS Cluster
77
# 2.0 - S3 bucket for NWP data
88
# 2.1 - S3 bucket for Satellite data
9+
# 2.2 - S3 bucket for Forecast data
910
# 3.0 - Secret containing environment variables for the NWP consumer
1011
# 3.1 - Secret containing environment variables for the Satellite consumer
1112
# 3.2 - Secret containing HF read access
@@ -86,6 +87,16 @@ module "s3-satellite-bucket" {
8687
lifecycled_prefixes = ["data"]
8788
}
8889

90+
# 2.2
91+
module "s3-forecast-bucket" {
92+
source = "../../modules/storage/s3-private"
93+
environment = local.environment
94+
region = var.region
95+
domain = local.domain
96+
service_name = "forecast"
97+
lifecycled_prefixes = [""]
98+
}
99+
89100
# 3.0
90101
resource "aws_secretsmanager_secret" "nwp_consumer_secret" {
91102
name = "${local.environment}/data/nwp-consumer"
@@ -320,47 +331,59 @@ module "satellite_consumer_ecs" {
320331
}
321332

322333

323-
# 4.5 - Forecast - Client RU
334+
# 4.5 - Forecast - Client RUVNL
324335
module "forecast" {
325-
source = "github.com/openclimatefix/ocf-infrastructure//terraform/modules/services/forecast_generic?ref=f0ecf51"
326-
327-
region = var.region
328-
environment = local.environment
329-
app-name = "forecast"
330-
ecs_config = {
331-
docker_image = "openclimatefix/india_forecast_app"
332-
docker_version = var.version-forecast
333-
memory_mb = 4096
334-
cpu = 1024
335-
}
336-
rds_config = {
337-
database_secret_arn = module.postgres-rds.secret.arn
338-
database_secret_read_policy_arn = module.postgres-rds.secret-policy.arn
339-
}
340-
s3_nwp_bucket = {
341-
bucket_id = module.s3-nwp-bucket.bucket_id
342-
bucket_read_policy_arn = module.s3-nwp-bucket.read_policy_arn
343-
datadir = "ecmwf/data"
344-
}
345-
s3_satellite_bucket = {
346-
bucket_id = module.s3-satellite-bucket.bucket_id
347-
bucket_read_policy_arn = module.s3-satellite-bucket.read_policy_arn
348-
datadir = "data"
349-
}
336+
source = "github.com/openclimatefix/ocf-infrastructure//terraform/modules/services/ecs_task?ref=7045011"
350337

351-
// this isnt really needed
352-
s3_ml_bucket = {
353-
bucket_id = module.s3-nwp-bucket.bucket_id
354-
bucket_read_policy_arn = module.s3-nwp-bucket.read_policy_arn
355-
}
356-
loglevel = "INFO"
338+
aws-region = var.region
339+
aws-environment = local.environment
340+
341+
s3-buckets = [
342+
{
343+
id : module.s3-nwp-bucket.bucket_id,
344+
access_policy_arn : module.s3-nwp-bucket.read_policy_arn
345+
},
346+
{
347+
id : module.s3-forecast-bucket.bucket_id,
348+
access_policy_arn : module.s3-forecast-bucket.write_policy_arn
349+
}
350+
]
351+
352+
ecs-task_name = "forecast"
353+
ecs-task_type = "forecast"
357354
ecs-task_execution_role_arn = module.ecs-cluster.ecs_task_execution_role_arn
358-
sentry_dsn = var.sentry_dsn
355+
ecs-task_size = {
356+
memory = 3072
357+
cpu = 1024
358+
}
359+
360+
container-env_vars = [
361+
{ "name" : "AWS_REGION", "value" : var.region },
362+
{ "name" : "ENVIRONMENT", "value" : local.environment },
363+
{ "name" : "LOGLEVEL", "value" : "INFO" },
364+
{ "name" : "NWP_ECMWF_ZARR_PATH", "value": "s3://${module.s3-nwp-bucket.bucket_id}/ecmwf/data/latest.zarr" },
365+
{ "name" : "NWP_GFS_ZARR_PATH", "value": "s3://${module.s3-nwp-bucket.bucket_id}/gfs/data/latest.zarr" },
366+
{ "name" : "NWP_MO_GLOBAL_ZARR_PATH", "value": "s3://${module.s3-nwp-bucket.bucket_id}/metoffice/data/latest.zarr" },
367+
{ "name" : "SENTRY_DSN", "value": var.sentry_dsn},
368+
{ "name" : "USE_SATELLITE", "value": "False"},
369+
{ "name" : "SAVE_BATCHES_DIR", "value": "s3://${module.s3-forecast-bucket.bucket_id}/RUVNL"}
370+
]
371+
372+
container-secret_vars = [
373+
{secret_policy_arn: module.postgres-rds.secret.arn,
374+
values: ["DB_URL"]
375+
}
376+
]
377+
378+
container-tag = var.version-forecast
379+
container-name = "india_forecast_app"
380+
container-registry = "openclimatefix"
381+
container-command = []
359382
}
360383

361384
# 4.6 - Forecast - Client AD
362385
module "forecast-ad" {
363-
source = "github.com/openclimatefix/ocf-infrastructure//terraform/modules/services/ecs_task?ref=73255a4"
386+
source = "github.com/openclimatefix/ocf-infrastructure//terraform/modules/services/ecs_task?ref=7045011"
364387

365388
aws-region = var.region
366389
aws-environment = local.environment
@@ -373,6 +396,10 @@ module "forecast-ad" {
373396
{
374397
id : module.s3-nwp-bucket.bucket_id,
375398
access_policy_arn : module.s3-nwp-bucket.write_policy_arn
399+
},
400+
{
401+
id : module.s3-forecast-bucket.bucket_id,
402+
access_policy_arn : module.s3-forecast-bucket.write_policy_arn
376403
}
377404
]
378405

@@ -394,7 +421,8 @@ module "forecast-ad" {
394421
{ "name" : "SATELLITE_ZARR_PATH", "value": "s3://${module.s3-satellite-bucket.bucket_id}/data/latest/iodc_latest.zarr.zip" },
395422
{ "name" : "SENTRY_DSN", "value": var.sentry_dsn},
396423
{ "name" : "USE_SATELLITE", "value": "True"},
397-
{ "name" : "CLIENT_NAME", "value": "ad"}
424+
{ "name" : "CLIENT_NAME", "value": "ad"},
425+
{ "name" : "SAVE_BATCHES_DIR", "value": "s3://${module.s3-forecast-bucket.bucket_id}/ad"},
398426
]
399427

400428
container-secret_vars = [

0 commit comments

Comments
 (0)