Skip to content

erezool/JDock

 
 

Repository files navigation

JDock - Docker'ed IJulia containers

What works

  • Runs each IJulia session in its own sandboxed container
  • A bash session is aslo started in the container - can be used to run the Julia console REPL
  • File transfer facility into a session's container
  • Basic admin screen to delete old/inactive sessions
  • Support Google auth
  • Auto cleanup of sessions based on inactivity
  • Limiting the memory usage by a user session

Pending

  • Google drive integration
  • Limiting disk usage by session
  • Upload .ipynb notebooks by URLs directly into the container
  • Security improvements
  • More complete Admin interface
  • Prettier UI
  • Launching remote docker instances

Installing

  • The setup script has been tested to work on a fresh Ubuntu 13.04 AMI - viz, ami-ef277b86, but should work on any 13.04 system
  • If on EC2, launch an instance from ami-ef277b86 . Make sure you open up ports 22 (ssh) and 80 (http) in your security group
  • On a 13.04 system, make sure your id has sudo permissions
  • Run the following :
sudo apt-get install git

git clone https://github.com/amitmurthy/JDock.git

cd JDock

setup.sh has the following options:

Usage: ./setup.sh  -u <admin_username> optional_args
 -u  <username> : Mandatory admin username. If -g option is used, this must be the complete Google email-id
 -d             : Only recreate docker image - do not install/update other software
 -g             : Use Google Openid for user authentication 
 -n  <num>      : Maximum number of active containers. Deafult 10.
 -t  <seconds>  : Auto delete containers older than specified seconds. 0 means never expire. Default 0.
  • admin_username above is the session name for an "administration" session. If not using Google auth, select something non-guessable.
  • Go get a coffee, this while take a while
  • NOTE : If you are just updating JDock and do not wish to reinstall packages on your host, use the -d option
git pull

./setup.sh -u <admin_username> -d 

./reload.sh
  • This will just apply any changes to the scripts and nginx config files. Any changes to your nginx config file will be overwritten.

Powering up

  • cd <path to JDock>; ./start.sh
  • point your browser to http:https://<your_host_address>/
  • stop.sh stops nginx and tornado, while reload.sh restarts the servers

Additional configuration

Create a file called jdock.user in the installation's root directory. It should contain a JSON dictionary of the form

{
  "protected_sessions" : ['amitm'],
  "numlocalmax" : 3,
  "admin_users" : [],
  "mem_limit" : 1000000000,
  "inactivity_timeout" : 300,
  "expire" : 0,
  "dummy" : "dummy"
}

where

protected_sessions are those sessions which will not be timed out and auto-cleaned up numlocalmax is the maximum number of concurrent sessions to be allowed. Default is 10 or the number specified while running ./setup.sh . admin_users is a list of users that have access to the admin tab. Empty means everyone has access. mem_limit is a maximum memory allowed per docker container (running a local nginx, ijulia, bash as well as the users julia sessions). Default is 1GB.

NOTE: To be able to use mem_limit, the host kernel must be configured to support the same. See http:https://docs.docker.io/en/latest/installation/kernel/#memory-and-swap-accounting-on-debian-ubuntu

inactivity_timeout specifies the time in seconds to wait before clearing an inactive session, for example, when the user closes the browser window . Default is 300 seconds. protected_sessions are not affected.

expire specifes an upper time limit for a user session before it is auto-deleted. 0 means never expire. protected_sessions are not affected.

You will need to run reload.sh for any changed parameters to take affect.

Notes

  • On EC2, the containers are created on the ephemeral volume. They do not persist across a system start/stop

  • NGINX and embedded Lua (from http:https://openresty.org/) and tornado have been used to build the web interface

  • Not recommended to host on the public internet just yet.

  • Security is mostly a TODO at this time.

  • Docker itself is undergoing changes in its API. Since we pull in the latest docker, changes in the docker API may break JDock at any time.

  • To get the latest Julia build onto the docker image, you have have to build it with the -no-cache option.

  • For example, ./setup.sh executes sudo docker build -t ijulia docker/IJulia/.

  • To update docker image ijulia with the latest Julia version run sudo docker build -no-cache -t ijulia docker/IJulia/

  • docker is an evolving project, sometimes unwanted images take up unecessary disk space. To clear them run sudo docker rmi $(sudo docker images | grep "^<none>" | tr -s ' ' | cut -d ' ' -f 3)

ACKNOWLEDGEMENTS

About

IJulia sandboxed by Docker containers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published