Spaces:
Sleeping
Sleeping
Create entrypoint.sh
Browse files- entrypoint.sh +82 -0
entrypoint.sh
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
process_log() {
|
| 5 |
+
echo "------------------------------------------------------------"
|
| 6 |
+
echo "[SYSTEM_BOOT] $(date '+%Y-%m-%d %H:%M:%S') : $1"
|
| 7 |
+
echo "------------------------------------------------------------"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
process_log "MVEMBA CORE: INITIATING SAFE PROXY MODE"
|
| 11 |
+
|
| 12 |
+
# -------------------------------------------------------------------
|
| 13 |
+
# STAGE 1: VIRTUAL ENVIRONMENT PROVISIONING
|
| 14 |
+
# Deploying volatile proxy dependencies to temporary storage
|
| 15 |
+
# -------------------------------------------------------------------
|
| 16 |
+
process_log "PROVISIONING: Installing Proxy Libs to /tmp"
|
| 17 |
+
cd /tmp
|
| 18 |
+
npm install http-proxy
|
| 19 |
+
cd /app
|
| 20 |
+
|
| 21 |
+
# -------------------------------------------------------------------
|
| 22 |
+
# STAGE 2: DEPENDENCY AGGREGATION
|
| 23 |
+
# Resolving workspace-wide package requirements
|
| 24 |
+
# -------------------------------------------------------------------
|
| 25 |
+
process_log "PACKAGE_MANAGER: Synchronizing Postiz dependencies"
|
| 26 |
+
pnpm install
|
| 27 |
+
|
| 28 |
+
# -------------------------------------------------------------------
|
| 29 |
+
# STAGE 3: BINARY COMPILATION
|
| 30 |
+
# Executing production build for monorepo architecture
|
| 31 |
+
# -------------------------------------------------------------------
|
| 32 |
+
process_log "COMPILER: Building Postiz Production Assets"
|
| 33 |
+
pnpm build
|
| 34 |
+
|
| 35 |
+
# -------------------------------------------------------------------
|
| 36 |
+
# STAGE 4: WORKFLOW ENGINE INITIALIZATION
|
| 37 |
+
# Bootstrapping Temporal development server
|
| 38 |
+
# -------------------------------------------------------------------
|
| 39 |
+
process_log "ENGINE_START: Initializing Temporal Server"
|
| 40 |
+
temporal server start-dev --ip 0.0.0.0 --ui-port 8233 &
|
| 41 |
+
sleep 5
|
| 42 |
+
|
| 43 |
+
# -------------------------------------------------------------------
|
| 44 |
+
# STAGE 5: DATA ARCHITECTURE SYNCHRONIZATION
|
| 45 |
+
# Deploying Prisma schema to Neon PostgreSQL infrastructure
|
| 46 |
+
# -------------------------------------------------------------------
|
| 47 |
+
process_log "SCHEMA_SYNC: Aligning Database with Neon Cluster"
|
| 48 |
+
|
| 49 |
+
pnpm dlx prisma@6.5.0 db push \
|
| 50 |
+
--schema=/app/libraries/nestjs-libraries/src/database/prisma/schema.prisma \
|
| 51 |
+
--accept-data-loss
|
| 52 |
+
|
| 53 |
+
process_log "INTEGRITY_CHECK: Database Schema Synchronized"
|
| 54 |
+
|
| 55 |
+
# -------------------------------------------------------------------
|
| 56 |
+
# STAGE 6: MICROSERVICE DEPLOYMENT
|
| 57 |
+
# Orchestrating PM2 instances for Backend, Frontend, and Workers
|
| 58 |
+
# -------------------------------------------------------------------
|
| 59 |
+
process_log "SERVICE_DEPLOY: Activating Backend (Port 4000)"
|
| 60 |
+
PORT=4000 pm2 start pnpm --name backend --cwd /app/apps/backend -- run start
|
| 61 |
+
|
| 62 |
+
process_log "SERVICE_DEPLOY: Activating Frontend (Port 4200)"
|
| 63 |
+
PORT=4200 HOSTNAME=0.0.0.0 pm2 start pnpm --name frontend --cwd /app/apps/frontend -- run start
|
| 64 |
+
|
| 65 |
+
process_log "SERVICE_DEPLOY: Activating Orchestrator"
|
| 66 |
+
pm2 start pnpm --name orchestrator --cwd /app/apps/orchestrator -- run start
|
| 67 |
+
|
| 68 |
+
# -------------------------------------------------------------------
|
| 69 |
+
# STAGE 7: TRAFFIC CONTROL
|
| 70 |
+
# Deploying Mvemba Secure Proxy for request routing
|
| 71 |
+
# -------------------------------------------------------------------
|
| 72 |
+
process_log "ROUTING_LAYER: Activating Mvemba Secure Proxy"
|
| 73 |
+
export NODE_PATH=/tmp/node_modules
|
| 74 |
+
node /app/proxy.js &
|
| 75 |
+
|
| 76 |
+
# -------------------------------------------------------------------
|
| 77 |
+
# STAGE 8: RUNTIME MONITORING
|
| 78 |
+
# System is live. Engaging log streaming.
|
| 79 |
+
# -------------------------------------------------------------------
|
| 80 |
+
process_log "BOOT_COMPLETE: Mvemba Postiz Instance is Live"
|
| 81 |
+
pm2 list
|
| 82 |
+
pm2 logs
|