Skip to content

service.sh

Sosyabot ships no Docker, no docker-compose, no containers — per the project's CLAUDE.md rules. Every operational action goes through one shell script at the repo root: service.sh.

Components managed

service.sh orchestrates four long-running components:

NameWorking dirCommand (effective)Default port
apibackend/node dist/server.jsPORT=4200
workerbackend/node dist/worker.js(no port)
landinglanding/pnpm vite preview --port ${LANDING_PORT:-4201}4201
docsdocs/pnpm vitepress preview content --port ${DOCS_PORT:-4202}4202

The frontend (authenticated app) is not a separate process — ./service.sh build copies the Vite output to backend/dist/public and the API serves it from /.

Commands

./service.sh install     # pnpm install at root (workspaces)
./service.sh build       # backend tsc + frontend vite (→ backend/dist/public) + landing vite + docs vitepress
./service.sh start       # start every component, write PIDs to .run/
./service.sh stop        # SIGTERM tree, then SIGKILL after 5 s; handles pnpm → vite child processes
./service.sh restart     # stop then start
./service.sh status      # print "running (pid)" / "stopped" per component
./service.sh logs <name> # tail .logs/<name>.log; <name> ∈ api | worker | landing | docs
./service.sh health      # curl every component's health probe and report

Process supervision

  • Each component is started under setsid so the whole tree (pnpmvite preview) runs in its own process group.
  • PIDs are stored in .run/<component>.pid; logs in .logs/<component>.log.
  • stop_one() walks the descendant tree and sends SIGTERM to every PID before falling back to SIGKILL after 5 s.

NODE_BIN pin

If your system Node is older than 18, set NODE_BIN in .env to a directory containing the right node and pnpm binaries (e.g. /root/.nvm/versions/node/v22.22.2/bin). service.sh prepends this directory to PATH for every spawned process.

Health checks

./service.sh health curls the four component endpoints and exits non-zero if any fail:

  • http://127.0.0.1:${PORT:-4200}/health — backend liveness.
  • http://127.0.0.1:${LANDING_PORT:-4201}/ — landing index.
  • http://127.0.0.1:${DOCS_PORT:-4202}/ — docs index.

The worker has no port; it's considered healthy if the PID file points to a live process. Use the status command to verify.