Starting the CosmicAC Application Stack
Start all CosmicAC workers in the correct sequential order on first launch, then manage them with PM2.
Starting the CosmicAC Application Stack
Initial Start (Sequential)
Due to dependencies between workers, the first startup requires a sequential approach:
Step 1: Start wrk-ork
cd ~/pm2
# Start wrk-ork first (creates status files needed by other workers)
pm2 start stg.ecosystem.config.js --only wrk-ork-0
# Wait for wrk-ork to initialize (check logs)
pm2 logs wrk-ork-0
# Wait until you see it's fully started, then Ctrl+CStep 2: Configure app-node
After wrk-ork is running, configure app-node before starting it.
2a. Copy wrk-ork rpcPublicKey to app-node config
Get the rpcPublicKey from wrk-ork status and add it to app-node's config:
# Get the rpcPublicKey from wrk-ork status
cat ~/cosmicac-wrk-ork/status/*.json | jq '.rpcPublicKey'Edit ~/cosmicac-app-node/config/common.json and add the orks configuration:
{
"orks": {
"cluster-0": {
"rpcPublicKey": "<RPC_PUBLIC_KEY_FROM_WRK_ORK>"
}
}
}2b. Configure UI static path
Add the UI path to ~/cosmicac-app-node/config/common.json:
{
"staticRootPath": "/home/cosmicac/cosmicac-ui/"
}2c. Configure OAuth2
Edit ~/cosmicac-app-node/config/facs/httpd-oauth2.config.json with your OAuth2 settings:
{
"enabled": true,
"providers": {
"google": {
"clientId": "<YOUR_GOOGLE_CLIENT_ID>",
"clientSecret": "<YOUR_GOOGLE_CLIENT_SECRET>",
"callbackUrl": "https://<YOUR_DOMAIN>/auth/google/callback"
}
},
"sessionSecret": "<YOUR_SESSION_SECRET>",
"cookieDomain": "<YOUR_DOMAIN>"
}Note: Replace the placeholder values with your actual OAuth2 credentials.
Step 3: Start app-node
# Start app-node (depends on wrk-ork status)
pm2 start stg.ecosystem.config.js --only app-node-0
# Wait for app-node to initialize
pm2 logs app-node-0
# Wait until ready, then Ctrl+CStep 4: Start remaining workers
# Start the rest of the workers
pm2 start stg.ecosystem.config.jsSubsequent Starts
After the initial setup, you can start all services at once:
pm2 start stg.ecosystem.config.jsUseful PM2 Commands
# Check status of all processes
pm2 status
# View logs for all processes
pm2 logs
# View logs for a specific process
pm2 logs app-node-0
# Restart all processes
pm2 restart all
# Restart specific process
pm2 restart app-node-0
# Stop all processes
pm2 stop all
# Delete all processes from PM2
pm2 delete all
# Monitor resources
pm2 monit
# Save current process list (for auto-restart)
pm2 save