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
33 changes: 19 additions & 14 deletions .bedrock/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# Proxy Router Foundation
# Proxy Router Infrastructure

Terraform/Terragrunt infrastructure for deploying Lumerin Proxy Router to AWS ECS across multiple environments.

## Overview

This repository manages the AWS infrastructure for the Lumerin Proxy Router and Validator services using Terraform and Terragrunt. The actual application code lives in the [proxy-router GitHub repository](https://github.com/lumerin-protocol/proxy-router).
This `.bedrock` directory contains the infrastructure code for the Lumerin Proxy Router and Validator services. The infrastructure is co-located with the application code in the [proxy-router](https://github.com/lumerin-protocol/proxy-router) repository.

This provides:
- Infrastructure as Code alongside application code in a single repository
- Visibility into infrastructure configuration for developers
- Slack notifications when infrastructure changes (see `.github/workflows/infra-update.yml`)

## Architecture

The deployment architecture consists of:

- **Source Code**: GitHub repository (`lumerin-protocol/proxy-router`)
- **Source Code & Infrastructure**: GitHub repository (`lumerin-protocol/proxy-router`)
- **Container Registry**: GitHub Container Registry (GHCR)
- **Infrastructure**: Terraform/Terragrunt (this repository)
- **Infrastructure**: Terraform/Terragrunt (this `.bedrock/` directory)
- **Deployment**: GitHub Actions with AWS OIDC authentication
- **Secrets**: AWS Secrets Manager
- **Compute**: AWS ECS Fargate
Expand Down Expand Up @@ -55,7 +60,8 @@ AWS ECS: Rolling Deployment with Circuit Breaker

1. **Clone the repository**
```bash
cd /path/to/proxy-router-foundation
git clone https://github.com/lumerin-protocol/proxy-router.git
cd proxy-router/.bedrock
```

2. **Configure AWS profiles**
Expand Down Expand Up @@ -100,7 +106,7 @@ GitHub Actions will automatically:
To update infrastructure (not application code):

```bash
cd 02-dev # or 03-stg, 04-lmn
cd .bedrock/02-dev # or 03-stg, 04-lmn
terragrunt plan
terragrunt apply
```
Expand Down Expand Up @@ -287,10 +293,10 @@ cd 02-dev # Choose appropriate environment
terragrunt destroy
```

## Repository Structure
## Directory Structure

```
.
.bedrock/
├── .ai-docs/ # Architecture documentation
├── .terragrunt/ # Terraform modules
│ ├── 00_*.tf # Variables, providers, data sources
Expand All @@ -305,22 +311,21 @@ terragrunt destroy
├── 03-stg/ # Staging environment
├── 04-lmn/ # Production environment
├── root.hcl # Terragrunt root config
└── README.md # This file
└── README.md # This documentation
```

## Support

For issues related to:
- **Infrastructure**: Create issue in this repository
- **Application Code**: Create issue in [proxy-router repository](https://github.com/lumerin-protocol/proxy-router)
- **Infrastructure or Application Code**: Create issue in [proxy-router](https://github.com/lumerin-protocol/proxy-router)
- **Deployment Issues**: Check GitHub Actions logs and ECS service events

## Contributing

1. Create feature branch
2. Make changes
1. Create feature branch from `dev`
2. Make changes (application code and/or infrastructure)
3. Test in development environment
4. Submit merge request
4. Submit pull request
5. Deploy to staging for validation
6. Deploy to production after approval

Expand Down
10 changes: 6 additions & 4 deletions .github/actions/slack-notify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ runs:
run: |
# Set environment emoji and label
case "$ENVIRONMENT" in
dev) ENV_EMOJI="🔧"; ENV_LABEL="DEV" ;;
stg) ENV_EMOJI="🧪"; ENV_LABEL="STG" ;;
main) ENV_EMOJI="🚀"; ENV_LABEL="PROD" ;;
*) ENV_EMOJI="📦"; ENV_LABEL="${ENVIRONMENT^^}" ;;
dev) ENV_EMOJI="🔧"; ENV_LABEL="DEV" ;;
stg) ENV_EMOJI="🧪"; ENV_LABEL="STG" ;;
main) ENV_EMOJI="🚀"; ENV_LABEL="PROD" ;;
infra|INFRA) ENV_EMOJI="🏗️"; ENV_LABEL="INFRA" ;;
*) ENV_EMOJI="📦"; ENV_LABEL="${ENVIRONMENT^^}" ;;
esac

# Set status emoji and color
Expand All @@ -103,6 +104,7 @@ runs:
failure) STATUS_EMOJI="❌"; COLOR="danger"; STATUS_TEXT="Deployment Failed" ;;
cancelled) STATUS_EMOJI="⚠️"; COLOR="warning"; STATUS_TEXT="Deployment Cancelled" ;;
skipped) STATUS_EMOJI="⏭️"; COLOR="#808080"; STATUS_TEXT="Skipped" ;;
updated) STATUS_EMOJI="📝"; COLOR="#4A90D9"; STATUS_TEXT="Code Updated" ;;
*) STATUS_EMOJI="ℹ️"; COLOR="#808080"; STATUS_TEXT="$STATUS" ;;
esac

Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/build-deploy-proxy-router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ on:

pull_request:
types: [opened, reopened, synchronize]
paths: [
'build.sh',
'docker-compose.yml',
'Dockerfile',
'**/*.go',
'**/*.ts',
'**/*.js',
'.github/workflows/build-deploy-proxy-router.yml']
branches:
- dev
paths:
- 'build.sh'
- 'docker-compose.yml'
- 'Dockerfile'
- '**/*.go'
- '**/*.ts'
- '**/*.js'
- '.github/workflows/build-deploy-proxy-router.yml'

concurrency:
group: ci-${{ github.ref }}
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/infra-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Infrastructure Update Notification

on:
push:
branches: [dev]
paths:
- '.bedrock/**'

defaults:
run:
shell: bash

jobs:
Notify-Infra-Update:
runs-on: ubuntu-latest
name: Notify Infrastructure Changes
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get changed files
id: changes
run: |
# Get list of changed files in .bedrock directory
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} -- .bedrock/ | head -10)
CHANGED_COUNT=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} -- .bedrock/ | wc -l | tr -d ' ')

# Build a compact list of changed paths
CHANGED_LIST=$(echo "$CHANGED_FILES" | sed 's/^/• `/' | sed 's/$/`/')

if [ "$CHANGED_COUNT" -gt 10 ]; then
CHANGED_LIST=$(printf "%s\n• _...and %d more files_" "$CHANGED_LIST" "$((CHANGED_COUNT - 10))")
fi

# Build the additional info markdown
INFO_TEXT=$(printf "*Changed Files (%s):*\n%s" "$CHANGED_COUNT" "$CHANGED_LIST")

# Use heredoc to preserve newlines in output
echo "info<<EOF" >> $GITHUB_OUTPUT
echo "$INFO_TEXT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Send Slack notification
uses: ./.github/actions/slack-notify
with:
status: 'updated'
environment: 'infra'
service_name: 'Infrastructure (Terraform)'
version: ${{ github.ref_name }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
github_token: ${{ secrets.GITHUB_TOKEN }}
additional_info: ${{ steps.changes.outputs.info }}
Loading