Spaces:
Sleeping
Sleeping
| set -e | |
| process_log() { | |
| echo "------------------------------------------------------------" | |
| echo "[SYSTEM_BOOT] $(date '+%Y-%m-%d %H:%M:%S') : $1" | |
| echo "------------------------------------------------------------" | |
| } | |
| process_log "MVEMBA CORE: INITIATING SAFE PROXY MODE" | |
| # ------------------------------------------------------------------- | |
| # STAGE 1: VIRTUAL ENVIRONMENT PROVISIONING | |
| # Deploying volatile proxy dependencies to temporary storage | |
| # ------------------------------------------------------------------- | |
| process_log "PROVISIONING: Installing Proxy Libs to /tmp" | |
| cd /tmp | |
| npm install http-proxy | |
| cd /app | |
| # ------------------------------------------------------------------- | |
| # STAGE 2: DEPENDENCY AGGREGATION | |
| # Resolving workspace-wide package requirements | |
| # ------------------------------------------------------------------- | |
| process_log "PACKAGE_MANAGER: Synchronizing Postiz dependencies" | |
| pnpm install | |
| # ------------------------------------------------------------------- | |
| # STAGE 3: BINARY COMPILATION | |
| # Executing production build for monorepo architecture | |
| # ------------------------------------------------------------------- | |
| process_log "COMPILER: Building Postiz Production Assets" | |
| pnpm build | |
| # ------------------------------------------------------------------- | |
| # STAGE 4: WORKFLOW ENGINE INITIALIZATION | |
| # Bootstrapping Temporal development server | |
| # ------------------------------------------------------------------- | |
| process_log "ENGINE_START: Initializing Temporal Server" | |
| temporal server start-dev --ip 0.0.0.0 --ui-port 8233 & | |
| sleep 5 | |
| # ------------------------------------------------------------------- | |
| # STAGE 5: DATA ARCHITECTURE SYNCHRONIZATION | |
| # Deploying Prisma schema to Neon PostgreSQL infrastructure | |
| # ------------------------------------------------------------------- | |
| process_log "SCHEMA_SYNC: Aligning Database with Neon Cluster" | |
| pnpm dlx prisma@6.5.0 db push \ | |
| --schema=/app/libraries/nestjs-libraries/src/database/prisma/schema.prisma \ | |
| --accept-data-loss | |
| process_log "INTEGRITY_CHECK: Database Schema Synchronized" | |
| # ------------------------------------------------------------------- | |
| # STAGE 6: MICROSERVICE DEPLOYMENT | |
| # Orchestrating PM2 instances for Backend, Frontend, and Workers | |
| # ------------------------------------------------------------------- | |
| process_log "SERVICE_DEPLOY: Activating Backend (Port 4000)" | |
| PORT=4000 pm2 start pnpm --name backend --cwd /app/apps/backend -- run start | |
| process_log "SERVICE_DEPLOY: Activating Frontend (Port 4200)" | |
| PORT=4200 HOSTNAME=0.0.0.0 pm2 start pnpm --name frontend --cwd /app/apps/frontend -- run start | |
| process_log "SERVICE_DEPLOY: Activating Orchestrator" | |
| pm2 start pnpm --name orchestrator --cwd /app/apps/orchestrator -- run start | |
| # ------------------------------------------------------------------- | |
| # STAGE 7: TRAFFIC CONTROL | |
| # Deploying Mvemba Secure Proxy for request routing | |
| # ------------------------------------------------------------------- | |
| process_log "ROUTING_LAYER: Activating Mvemba Secure Proxy" | |
| export NODE_PATH=/tmp/node_modules | |
| node /app/proxy.js & | |
| # ------------------------------------------------------------------- | |
| # STAGE 8: RUNTIME MONITORING | |
| # System is live. Engaging log streaming. | |
| # ------------------------------------------------------------------- | |
| process_log "BOOT_COMPLETE: Mvemba Postiz Instance is Live" | |
| pm2 list | |
| pm2 logs |