Skip to content

Docker Compose updates and initial bootstrap script #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
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
- [email protected]
- 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 [email protected]:Developer-DAO/rpc.git /opt/rpc
cd /opt/rpc

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

docker compose up -d