SPB Git

spb/drive Public

SPB Drive — self-hosted personal cloud drive (files, previews, sharing) on the MacLustr cluster.

JavaScript 82.7% CSS 10.6% Nunjucks 3.6% Shell 1.8% SQL 1.3%
2.1 KB · 62 lines javascript
Raw Blame History
1/**2 * ─────────────────────────────────────────────3 *  SPB Drive — Personal Cloud Drive4 * ─────────────────────────────────────────────5 *  Author  : Simon-Pierre Boucher6 *  Contact : contact@spboucher.ai7 *  File    : deploy/ecosystem.config.cjs8 *  Purpose : pm2 process definitions — server + ngrok tunnel9 *  License : MIT © Simon-Pierre Boucher10 * ─────────────────────────────────────────────11 */1213const os = require('node:os');1415// macOS seals /srv — the drive lives under $HOME/srv (see setup-m3u96b.sh).16const DATA_DIR = `${os.homedir()}/srv/drive`;17const APP_DIR = `${DATA_DIR}/app`;18const LOG_DIR = `${DATA_DIR}/logs`;1920// The authtoken lives in the agent's default config (ngrok config add-authtoken);21// both configs are passed and merged in order — v3 configs don't expand env vars.22const NGROK_AGENT_CFG = `${os.homedir()}/Library/Application Support/ngrok/ngrok.yml`;2324module.exports = {25  apps: [26    {27      name: 'spbdrive-server',28      cwd: APP_DIR,29      script: 'src/server.mjs',30      interpreter: 'node',31      env: {32        NODE_ENV: 'production',33        SPBDRIVE_DATA_DIR: DATA_DIR,34        SPBDRIVE_PORT: '7430',35        SPBDRIVE_HOST: '127.0.0.1',36        SPBDRIVE_PUBLIC_URL: 'https://drive.spboucher.ai',37        SPBDRIVE_TRUST_PROXY: 'true',38      },39      autorestart: true,40      max_restarts: 50,41      restart_delay: 3000,42      out_file: `${LOG_DIR}/server.out.log`,43      error_file: `${LOG_DIR}/server.err.log`,44      merge_logs: true,45      time: true,46    },47    {48      name: 'spbdrive-tunnel',49      cwd: APP_DIR,50      script: 'ngrok',51      args: ['start', 'spbdrive', '--config', NGROK_AGENT_CFG, '--config', `${APP_DIR}/deploy/ngrok.yml`],52      interpreter: 'none',53      autorestart: true,54      restart_delay: 5000,55      out_file: `${LOG_DIR}/tunnel.out.log`,56      error_file: `${LOG_DIR}/tunnel.err.log`,57      merge_logs: true,58      time: true,59    },60  ],61};62