bzl

self-hosted ephemeral community engine
Log | Files | Refs | README | LICENSE

stream-pack-up.js (790B)


      1 const { spawnSync } = require("child_process");
      2 const fs = require("fs");
      3 const path = require("path");
      4 
      5 const ROOT = path.join(__dirname, "..");
      6 const PACK_DIR = path.join(ROOT, "stream_pack");
      7 
      8 function run(cmd, args, opts = {}) {
      9   return spawnSync(cmd, args, { stdio: "inherit", cwd: PACK_DIR, ...opts });
     10 }
     11 
     12 function main() {
     13   if (!fs.existsSync(path.join(PACK_DIR, "docker-compose.yml"))) {
     14     console.error("[stream-pack] Missing stream_pack/docker-compose.yml. Run `node scripts/stream-pack-init.js ...` first.");
     15     process.exit(1);
     16   }
     17 
     18   // Prefer modern docker compose
     19   let r = run("docker", ["compose", "up", "-d"]);
     20   if (r.status === 0) return;
     21 
     22   // Fallback to legacy docker-compose
     23   r = run("docker-compose", ["up", "-d"]);
     24   process.exit(r.status || 1);
     25 }
     26 
     27 main();
     28