Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/target
.env
~/.config/nvim-data/undodir/

# Terraform state
*.tfstate
*.tfstate.*
crash.log
*.tfvars
*.tfvars.json
drift.log
.terraform/
.terraform.lock.hcl

# Local execution plan files
plan.out

# Sensitive files
*.pem
*.key
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,26 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"

ethereum:
image: ethereum/client-go:stable
ports:
- "8545:8545"
- "30303:30303"
command: --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3 --syncmode snap

dd_rpc:
image: ghcr.io/developer-dao/rpc:latest
ports:
- "8080:80"
environment:
- DATABASE_URL=postgresql://ddrpcdev:ddrpc123@postgres:5432/ddrpc
- ETHEREUM_ENDPOINT=http://ethereum:8545
- SMTP_USERNAME=fake@test.com
- SMTP_PASSWORD=TEST
- JWT_KEY=0cd8a9ca80c521ce59f4663bfc5379b7a4acc11c34d8852dfc9a71b6dba00985
depends_on:
- postgres
- ethereum

volumes:
postgres_data:
39 changes: 39 additions & 0 deletions infra/bootstrap/userdata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Runs on an Ubuntu 24.04 instance

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl build-essential -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

# Install Docker components
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

# Install Rust - this approach is interactive and will lock user data
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

# Get Github PAT to download image from private repo
export CR_PAT=""
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin

# Pull RPC image
docker pull ghcr.io/developer-dao/rpc:latest

# Clone repo
git clone git@github.com:Developer-DAO/rpc.git /opt/rpc
cd /opt/rpc

# Set up project
#cargo build
#cargo install openssl sqlx-cli

docker compose up -d
13 changes: 13 additions & 0 deletions infra/opentofu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# OpenTofu
This folder contains OpenTofu code that represents the AWS infrastructure as code (IaC).

## Download OpenTofu

## Basic Operations

## Apply Order
In order to build these resources in a new AWS account, run applies in each folder following the order below:
1. `vpc`
2. `rds`
3. `ecs`
4. `github-runners`
22 changes: 22 additions & 0 deletions infra/opentofu/ecs/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
terraform {
# backend "s3" { # TODO: Migrate to S3 when AWS account and S3 bucket is set up
# bucket = "dd-rpc-terraform-state"
# key = "ecs/terraform.tfstate"
# region = var.region
# encrypt = true
# }
backend "local" {}

required_version = ">= 1.0.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

provider "aws" {
region = var.region
}

8 changes: 8 additions & 0 deletions infra/opentofu/ecs/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
locals {
name = "rpc"
tags = {
TofuManaged = "true"
TofuState = "ecs"
Environment = "dev"
}
}
Loading