diff --git a/.github/workflows/build_test_backend.yml b/.github/workflows/build_test_backend.yml index 05fbe9218..a013f8adf 100644 --- a/.github/workflows/build_test_backend.yml +++ b/.github/workflows/build_test_backend.yml @@ -15,7 +15,6 @@ jobs: docker-compose up --no-start api - name: Seed database and run API run: | - docker-compose run -e TESTING=True -e DEBUG=True api alembic upgrade head docker-compose up -d api - name: Run unit tests run: docker-compose run api pytest diff --git a/server/api/Pipfile.lock b/server/api/Pipfile.lock index 326eadbb6..a5d63a3b8 100644 --- a/server/api/Pipfile.lock +++ b/server/api/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "109488af8f5163751bc4a2dd2b25f50b65c77e31c950215d1c6c4f008bfab23e" + "sha256": "21278b1454e85f147beb3e49a8420944ff6e3b3d42c97cd11c1bc17944e76ee5" }, "pipfile-spec": 6, "requires": { @@ -328,58 +328,58 @@ }, "markupsafe": { "hashes": [ - "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", - "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", - "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", - "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", - "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", - "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f", - "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39", + "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1", "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", - "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014", - "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f", - "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", - "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", - "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", - "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", - "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", - "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", - "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", - "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85", - "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1", - "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", - "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", - "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621", "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850", - "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0", - "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", - "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", - "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7", + "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", + "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39", + "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2", + "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b", + "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be", "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f", + "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0", + "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1", - "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2", "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", - "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", - "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7", - "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8", + "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c", + "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85", "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193", - "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", - "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b", - "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f", "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", - "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5", - "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c", - "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032", - "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", - "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be", - "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621" + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.1.1" @@ -579,10 +579,10 @@ }, "pytz": { "hashes": [ - "sha256:16962c5fb8db4a8f63a26646d8886e9d769b6c511543557bc84e9569fb9a9cb4", - "sha256:180befebb1927b16f6b57101720075a984c019ac16b1b7575673bea42c6c3da5" + "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da", + "sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798" ], - "version": "==2020.5" + "version": "==2021.1" }, "pyyaml": { "hashes": [ @@ -658,28 +658,29 @@ }, "shapely": { "hashes": [ + "sha256:90a3e2ae0d6d7d50ff2370ba168fbd416a53e7d8448410758c5d6a5920646c1d", + "sha256:a5c3a50d823c192f32615a2a6920e8c046b09e07a58eba220407335a9cd2e8ea", + "sha256:6871acba8fbe744efa4f9f34e726d070bfbf9bffb356a8f6d64557846324232b", + "sha256:4f3c59f6dbf86a9fc293546de492f5e07344e045f9333f3a753f2dda903c45d1", + "sha256:4c10f317e379cc404f8fc510cd9982d5d3e7ba13a9cfd39aa251d894c6366798", + "sha256:791477edb422692e7dc351c5ed6530eb0e949a31b45569946619a0d9cd5f53cb", + "sha256:8e7659dd994792a0aad8fb80439f59055a21163e236faf2f9823beb63a380e19", "sha256:052eb5b9ba756808a7825e8a8020fb146ec489dd5c919e7d139014775411e688", - "sha256:1641724c1055459a7e2b8bbe47ba25bdc89554582e62aec23cb3f3ca25f9b129", + "sha256:6593026cd3f5daaea12bcc51ae5c979318070fefee210e7990cb8ac2364e79a1", "sha256:17df66e87d0fe0193910aeaa938c99f0b04f67b430edb8adae01e7be557b141b", + "sha256:b40cc7bb089ae4aa9ddba1db900b4cd1bce3925d2a4b5837b639e49de054784f", "sha256:182716ffb500d114b5d1b75d7fd9d14b7d3414cef3c38c0490534cc9ce20981a", + "sha256:a3774516c8a83abfd1ddffb8b6ec1b0935d7fe6ea0ff5c31a18bfdae567b4eba", + "sha256:617bf046a6861d7c6b44d2d9cb9e2311548638e684c2cd071d8945f24a926263", + "sha256:de618e67b64a51a0768d26a9963ecd7d338a2cf6e9e7582d2385f88ad005b3d1", + "sha256:8f15b6ce67dcc05b61f19c689b60f3fe58550ba994290ff8332f711f5aaa9840", + "sha256:46da0ea527da9cf9503e66c18bab6981c5556859e518fe71578b47126e54ca93", + "sha256:da38ed3d65b8091447dc3717e5218cc336d20303b77b0634b261bc5c1aa2bae8", + "sha256:e3afccf0437edc108eef1e2bb9cc4c7073e7705924eb4cd0bf7715cd1ef0ce1b", "sha256:2df5260d0f2983309776cb41bfa85c464ec07018d88c0ecfca23d40bfadae2f1", "sha256:35be1c5d869966569d3dfd4ec31832d7c780e9df760e1fe52131105685941891", - "sha256:46da0ea527da9cf9503e66c18bab6981c5556859e518fe71578b47126e54ca93", - "sha256:4c10f317e379cc404f8fc510cd9982d5d3e7ba13a9cfd39aa251d894c6366798", - "sha256:4f3c59f6dbf86a9fc293546de492f5e07344e045f9333f3a753f2dda903c45d1", "sha256:60e5b2282619249dbe8dc5266d781cc7d7fb1b27fa49f8241f2167672ad26719", - "sha256:6593026cd3f5daaea12bcc51ae5c979318070fefee210e7990cb8ac2364e79a1", - "sha256:6871acba8fbe744efa4f9f34e726d070bfbf9bffb356a8f6d64557846324232b", - "sha256:791477edb422692e7dc351c5ed6530eb0e949a31b45569946619a0d9cd5f53cb", - "sha256:8e7659dd994792a0aad8fb80439f59055a21163e236faf2f9823beb63a380e19", - "sha256:8f15b6ce67dcc05b61f19c689b60f3fe58550ba994290ff8332f711f5aaa9840", - "sha256:90a3e2ae0d6d7d50ff2370ba168fbd416a53e7d8448410758c5d6a5920646c1d", - "sha256:a3774516c8a83abfd1ddffb8b6ec1b0935d7fe6ea0ff5c31a18bfdae567b4eba", - "sha256:a5c3a50d823c192f32615a2a6920e8c046b09e07a58eba220407335a9cd2e8ea", - "sha256:b40cc7bb089ae4aa9ddba1db900b4cd1bce3925d2a4b5837b639e49de054784f", - "sha256:da38ed3d65b8091447dc3717e5218cc336d20303b77b0634b261bc5c1aa2bae8", - "sha256:de618e67b64a51a0768d26a9963ecd7d338a2cf6e9e7582d2385f88ad005b3d1", - "sha256:e3afccf0437edc108eef1e2bb9cc4c7073e7705924eb4cd0bf7715cd1ef0ce1b" + "sha256:1641724c1055459a7e2b8bbe47ba25bdc89554582e62aec23cb3f3ca25f9b129" ], "version": "==1.7.1" }, diff --git a/server/api/code/lacity_data_api/main.py b/server/api/code/lacity_data_api/main.py index 72a2fffb3..5b91c3fee 100644 --- a/server/api/code/lacity_data_api/main.py +++ b/server/api/code/lacity_data_api/main.py @@ -33,12 +33,12 @@ def get_app(): db.init_app(app) app.include_router(index.router) app.include_router(status.router, prefix="/status") - app.include_router(shim.router) app.include_router(councils.router, prefix="/councils") app.include_router(regions.router, prefix="/regions") app.include_router(request_types.router, prefix="/types") app.include_router(service_requests.router, prefix="/requests") app.include_router(geojson.router, prefix="/geojson") + app.include_router(shim.router, include_in_schema=DEBUG) app.add_middleware( CORSMiddleware, diff --git a/server/api/requirements.txt b/server/api/requirements.txt index 5ff5de08d..1977d1f44 100644 --- a/server/api/requirements.txt +++ b/server/api/requirements.txt @@ -51,7 +51,7 @@ python-dateutil==2.8.1 python-dotenv==0.15.0 python-editor==1.0.4 python-http-client==3.3.1 -pytz==2020.5 +pytz==2021.1 PyYAML==5.4.1 redis==3.5.3 requests==2.25.1 diff --git a/server/api/tests/integration/test_api_geojson.py b/server/api/tests/integration/test_api_geojson.py new file mode 100644 index 000000000..29e8733b1 --- /dev/null +++ b/server/api/tests/integration/test_api_geojson.py @@ -0,0 +1,7 @@ + +def test_api_geojson(client): + url = "/geojson" + response = client.get(url) + assert response.status_code == 200 + assert response.json()["type"] == "FeatureCollection" + assert len(response.json()["features"]) == 99 diff --git a/server/terraform/alb.tf b/server/terraform/alb.tf index bf833402f..be403e2cf 100644 --- a/server/terraform/alb.tf +++ b/server/terraform/alb.tf @@ -89,40 +89,3 @@ resource "aws_lb_target_group" "default" { unhealthy_threshold = 3 } } - -resource "aws_lb_target_group" "dev" { - name = "target-dev" - port = var.container_port - protocol = "HTTP" - deregistration_delay = 100 - target_type = "ip" - vpc_id = module.networked_rds.network_vpc_id - - health_check { - enabled = true - healthy_threshold = 5 - interval = 30 - path = var.health_check_path - port = "traffic-port" - protocol = "HTTP" - timeout = 10 - unhealthy_threshold = 3 - } -} - -# Adding host_based_weighted_routing for 2nd cluster -resource "aws_lb_listener_rule" "host_based_weighted_routing" { - listener_arn = aws_lb_listener.https.arn - priority = 99 - - action { - type = "forward" - target_group_arn = aws_lb_target_group.dev.arn - } - - condition { - host_header { - values = var.prd_host_header_values - } - } -} diff --git a/server/terraform/dev_cluster.tf b/server/terraform/dev_cluster.tf new file mode 100644 index 000000000..c1dfdff0e --- /dev/null +++ b/server/terraform/dev_cluster.tf @@ -0,0 +1,115 @@ + +resource "aws_lb_target_group" "dev" { + name = "target-dev" + port = var.container_port + protocol = "HTTP" + deregistration_delay = 100 + target_type = "ip" + vpc_id = module.networked_rds.network_vpc_id + + health_check { + enabled = true + healthy_threshold = 5 + interval = 30 + path = var.health_check_path + port = "traffic-port" + protocol = "HTTP" + timeout = 10 + unhealthy_threshold = 3 + } +} + +# Adding host_based_weighted_routing for 2nd cluster +resource "aws_lb_listener_rule" "host_based_weighted_routing" { + listener_arn = aws_lb_listener.https.arn + priority = 99 + + action { + type = "forward" + target_group_arn = aws_lb_target_group.dev.arn + } + + condition { + host_header { + values = ["dev-api.311-data.org"] + } + } +} + +data "template_file" "task_definition_dev" { + template = file("templates/task.json") + vars = { + # container_memory = var.container_memory + # container_cpu = var.container_cpu + container_port = var.container_port + # container_name = var.container_name + image_tag = "dev" + task_name = var.task_name + region = var.region + stage = "dev" + } +} + +data "template_file" "prefect_definition_dev" { + template = file("templates/prefect.json") + vars = { + # container_memory = var.container_memory + # container_cpu = var.container_cpu + # container_port = var.container_port + # container_name = var.container_name + image_tag = "dev" + task_name = var.task_name + region = var.region + stage = "dev" + } +} + +resource "aws_ecs_task_definition" "task_dev" { + family = "dev-${var.task_name}-server" + container_definitions = data.template_file.task_definition_dev.rendered + requires_compatibilities = ["FARGATE"] + network_mode = "awsvpc" + memory = var.container_memory + cpu = var.container_cpu + execution_role_arn = "arn:aws:iam::${var.account_id}:role/ecsTaskExecutionRole" +} + +resource "aws_ecs_service" "svc_dev" { + name = "dev-${var.task_name}-svc" + cluster = aws_ecs_cluster.cluster.id + task_definition = aws_ecs_task_definition.task_dev.arn + launch_type = "FARGATE" + desired_count = 1 + + load_balancer { + container_name = "311_data_api" + container_port = var.container_port + target_group_arn = aws_lb_target_group.dev.arn + } + + network_configuration { + subnets = module.networked_rds.network_public_subnet_ids + security_groups = [aws_security_group.svc.id, module.networked_rds.db_security_group_id, module.networked_rds.bastion_security_group_id] + assign_public_ip = true + } + + depends_on = [aws_lb.alb, aws_lb_listener.https, aws_ssm_parameter.secret] +} + +module "ecs_scheduled_task_dev" { + source = "git::https://github.com/tmknom/terraform-aws-ecs-scheduled-task.git?ref=tags/2.0.0" + name = "dev-${var.task_name}-nightly-update" + schedule_expression = "cron(0 8 * * ? *)" + container_definitions = data.template_file.prefect_definition_dev.rendered + cluster_arn = aws_ecs_cluster.cluster.arn + subnets = module.networked_rds.network_public_subnet_ids + security_groups = [aws_security_group.svc.id, module.networked_rds.db_security_group_id, module.networked_rds.bastion_security_group_id] + assign_public_ip = true + cpu = var.container_cpu + memory = var.container_memory + requires_compatibilities = ["FARGATE"] + create_ecs_events_role = false + ecs_events_role_arn = "arn:aws:iam::${var.account_id}:role/ecsEventsRole" + create_ecs_task_execution_role = false + ecs_task_execution_role_arn = "arn:aws:iam::${var.account_id}:role/ecsTaskExecutionRole" +} diff --git a/server/terraform/main.tf b/server/terraform/main.tf index 0910fbc30..e9b29024b 100644 --- a/server/terraform/main.tf +++ b/server/terraform/main.tf @@ -92,20 +92,6 @@ data "template_file" "task_definition" { } } -data "template_file" "task_definition_dev" { - template = file("templates/task.json") - vars = { - # container_memory = var.container_memory - # container_cpu = var.container_cpu - container_port = var.container_port - # container_name = var.container_name - image_tag = var.image_tag - task_name = var.task_name - region = var.region - stage = "dev" - } -} - data "template_file" "prefect_definition" { template = file("templates/prefect.json") vars = { @@ -120,20 +106,6 @@ data "template_file" "prefect_definition" { } } -data "template_file" "prefect_definition_dev" { - template = file("templates/prefect.json") - vars = { - # container_memory = var.container_memory - # container_cpu = var.container_cpu - # container_port = var.container_port - # container_name = var.container_name - image_tag = "dev" - task_name = var.task_name - region = var.region - stage = "dev" - } -} - resource "aws_ecs_task_definition" "task" { family = "${local.name}-server" container_definitions = data.template_file.task_definition.rendered @@ -144,16 +116,6 @@ resource "aws_ecs_task_definition" "task" { execution_role_arn = "arn:aws:iam::${var.account_id}:role/ecsTaskExecutionRole" } -resource "aws_ecs_task_definition" "task_dev" { - family = "dev-${var.task_name}-server" - container_definitions = data.template_file.task_definition_dev.rendered - requires_compatibilities = ["FARGATE"] - network_mode = "awsvpc" - memory = var.container_memory - cpu = var.container_cpu - execution_role_arn = "arn:aws:iam::${var.account_id}:role/ecsTaskExecutionRole" -} - resource "aws_ecs_service" "svc" { name = "${local.name}-svc" cluster = aws_ecs_cluster.cluster.id @@ -176,28 +138,6 @@ resource "aws_ecs_service" "svc" { depends_on = [aws_lb.alb, aws_lb_listener.https, aws_ssm_parameter.secret] } -resource "aws_ecs_service" "svc_dev" { - name = "dev-${var.task_name}--svc" - cluster = aws_ecs_cluster.cluster.id - task_definition = aws_ecs_task_definition.task_dev.arn - launch_type = "FARGATE" - desired_count = 1 - - load_balancer { - container_name = "311_data_api" - container_port = var.container_port - target_group_arn = aws_lb_target_group.dev.arn - } - - network_configuration { - subnets = module.networked_rds.network_public_subnet_ids - security_groups = [aws_security_group.svc.id, module.networked_rds.db_security_group_id, module.networked_rds.bastion_security_group_id] - assign_public_ip = true - } - - depends_on = [aws_lb.alb, aws_lb_listener.https, aws_ssm_parameter.secret] -} - # scheduled tasks use the same subnets and security groups as services module "ecs_scheduled_task" { source = "git::https://github.com/tmknom/terraform-aws-ecs-scheduled-task.git?ref=tags/2.0.0" diff --git a/server/terraform/variables.tf b/server/terraform/variables.tf index a24c8a276..6dcc96114 100644 --- a/server/terraform/variables.tf +++ b/server/terraform/variables.tf @@ -70,9 +70,3 @@ variable tags { default = {} type = map } - -variable prd_host_header_values { - type = list(string) - description = "List of one or more hostnames of the dev API to be used for ALB host header routing" - default = ["dev-api.311-data.org"] -}