Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c2dd30a
Website/frontend: update links to GH repo for env vars to mina-rust
dannywillems Sep 25, 2025
505b92d
Node/build: allow populating compile vars from env file
dannywillems Sep 25, 2025
43f1e05
Frontend/environments: remove docker compose related env
dannywillems Sep 25, 2025
9f3d165
Frontend/environment: introduce default fuzzing.js
dannywillems Sep 25, 2025
999411b
Website/frontend: add doc for env config
dannywillems Sep 25, 2025
2fb125c
gitignore: ignore .env.docker
dannywillems Sep 25, 2025
be7fa7c
frontend/docker: update Dockerfile
dannywillems Sep 25, 2025
3c37423
frontend/Makefile: cp runtime conf + add corresponding build targets
dannywillems Sep 25, 2025
a9597d8
frontend/docker: revamp the dockerfile + update website accordingly
dannywillems Sep 25, 2025
972f8d8
frontend/env: add logging when loading cconfig
dannywillems Sep 25, 2025
716037d
frontend/index.html: rename openmina_node_web to mina_node_web
dannywillems Sep 25, 2025
c0ee25e
frontend/environment: setup a production env with o1Labs nodes
dannywillems Sep 25, 2025
ae3618b
frontend/index: log window.env to get the config
dannywillems Sep 25, 2025
6b924f3
frontend: fix Dockerfile and ignore Dockerfiles in node_modules
dannywillems Sep 25, 2025
b6d61b6
CI/frontend-docker: test all environments with frontend image
dannywillems Sep 25, 2025
f01daf5
Frontend: remove development related targets and tests
dannywillems Sep 29, 2025
66cdd02
frontend: rename webnodelocal into webnode-local
dannywillems Sep 29, 2025
c27e52b
Makefile/setup-wasm: install nightly as part of the target setup-wasm
dannywillems Sep 29, 2025
8c039c3
frontend/env-prod: remove graphql suffix
dannywillems Sep 29, 2025
b002168
ledger/circuit_blobs: remove old comments reg. download
dannywillems Sep 30, 2025
0eaf139
frontend/Dockerfile: fix copy of startup.sh
dannywillems Sep 30, 2025
0f0a405
CI/docker: remove config build_configuration
dannywillems Sep 30, 2025
18eb415
CI/docker: specify the Dockerfile to use
dannywillems Sep 30, 2025
7295eb6
CI/docker-frontend: download circuits
dannywillems Sep 30, 2025
c728e30
CI/docker: generate .env.docker
dannywillems Sep 30, 2025
92a35b7
Website/frontend: remove docker-compose related doc
dannywillems Sep 30, 2025
e399a67
docs: move leaderboard build scripts to separate files for CI testing
dannywillems Sep 30, 2025
dcc86a5
CI/frontend: remove path dependencies
dannywillems Sep 30, 2025
71cdfe2
frontend: simplify build targets and remove install target
dannywillems Sep 30, 2025
daa6e19
website/frontend: remove references to development.js
dannywillems Sep 30, 2025
0082ab2
website/frontend: remove wrong feature description for local dev
dannywillems Sep 30, 2025
c92c4ef
website/frontend: fix typo
dannywillems Sep 30, 2025
3beb7bb
docs: move webnode build scripts to separate files for CI testing
dannywillems Sep 30, 2025
390e8ad
docs: add Cypress testing dependencies documentation with OS-specific…
dannywillems Sep 30, 2025
4fd3ce9
frontend/config: remove useless comment
dannywillems Sep 30, 2025
33bffbf
CHANGELOG: add description for patch for 1473
dannywillems Sep 30, 2025
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
10 changes: 6 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ tools/heartbeats-processor/*.db
# Ensure .sqlx files are included
!tools/heartbeats-processor/.sqlx/

# Will be copied on demand in the Docker image, if necessary
circuit-blobs

# GH workflows
.claude
.github
Expand Down Expand Up @@ -65,6 +62,11 @@ tests.tsv

# The website must not be included
website
## Ignore some scripts that can be used in the Docker images.
## These scripts are used to be consistent with what is on the website and what
## is actually used.
!./website/docs/developers/scripts/frontend/install-nodejs-linux.sh
!./website/docs/developers/scripts/frontend/install-angular-cli.sh

# NPM related
node_modules
Expand All @@ -75,4 +77,4 @@ frontend/.gitignore
frontend/.vscode
frontend/dist/frontend
frontend/Dockerfile
frontend/node_modules
frontend/node_modules
38 changes: 24 additions & 14 deletions .github/actions/frontend-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ runs:
working-directory: frontend
shell: bash

# Test Makefile targets
# Test Makefile targets (alphabetical order)
- name: Test make build
if: inputs.test-build-commands == 'true'
run: |
Expand All @@ -58,13 +58,12 @@ runs:
working-directory: frontend
shell: bash


- name: Test make build-development
- name: Test make build-block-producers
if: inputs.test-build-commands == 'true'
run: |
rm -rf dist
make build-development
[ -d "dist/frontend" ] || { echo "Error: make build-development failed"; exit 1; }
make build-block-producers
[ -d "dist/frontend" ] || { echo "Error: make build-block-producers failed"; exit 1; }
working-directory: frontend
shell: bash

Expand All @@ -77,24 +76,25 @@ runs:
working-directory: frontend
shell: bash

- name: Test make build-local
- name: Test make build-leaderboard
if: inputs.test-build-commands == 'true'
run: |
rm -rf dist
make build-local
[ -d "dist/frontend" ] || { echo "Error: make build-local failed"; exit 1; }
make build-leaderboard
[ -d "dist/frontend" ] || { echo "Error: make build-leaderboard failed"; exit 1; }
working-directory: frontend
shell: bash

- name: Test make build-prod
- name: Test make build-local
if: inputs.test-build-commands == 'true'
run: |
rm -rf dist
make build-prod
[ -d "dist/frontend" ] || { echo "Error: make build-prod failed"; exit 1; }
make build-local
[ -d "dist/frontend" ] || { echo "Error: make build-local failed"; exit 1; }
working-directory: frontend
shell: bash


- name: Test make build-producer
if: inputs.test-build-commands == 'true'
run: |
Expand All @@ -113,15 +113,25 @@ runs:
working-directory: frontend
shell: bash

- name: Test make build-webnodelocal
- name: Test make build-staging
if: inputs.test-build-commands == 'true'
run: |
rm -rf dist
make build-webnodelocal
[ -d "dist/frontend" ] || { echo "Error: make build-webnodelocal failed"; exit 1; }
make build-staging
[ -d "dist/frontend" ] || { echo "Error: make build-staging failed"; exit 1; }
working-directory: frontend
shell: bash

- name: Test make build-webnode
if: inputs.test-build-commands == 'true'
run: |
rm -rf dist
make build-webnode
[ -d "dist/frontend" ] || { echo "Error: make build-webnode failed"; exit 1; }
working-directory: frontend
shell: bash


- name: Run tests
if: inputs.run-tests == 'true'
uses: cypress-io/github-action@v6
Expand Down
119 changes: 119 additions & 0 deletions .github/scripts/docker/test-frontend-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/bin/bash
# Test frontend Docker image with specific environment configuration
# Usage: ./test-frontend-docker.sh <image> <environment> [port]
#
# Parameters:
# image - Docker image name/tag to test
# environment - Frontend environment configuration (local, webnode, production, development, producer, fuzzing)
# port - Optional port to use (default: 8080)
#
# Examples:
# ./test-frontend-docker.sh o1labs/mina-rust-frontend:latest production
# ./test-frontend-docker.sh test-frontend:local local 9090

set -euo pipefail

# Check arguments
if [ $# -lt 2 ]; then
echo "Usage: $0 <image> <environment> [port]"
echo ""
echo "Supported environments: local, webnode, production, development, producer, fuzzing"
echo ""
echo "Examples:"
echo " $0 o1labs/mina-rust-frontend:latest production"
echo " $0 test-frontend:local local 9090"
exit 1
fi

IMAGE="$1"
ENVIRONMENT="$2"
PORT="${3:-8080}"
CONTAINER_NAME="test-frontend-${ENVIRONMENT}-$$"

# Supported environments
SUPPORTED_ENVS="local webnode production development producer fuzzing"
if [[ ! " $SUPPORTED_ENVS " =~ \ $ENVIRONMENT\ ]]; then
echo "❌ Unsupported environment: $ENVIRONMENT"
echo "Supported environments: $SUPPORTED_ENVS"
exit 1
fi

echo "🧪 Testing frontend image with environment: $ENVIRONMENT"
echo "📦 Image: $IMAGE"
echo "🔌 Port: $PORT"
echo "📝 Container: $CONTAINER_NAME"
echo ""

# Cleanup function
cleanup() {
echo "🧹 Cleaning up container: $CONTAINER_NAME"
docker stop "$CONTAINER_NAME" 2>/dev/null || true
docker rm "$CONTAINER_NAME" 2>/dev/null || true
}

# Set up cleanup trap
trap cleanup EXIT

# Check if port is available
if ss -tuln | grep -q ":$PORT "; then
echo "❌ Port $PORT is already in use"
exit 1
fi

# Run the container with the specific environment configuration
echo "🚀 Starting container..."
docker run --rm -d \
--name "$CONTAINER_NAME" \
-p "$PORT:80" \
-e MINA_FRONTEND_ENVIRONMENT="$ENVIRONMENT" \
"$IMAGE"

# Wait a moment for container to start
echo "⏳ Waiting for container to initialize..."
sleep 10

# Check if container is running
if ! docker ps | grep -q "$CONTAINER_NAME"; then
echo "❌ Container failed to start with environment: $ENVIRONMENT"
echo "📋 Container logs:"
docker logs "$CONTAINER_NAME" || echo "No logs available"
exit 1
fi

echo "✅ Container started successfully with environment: $ENVIRONMENT"

# Test HTTP endpoint with retries (30 attempts with 3 second intervals = ~90s total)
RETRY_COUNT=0
MAX_RETRIES=30
SUCCESS=false

echo "🔍 Testing HTTP endpoint with retries (max $MAX_RETRIES attempts)..."

while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if curl -f -s -m 5 "http://localhost:$PORT/" > /dev/null 2>&1; then
echo "✅ HTTP endpoint is responding for environment: $ENVIRONMENT (attempt $((RETRY_COUNT + 1)))"
SUCCESS=true
break
else
RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
echo "❌ HTTP endpoint not ready after $MAX_RETRIES attempts"
else
echo "⏳ HTTP endpoint not ready, attempt $RETRY_COUNT/$MAX_RETRIES for environment: $ENVIRONMENT"
sleep 3
fi
fi
done

if [ "$SUCCESS" = false ]; then
echo "❌ HTTP endpoint failed after $MAX_RETRIES attempts for environment: $ENVIRONMENT"
echo "📋 Container logs:"
docker logs "$CONTAINER_NAME"
exit 1
fi

echo "🎉 Test completed successfully for environment: $ENVIRONMENT"
echo ""
echo "🌐 Frontend is available at: http://localhost:$PORT/"
echo "🔍 To view logs: docker logs $CONTAINER_NAME"
echo "🛑 Container will be automatically stopped when script exits"
65 changes: 58 additions & 7 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ jobs:
runs-on: ubuntu-latest
- platform: linux/arm64
runs-on: ubuntu-24.04-arm
configuration:
- build_configuration: production
runs-on: ${{ matrix.arch.runs-on }}
steps:
- name: Prepare
Expand All @@ -96,14 +94,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Download circuits files
uses: ./.github/actions/setup-circuits

- name: Generate .env.docker
run: |
bash ./frontend/docker/generate-docker-env.sh

- name: Build Docker image
id: build
uses: docker/build-push-action@v6
with:
context: ./frontend
context: ./
file: ./frontend/Dockerfile
platforms: ${{ matrix.arch.platform }}
build-args: |
BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
Expand All @@ -117,17 +121,64 @@ jobs:
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: frontend-${{ matrix.configuration.build_configuration }}-digests-${{ env.PLATFORM_PAIR }}
name: frontend-digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

# Test frontend image with all environment configurations
test-frontend-image:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release')
needs:
- build-mina-frontend-image
strategy:
matrix:
environment: [local, webnode, production, development, producer, fuzzing]
steps:
- name: Git checkout
uses: actions/checkout@v5

- name: Download frontend digest artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: frontend-*-digests-*
merge-multiple: true

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

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get image digest
id: digest
run: |
# Get the first digest from artifacts (we'll test with amd64)
DIGEST=$(ls /tmp/digests | head -1)
echo "digest=sha256:${DIGEST}" >> $GITHUB_OUTPUT

- name: Test frontend image with ${{ matrix.environment }} environment
run: |
# Pull the image by digest
docker pull ${{ env.REGISTRY_FRONTEND_IMAGE }}@${{ steps.digest.outputs.digest }}

# Tag it for easier reference
docker tag ${{ env.REGISTRY_FRONTEND_IMAGE }}@${{ steps.digest.outputs.digest }} test-frontend:${{ matrix.environment }}

# Run the test script
./.github/scripts/docker/test-frontend-docker.sh test-frontend:${{ matrix.environment }} ${{ matrix.environment }}

# Push frontend multi-arch manifest
push-frontend-image:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release')
needs:
- build-mina-frontend-image
- test-frontend-image
steps:
- name: Git checkout
uses: actions/checkout@v5
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches: [ main, develop ]
pull_request:
paths: [ "frontend/**", ".github/frontend.yaml" ]
workflow_dispatch:

concurrency:
Expand Down
Loading
Loading