Skip to content

Commit

Permalink
Format configs for devnet (#28)
Browse files Browse the repository at this point in the history
* feat: add relayer dockerfile and docker compose

* feat: expose relayer ports

* feat: add bridge ui Dockerfile and docker compose

* fix: update relayer port

* fix: update relayer db volume

* feat: add rng-tools to prevent crypto.randomUUID() error

* feat: add reverse proxy for bridge ui

* fix: update nginx build context

* feat: update docker compose to include nginx profile

* feat: add bridge ui workflow

* feat: update bridge ui adapter to node

* fix: remove nginx dockerfile

* fix: remove nginx depends on bridge ui and add nginx.conf to volume

* fix: adjust nginx volume mount

* fix: nginx redirects

* fix: proxy 32002 port as well

* fix: proxy 32002 to l1-rpc

* fix: remove 32002 port

* feat: update rpcs, relayer and block explore with proxy

* fix: rpc url var

* feat: add icons and update L1 blockexplore url

* feat: add l2-l1 processor and indexer

* feat: update rabbitmq volume

* feat: add bridge software for relayer

* feat: add l2-l1 bridge to bridge ui configs

* debug: chain id updated to 763374

* debug: disable bridge software

* debug: add confirmation for indexer

* debug: update chain id for brdge ui

* debug: update chain id for brdge ui chains

* debug: enable bridge software

* debug: update port to connect to taiko geth

* debug: revert bridge and relayer back to nethermind EL

* debug: add l2 relayer

* debug: disable bridge and close port for processor and indexer

* debug: update queue.prefetch and confirmations

* debug: add surge logo to devnet

* feat: prepare for devnet docs

* chore: clean up configs

---------

Co-authored-by: Denis Policastro <denis.policastro@gmail.com>
Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent dee959e commit a83642d
Show file tree
Hide file tree
Showing 16 changed files with 574 additions and 5 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/bridge-ui--docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Nethermind - Bridge UI - Docker build and push"

on:
workflow_dispatch:
push:
branches: [main]
tags:
- "bridge-ui-v*"
paths:
- "packages/bridge-ui/**"

env:
DOCKER_REGISTRY: nethermind.jfrog.io
DOCKER_USERNAME: core
DOCKER_REPOSITORY: core-oci-local-dev/bridge-ui

jobs:
build:
name: Build and push docker image
runs-on: ubuntu-latest
if: github.repository == 'NethermindEth/surge-taiko-mono'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.ARTIFACTORY_CORE_TOKEN_CONTRIBUTOR }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=sha
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: packages/bridge-ui
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Summary
run: |
echo "## Docker build completed :green_circle:" >> $GITHUB_STEP_SUMMARY
echo "### Tags" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r TAG; do
echo "- $TAG" >> $GITHUB_STEP_SUMMARY
done
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PACKAGE=eventindexer
ARG PACKAGE=relayer

FROM golang:1.23.0 as builder

Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export PUBLIC_GUIDE_URL=https://
export PUBLIC_TESTNET_NAME=""

# WalletConnect Project ID
export PUBLIC_WALLETCONNECT_PROJECT_ID=""
export PUBLIC_WALLETCONNECT_PROJECT_ID="Testnet"

# Enable NFT Bridge ("true" or "false")
export PUBLIC_NFT_BRIDGE_ENABLED=""
Expand Down
1 change: 0 additions & 1 deletion packages/bridge-ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ vite.config.js.timestamp-*
vite.config.ts.timestamp-*

# Bridge config files
/config/*
!/config/sample/
!/config/schemas/

Expand Down
42 changes: 42 additions & 0 deletions packages/bridge-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Step 1: Build the application
FROM node:20 AS builder

RUN npm install -g pnpm

WORKDIR /app

# Install dependencies
COPY package.json ./

# Install dependencies without the lock file, generating a new one
RUN pnpm install

# Copy the app source code and build
COPY . .

RUN cp .env.example .env

RUN pnpm export:config
RUN pnpm build

# Step 2: Set up the final production environment
FROM node:20

# Install pnpm globally
RUN npm install -g pnpm

WORKDIR /app

# Copy only necessary build files
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml ./
RUN pnpm install --prod

# Copy the build output
COPY --from=builder /app/build ./build

# Expose port
EXPOSE 3000

# Start the SvelteKit app
CMD ["node", "build"]
30 changes: 30 additions & 0 deletions packages/bridge-ui/config/configuredBridges.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"configuredBridges": [
{
"source": "3151908",
"destination": "763374",
"addresses": {
"bridgeAddress": "0x72bCbB3f339aF622c28a26488Eed9097a2977404",
"erc20VaultAddress": "0x38435Ac0E0e9Bd8737c476F8F39a24b0735e00dc",
"erc721VaultAddress": "0x9ECB6f04D47FA2599449AaA523bF84476f7aD80f",
"erc1155VaultAddress": "0xB29dB8A6b1C596B64f7E1dD5358d59Db73648E17",
"crossChainSyncAddress": "",
"signalServiceAddress": "0x00c042C4D5D913277CE16611a2ce6e9003554aD5",
"quotaManagerAddress": ""
}
},
{
"source": "763374",
"destination": "3151908",
"addresses": {
"bridgeAddress": "0x7633740000000000000000000000000000000001",
"erc20VaultAddress": "0x7633740000000000000000000000000000000002",
"erc721VaultAddress": "0x7633740000000000000000000000000000000003",
"erc1155VaultAddress": "0x7633740000000000000000000000000000000004",
"crossChainSyncAddress": "",
"signalServiceAddress": "0x7633740000000000000000000000000000000005",
"quotaManagerAddress": ""
}
}
]
}
54 changes: 54 additions & 0 deletions packages/bridge-ui/config/configuredChains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"configuredChains": [
{
"3151908": {
"name": "Kurtosis",
"type": "L1",
"icon": "https://cdn.worldvectorlogo.com/logos/ethereum-eth.svg",
"rpcUrls": {
"default": {
"http": [
"https://l1-rpc/"
]
}
},
"nativeCurrency": {
"name": "ETH",
"symbol": "ETH",
"decimals": 18
},
"blockExplorers": {
"default": {
"name": "Explorer 1",
"url": ""
}
}
}
},
{
"763374": {
"name": "Taiko",
"type": "L2",
"icon": "https://cdn.worldvectorlogo.com/logos/ethereum-eth.svg",
"rpcUrls": {
"default": {
"http": [
"https://l2-rpc/"
]
}
},
"nativeCurrency": {
"name": "TaikoETH",
"symbol": "tETH",
"decimals": 18
},
"blockExplorers": {
"default": {
"name": "Explorer 2",
"url": ""
}
}
}
}
]
}
2 changes: 2 additions & 0 deletions packages/bridge-ui/config/configuredCustomTokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
12 changes: 12 additions & 0 deletions packages/bridge-ui/config/configuredEventIndexer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configuredEventIndexer": [
{
"chainIds": [3151908, 763374],
"url": ""
},
{
"chainIds": [763374, 3151908],
"url": ""
}
]
}
12 changes: 12 additions & 0 deletions packages/bridge-ui/config/configuredRelayer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configuredRelayer": [
{
"chainIds": [3151908, 763374],
"url": "https://relayer:4102"
},
{
"chainIds": [763374, 3151908],
"url": "https://relayer:4102"
}
]
}
30 changes: 30 additions & 0 deletions packages/bridge-ui/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
bridge-ui:
build:
context: .
dockerfile: Dockerfile
container_name: bridge-ui
ports:
- "3000:3000"
profiles:
- bridge-ui
networks:
- app-network

nginx:
image: nginx:latest
container_name: nginx
ports:
- "80:80"
- "443:443"
profiles:
- nginx
networks:
- app-network
volumes:
- ./nginx/ssl:/etc/nginx/ssl:ro
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro

networks:
app-network:
driver: bridge
6 changes: 6 additions & 0 deletions packages/bridge-ui/nginx/generate-certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
mkdir -p ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout ssl/key.pem \
-out ssl/cert.pem \
-subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"
70 changes: 70 additions & 0 deletions packages/bridge-ui/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
server {
listen 80;
listen 443 ssl;
server_name devnet.domain;

ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;

# L1 RPC endpoint
location /l1-rpc/ {
proxy_pass http://172.17.0.1:32002/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

# L1 RPC block explorer
location /l1-blocksscout/ {
proxy_pass http://172.17.0.1:35001/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

# L2 RPC endpoint
location /l2-rpc/ {
proxy_pass http://172.17.0.1:8547/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

# Relayer endpoint
location /l1-relayer/ {
proxy_pass http://172.17.0.1:4102/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /l2-relayer/ {
proxy_pass http://172.17.0.1:4103/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

# Main application (should be last)
location / {
proxy_pass http://bridge-ui:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
2 changes: 1 addition & 1 deletion packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@playwright/test": "^1.43.1",
"@sveltejs/adapter-auto": "^3.2.0",
"@sveltejs/adapter-node": "5.2.9",
"@sveltejs/kit": "^2.5.21",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@types/debug": "^4.1.12",
Expand Down
6 changes: 5 additions & 1 deletion packages/bridge-ui/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
Expand All @@ -10,7 +10,11 @@ const config = {
kit: {
// https://kit.svelte.dev/docs/single-page-apps
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html',
precompress: false,
strict: true
}),
},
};
Expand Down
Loading

0 comments on commit a83642d

Please sign in to comment.