Skip to content

jkristia/compose-node-session-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compose Node Session Manager

This repository contains two Node.js services that demonstrate a simple session-management workflow:

  • myapp/: hosts a single MyApp process that exposes / and /ping endpoints and spins up a lightweight worker loop. It reads runtime parameters (session-id, port) from the command line, so multiple instances can run side-by-side.
  • session-manager/: contains a SessionManager that talks to the Docker daemon, starts new myapp containers, and exposes an HTTP control plane. The accompanying SessionManagerApp exposes proxy endpoints (/session/:id, /session/:id/ping) plus /sessions, /create, /kill for observing and manipulating sessions.

Getting started

Ensure Docker and Docker Compose are available on your machine. The repository ships with helper Makefile targets that build and run the services:

  1. Install dependencies (this installs separately inside both packages):

    make npm-install
  2. Build both services and their containers:

    make build-image

    This compiles each .ts entry point and produces session-run, myapp-dev, and manager-dev images.

  3. Start the manager service (this spins up the manager via Docker Compose, mounting /var/run/docker.sock so it can control Docker and attaching to sys-network for service discovery):

    make run-manager

    After it starts, visit http://localhost:8080 , run any api commands from session-manager.rest. CTRL+C tears down the stack.

  4. Run a standalone MyApp instance (for debugging, without the manager):

    make run-app

    This runs myapp inside Docker with debugging enabled on port 9230 and binds ports for the app.

Container architecture

  • Manager containers join sys-network so they can resolve dynamically created sessions such as session-1 and talk to them over their exposed ports (e.g., 10011 for session-1).
  • /session/:id proxy on the manager forwards HTTP calls to the live session container, while /session/:id/ping fetches that session’s /ping endpoint and returns the result back through the manager.
  • /create and /kill HTTP hooks let you spawn or remove session containers from the manager UI.

About

node session manager. Running compose + nginx. create / delete node app sessions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published