Go to file
Jack Hadrill 6ccf4d1b0a
continuous-integration/drone/push Build is passing Details
Fix CI syntax error.
2022-08-24 23:59:59 +00:00
.vscode Experimental 2022-08-24 23:56:49 +00:00
src/container_spawner Experimental 2022-08-24 23:56:49 +00:00
test Experimental 2022-08-24 23:56:49 +00:00
.drone.yml Fix CI syntax error. 2022-08-24 23:59:59 +00:00
.flake8 Experimental 2022-08-24 23:56:49 +00:00
.gitignore Initial commit 2022-08-24 21:41:05 +00:00
.pylintrc Experimental 2022-08-24 23:56:49 +00:00
LICENSE Initial commit 2022-08-24 21:41:05 +00:00
README.md Experimental 2022-08-24 23:56:49 +00:00
pyproject.toml Experimental 2022-08-24 23:56:49 +00:00
setup.cfg Experimental 2022-08-24 23:56:49 +00:00
setup.py Experimental 2022-08-24 23:56:49 +00:00

README.md

Code Spawner

Build Status

A tool for spawning a bespoke container upon receiving an HTTP request.

Usage

More details coming soon.

An example docker-compose.yml config is show below:

version: '3'
services:
  ...
  container-spawner:
    image: git.jacknet.io/jackhadrill/container-spawner:latest
    restart: always
    environment:
      CONTAINER_IMAGE: "codercom/code-server:latest"
      CONTAINER_PREFIX: "vscode"
      CONTAINER_NETWORK: "vscode_backend"
      CONTAINER_PERSIST: "/home/coder"
  ...

Process description

Upon receiving any HTTP request, Code Spawner will launch a bespoke container on behalf of the user (if not already existing), equivalent to having used the command below. The user's name is derived from the X-Forwarded-Preferred-User header, original sent by OAuth2 Proxy.

$ docker run -d --rm --name ${CONTAINER_PREFIX}-${X-Forwarded-Preferred-User} -v ${CONTAINER_PREFIX}-${X-Forwarded-Preferred-User}:${CONTAINER_PERSIST} --network ${CONTAINER_NETWORK} ${IMAGE_NAME}

For example, assuming X-Forwarded-Preferred-User is jack:

$ export CONTAINER_IMAGE="codercom/code-server:latest"
$ export CONTAINER_PREFIX="vscode"
$ export CONTAINER_NETWORK="vscode_backend"
$ export CONTAINER_PERSIST="/home/coder"
$ docker run -d --rm --name vscode-jack -v vscode-jack:/home/coder --network vscode_backend codercom/code-server:latest