From 381890b6234cd2b91157eebf677fb39cbd5b050d Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Tue, 15 Sep 2020 07:38:54 -0700 Subject: [PATCH] updating for task def. --- buildspec.yml | 3 ++ src/clj/auto_ap/handler.clj | 3 +- taskdef.json | 84 +++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 taskdef.json diff --git a/buildspec.yml b/buildspec.yml index e1edb219..3480b101 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -19,6 +19,7 @@ phases: build: commands: - ./lein build + - cp taskdef.json target/ - echo Build started on `date` - echo Building the Docker image... - docker build -t $REPOSITORY_URI:latest . @@ -34,11 +35,13 @@ phases: artifacts: files: - auto-ap.jar + - taskdef.json base-directory: target secondary-artifacts: jar: files: - auto-ap.jar + - taskdef.json base-directory: target web: files: diff --git a/src/clj/auto_ap/handler.clj b/src/clj/auto_ap/handler.clj index e23a701c..2f072e63 100644 --- a/src/clj/auto_ap/handler.clj +++ b/src/clj/auto_ap/handler.clj @@ -25,7 +25,8 @@ [ring.middleware.gzip :refer [wrap-gzip]] [ring.util.response :as response])) -(defcredential (:aws-access-key-id env) (:aws-secret-access-key env) (:aws-region env)) +(when (:aws-access-key-id env) + (defcredential (:aws-access-key-id env) (:aws-secret-access-key env) (:aws-region env))) (defroutes static-routes (GET "/" [] (response/resource-response "index.html" {:root "public"})) diff --git a/taskdef.json b/taskdef.json new file mode 100644 index 00000000..1bfb4abd --- /dev/null +++ b/taskdef.json @@ -0,0 +1,84 @@ +{ + "taskDefinition": { + "taskDefinitionArn": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat-app:4", + "containerDefinitions": [ + { + "name": "integreat-app", + "image": "679918342773.dkr.ecr.us-east-1.amazonaws.com/integreat", + "cpu": 0, + "portMappings": [ + { + "containerPort": 3000, + "hostPort": 3000, + "protocol": "tcp" + }, + { + "containerPort": 9000, + "hostPort": 9000, + "protocol": "tcp" + } + ], + "essential": true, + "environment": [ + { + "name": "config", + "value": "/usr/local/config/staging.edn" + } + ], + "mountPoints": [], + "volumesFrom": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "/ecs/integreat-app", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "ecs" + } + } + } + ], + "family": "integreat-app", + "taskRoleArn": "arn:aws:iam::679918342773:role/datomic-ddb", + "executionRoleArn": "arn:aws:iam::679918342773:role/ecsTaskExecutionRole", + "networkMode": "awsvpc", + "revision": 4, + "volumes": [], + "status": "ACTIVE", + "requiresAttributes": [ + { + "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" + }, + { + "name": "ecs.capability.execution-role-awslogs" + }, + { + "name": "com.amazonaws.ecs.capability.ecr-auth" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" + }, + { + "name": "com.amazonaws.ecs.capability.task-iam-role" + }, + { + "name": "ecs.capability.execution-role-ecr-pull" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" + }, + { + "name": "ecs.capability.task-eni" + } + ], + "placementConstraints": [], + "compatibilities": [ + "EC2", + "FARGATE" + ], + "requiresCompatibilities": [ + "FARGATE" + ], + "cpu": "2048", + "memory": "4096" + } +}