feat: Runtime configuration and Docker deployment improvements

Frontend:
- Add runtime configuration service for deployment-time API URL injection
- Create docker-entrypoint.sh to generate config.json from environment variables
- Update ApiService, ApprovalService, and DocumentViewer to use RuntimeConfigService
- Add APP_INITIALIZER to load runtime config before app starts

Backend:
- Fix init-blockchain.js to properly quote mnemonic phrases in .env file
- Improve docker-entrypoint.sh with health checks and better error handling

Docker:
- Add API_BASE_URL environment variable to frontend container
- Update docker-compose.yml with clear documentation for remote deployment
- Reorganize .env.example with clear categories (REQUIRED FOR REMOTE, PRODUCTION, AUTO-GENERATED)

Workflow fixes:
- Fix DepartmentApproval interface to match backend schema
- Fix stage transformation for 0-indexed stageOrder
- Fix workflow list to show correct stage count from definition.stages

Cleanup:
- Move development artifacts to .trash directory
- Remove root-level package.json (was only for utility scripts)
- Add .trash/ to .gitignore
This commit is contained in:
Mahi
2026-02-08 18:44:05 -04:00
parent 2c10cd5662
commit d9de183e51
171 changed files with 10236 additions and 8386 deletions

View File

@@ -1,5 +1,22 @@
version: '3.8'
# ==============================================================================
# Goa GEL Platform - Docker Compose
# ==============================================================================
#
# Quick Start (no config needed):
# docker-compose up -d
#
# Production: Copy .env.example to .env and update security values
#
# Services:
# - Frontend: http://localhost:4200
# - API: http://localhost:3001
# - Blockscout: http://localhost:4000
# - MinIO: http://localhost:9001 (admin console)
#
# ==============================================================================
services:
# ================================
# PostgreSQL Database
@@ -11,9 +28,9 @@ services:
ports:
- "5432:5432"
environment:
- POSTGRES_DB=goa_gel_platform
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres_secure_password
POSTGRES_DB: goa_gel_platform
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-postgres_dev_password}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
@@ -55,8 +72,8 @@ services:
- "9000:9000"
- "9001:9001"
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin_secure
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minio_dev_password}
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
@@ -115,7 +132,7 @@ services:
environment:
POSTGRES_DB: blockscout
POSTGRES_USER: blockscout
POSTGRES_PASSWORD: blockscout_secure
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-blockscout_dev_password}
volumes:
- blockscout_db_data:/var/lib/postgresql/data
networks:
@@ -136,7 +153,7 @@ services:
ports:
- "4000:4000"
environment:
DATABASE_URL: postgresql://blockscout:blockscout_secure@blockscout-db:5432/blockscout
DATABASE_URL: postgresql://blockscout:${DATABASE_PASSWORD:-blockscout_dev_password}@blockscout-db:5432/blockscout
ETHEREUM_JSONRPC_VARIANT: besu
ETHEREUM_JSONRPC_HTTP_URL: http://besu-node-1:8545
ETHEREUM_JSONRPC_WS_URL: ws://besu-node-1:8546
@@ -155,7 +172,7 @@ services:
POOL_SIZE: 80
POOL_SIZE_API: 10
ECTO_USE_SSL: "false"
SECRET_KEY_BASE: RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5
SECRET_KEY_BASE: ${BLOCKSCOUT_SECRET_KEY_BASE:-RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5}
PORT: 4000
DISABLE_EXCHANGE_RATES: "true"
SHOW_TXS_CHART: "true"
@@ -188,29 +205,40 @@ services:
ports:
- "3001:3001"
environment:
- NODE_ENV=production
- PORT=3001
- DATABASE_HOST=postgres
- DATABASE_PORT=5432
- DATABASE_NAME=goa_gel_platform
- DATABASE_USER=postgres
- DATABASE_PASSWORD=postgres_secure_password
- REDIS_HOST=redis
- REDIS_PORT=6379
- MINIO_ENDPOINT=minio
- MINIO_PORT=9000
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin_secure
- MINIO_BUCKET_DOCUMENTS=goa-gel-documents
- BESU_RPC_URL=http://besu-node-1:8545
- BESU_CHAIN_ID=1337
- BESU_NETWORK_ID=2024
- CONTRACT_ADDRESS_LICENSE_NFT=${CONTRACT_ADDRESS_LICENSE_NFT:-}
- CONTRACT_ADDRESS_APPROVAL_MANAGER=${CONTRACT_ADDRESS_APPROVAL_MANAGER:-}
- CONTRACT_ADDRESS_DEPARTMENT_REGISTRY=${CONTRACT_ADDRESS_DEPARTMENT_REGISTRY:-}
- CONTRACT_ADDRESS_WORKFLOW_REGISTRY=${CONTRACT_ADDRESS_WORKFLOW_REGISTRY:-}
- PLATFORM_WALLET_PRIVATE_KEY=${PLATFORM_WALLET_PRIVATE_KEY:-}
- JWT_SECRET=${JWT_SECRET:-your-super-secure-jwt-secret-key-min-32-chars-long}
# Application
NODE_ENV: ${NODE_ENV:-production}
PORT: 3001
# CORS - set to frontend URL for remote access
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:4200}
# Database (must match postgres service)
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_NAME: goa_gel_platform
DATABASE_USER: postgres
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-postgres_dev_password}
# Redis
REDIS_HOST: redis
REDIS_PORT: 6379
# MinIO (must match minio service)
MINIO_ENDPOINT: minio
MINIO_PORT: 9000
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minio_dev_password}
MINIO_BUCKET_DOCUMENTS: goa-gel-documents
# Blockchain
BESU_RPC_URL: http://besu-node-1:8545
BESU_CHAIN_ID: 1337
BESU_NETWORK_ID: 2024
# Smart Contracts (populated after blockchain contract deployment)
CONTRACT_ADDRESS_LICENSE_NFT: ${CONTRACT_ADDRESS_LICENSE_NFT:-}
CONTRACT_ADDRESS_APPROVAL_MANAGER: ${CONTRACT_ADDRESS_APPROVAL_MANAGER:-}
CONTRACT_ADDRESS_DEPARTMENT_REGISTRY: ${CONTRACT_ADDRESS_DEPARTMENT_REGISTRY:-}
CONTRACT_ADDRESS_WORKFLOW_REGISTRY: ${CONTRACT_ADDRESS_WORKFLOW_REGISTRY:-}
PLATFORM_WALLET_PRIVATE_KEY: ${PLATFORM_WALLET_PRIVATE_KEY:-}
# Security
JWT_SECRET: ${JWT_SECRET:-dev_jwt_secret_change_in_production_min32chars}
# Misc
FORCE_RESEED: ${FORCE_RESEED:-false}
depends_on:
postgres:
condition: service_healthy
@@ -223,7 +251,6 @@ services:
networks:
- goa-gel-network
volumes:
- ./backend/.env:/app/.env
- api_data:/app/data
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3001/api/v1/health"]
@@ -243,6 +270,11 @@ services:
restart: unless-stopped
ports:
- "4200:80"
environment:
# Runtime API URL - browsers need the public/external URL to reach the API
# For local: http://localhost:3001/api/v1
# For remote: http://<server-ip>:3001/api/v1 or https://api.yourdomain.com/api/v1
API_BASE_URL: ${API_BASE_URL:-http://localhost:3001/api/v1}
depends_on:
api:
condition: service_healthy
@@ -255,7 +287,7 @@ services:
retries: 3
# ================================
# Documentation Service
# Documentation Service (Optional)
# ================================
documentation:
build:
@@ -267,6 +299,8 @@ services:
- "8080:80"
networks:
- goa-gel-network
profiles:
- docs # Only starts with: docker-compose --profile docs up
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost/"]
interval: 30s