File tree Expand file tree Collapse file tree 7 files changed +83
-61
lines changed Expand file tree Collapse file tree 7 files changed +83
-61
lines changed Original file line number Diff line number Diff line change 1
1
DATABASE_URL = postgres://ddrpcdev:[email protected] :5432/ddrpc
2
2
3
- SMTP_PASSWORD = test!
3
+ SMTP_PASSWORD = test!!
4
4
ETHEREUM_ENDPOINT = http://host.docker.internal:8545
5
5
JWT_KEY = <JWT>
Original file line number Diff line number Diff line change
1
+ name : Build and Deploy dd-rpc to ECS
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - dev
8
+ - ecs-cd
9
+
10
+ jobs :
11
+ build-and-deploy :
12
+ runs-on : ubuntu-latest
13
+ defaults :
14
+ run :
15
+ working-directory : infra/opentofu/ecs
16
+ env :
17
+ AWS_REGION : us-east-2
18
+ steps :
19
+ - name : Checkout code
20
+ uses : actions/checkout@v4
21
+
22
+ - name : Set up Docker Buildx
23
+ uses : docker/setup-buildx-action@v3
24
+
25
+ - name : Log in to GitHub Container Registry
26
+ uses : docker/login-action@v3
27
+ with :
28
+ registry : ghcr.io
29
+ username : ${{ github.actor }}
30
+ password : ${{ secrets.GITHUB_TOKEN }}
31
+
32
+ - name : Build and push dd-rpc image
33
+ uses : docker/build-push-action@v5
34
+ with :
35
+ context : .
36
+ file : ./Dockerfile
37
+ push : true
38
+ tags : ghcr.io/developer-dao/rpc:${{ github.sha }}
39
+
40
+ - name : Set up Terraform
41
+ uses : hashicorp/setup-terraform@v3
42
+ with :
43
+ terraform_version : 1.8.5
44
+
45
+ - name : Configure AWS credentials
46
+ uses : aws-actions/configure-aws-credentials@v4
47
+ with :
48
+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
49
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
50
+ aws-region : ${{ env.AWS_REGION }}
51
+
52
+ - name : Terraform Init
53
+ run : terraform init
54
+
55
+ - name : Terraform Plan
56
+ run : terraform plan -var="rpc_image=ghcr.io/developer-dao/rpc:${{ github.sha }}"
57
+
58
+ - name : Terraform Apply
59
+ run : terraform apply -auto-approve -var="rpc_image=ghcr.io/developer-dao/rpc:${{ github.sha }}"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
terraform {
2
- # backend "s3" { # TODO: Migrate to S3 when AWS account and S3 bucket is set up
3
- # bucket = "dd-rpc-terraform-state"
4
- # key = "ecs/terraform.tfstate"
5
- # region = var.region
6
- # encrypt = true
7
- # }
8
- backend "local" {}
2
+ backend "s3" {
3
+ bucket = " dd-test-rpc-terraform-state"
4
+ key = " ecs/terraform.tfstate"
5
+ region = " us-east-2"
6
+ encrypt = true
7
+ }
9
8
10
9
required_version = " >= 1.0.0"
11
10
required_providers {
Original file line number Diff line number Diff line change 1
1
# Reference VPC outputs from the vpc folder's state
2
2
# TODO: Migrate to S3 when AWS account and S3 bucket is set up
3
3
data "terraform_remote_state" "vpc" {
4
- backend = " local "
4
+ backend = " s3 "
5
5
config = {
6
- path = " ../vpc/terraform.tfstate"
6
+ bucket = " dd-test-rpc-terraform-state"
7
+ key = " vpc/terraform.tfstate"
8
+ region = " us-east-2"
7
9
}
8
10
}
9
11
@@ -85,7 +87,7 @@ module "ecs" {
85
87
cpu = 512
86
88
memory = 1024
87
89
essential = true
88
- image = " ghcr.io/developer-dao/rpc:latest "
90
+ image = var.rpc_image
89
91
port_mappings = [
90
92
{
91
93
name = " dd-rpc"
Original file line number Diff line number Diff line change @@ -2,4 +2,10 @@ variable "region" {
2
2
description = " The AWS region to deploy the VPC in."
3
3
default = " us-east-2"
4
4
type = string
5
+ }
6
+
7
+ variable "rpc_image" {
8
+ description = " The image tag or URI for the dd-rpc container."
9
+ type = string
10
+ default = " ghcr.io/developer-dao/rpc:latest"
5
11
}
Original file line number Diff line number Diff line change 1
1
terraform {
2
- # backend "s3" { # TODO: Migrate to S3 when AWS account and S3 bucket is set up
3
- # bucket = "dd-rpc-terraform-state"
4
- # key = "vpc/terraform.tfstate"
5
- # region = var.region
6
- # encrypt = true
7
- # }
8
- backend "local" {}
2
+ backend "s3" {
3
+ bucket = " dd-test-rpc-terraform-state"
4
+ key = " vpc/terraform.tfstate"
5
+ region = " us-east-2"
6
+ encrypt = true
7
+ }
9
8
10
9
required_version = " >= 1.0.0"
11
10
required_providers {
You can’t perform that action at this time.
0 commit comments