From 25c3fb76dd26cfbeecea2bc7d03ceeb8c64e5fce Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Tue, 29 Sep 2020 01:06:57 +0200 Subject: [PATCH] feat: Migrate to running gluon-lang.org in ECS Currently there is just lonely EC2 instance + cron script which tries to keep the server up and running. This isn't great as I need to ssh in to look at logs and the service only restarts once per day. By moving to ECS we get logs in cloudwatch, automatic restarts on crashes and we can setup alarms for any error cases. (Terraform is certainly overkill for this, but setting up a new terraform environment is good for learning, I already have a decent understanding of maintaining one so). cc https://github.com/gluon-lang/gluon/issues/881 --- .gitignore | 4 +++ terraform/iam.tf | 48 ++++++++++++++++++++++++++ terraform/network.tf | 33 ++++++++++++++++++ terraform/provider.tf | 4 +++ terraform/task.tf | 79 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 168 insertions(+) create mode 100644 terraform/iam.tf create mode 100644 terraform/network.tf create mode 100644 terraform/provider.tf create mode 100644 terraform/task.tf diff --git a/.gitignore b/.gitignore index ac5f1d3..1f01eec 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ node_modules target std try_gluon.env + +.terraform +**.tfstate* + diff --git a/terraform/iam.tf b/terraform/iam.tf new file mode 100644 index 0000000..ecc0766 --- /dev/null +++ b/terraform/iam.tf @@ -0,0 +1,48 @@ +resource "aws_iam_role" "ecs_task_execution_role" { + name = "gluon-lang" + + assume_role_policy = <