0.13.0 • Published 4 years ago

@stencila/sparkla v0.13.0

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
4 years ago

✨ Sparkla

Compute sessions for executable documents: fast-to-start, isolated, reproducible. Pick any three.

:warning: Well, that's the aim ;) Sparkla is currently in early development. It started as an experiment in using Amazon's Firecracker as a more secure (but just as fast-to-start) alternative to Docker containers. It is intended to supersede stencila/cloud.

Install

npm install -g @stencila/sparkla

Sparkla creates sessions in either Firecracker microVMs or Docker containers. So you'll need at least one of these installed.

Firecracker

Firecracker is only available on Linux. Download the latest Firecracker binary from https://github.com/firecracker-microvm/firecracker/releases:

curl -L -o firecracker https://github.com/firecracker-microvm/firecracker/releases/download/v0.18.0/firecracker-v0.18.0
chmod +x firecracker

Firecracker is built on top of KVM and needs read/write access to /dev/kvm. Log in to the host in one terminal and set up that access:

sudo setfacl -m u:${USER}:rw /dev/kvm

Docker

If you want to use Docker-based sessions then you'll need to have docker installed.

Usage

Run Sparkla using the command line interface e.g.

sparkla serve --port 9001 --cpuTotal 1

Options

NameDescriptionTypeDefault
debugOutput debug level log entries?booleanfalse
hostThe host address that the server should listen on.string"127.0.0.1"
portThe port that the server should listen on.number9000
jwtSecretThe JWT secret to use to sign and verify JWT tokens. If null then a random secret will be generated.string, nullnull
sessionTypeThe class of sessions created."firecracker", "docker""docker"
cpuTotalThe total number of CPUs that can be allocated to sessions. null = use the number of CPUs on the machine.number, nullnull
memoryTotalThe total number amount of memory (Gib) that can be allocated to sessions. null = use the total amount of memory on the machine.number, nullnull
expiryIntervalInterval in seconds between checks for expired sessions.number15
durationWarningNumber of seconds to provide clients with a warning prior to reaching maximum session duration.number600
timeoutWarningNumber of seconds to provide clients with a warning prior to a reaching session timeout.number60
staleIntervalInterval in seconds between checks for stale sessions.number60
stalePeriodNumber of seconds that a stopped session is considered stale and will be removed from the list of sessions.number3600
statsIntervalInterval in seconds for collecting system statisticsnumber60
statsPrometheusThe port to serve Prometheus compatible metrics on. Set to 0 to turn off Prometheus exporting.number9464
logsSentryThe Sentry DSN (Data Source Name) to record warning and error log entries. Set to null to not send logs to Sentry.string"https://7a4f9c9b0ef5474596c0066bb364e615@sentry.io/1818023"
peerSwarmThe name of the peer swarm to join.string, null"sparkla"

All options can be set, in decending order of priority, by:

  • a command line argument e.g. --port 80
  • an environment variable prefixed with SPARKLA_ e.g. SPARKLA_PORT=80
  • a .json or .ini configuration file, set using the --config option, or .sparklarc by default

Development

npm run serve:dev

Firecracker

To check for running FirecrackerSessions:

ps aux | firecracker

You can also check the logs and metrics of a Firecracker VM while it is running:

cat /tmp/vm-0d0b4b2fa73c5d4c10ed72ccac97b798530ba1b7ab8461fd313d320fb5d3562e/log.fifo
cat /tmp/vm-0d0b4b2fa73c5d4c10ed72ccac97b798530ba1b7ab8461fd313d320fb5d3562e/metrics.fifo

Docker

To check for running DockerSessions:

docker ps
0.13.0

4 years ago

0.12.3

4 years ago

0.12.2

4 years ago

0.12.1

4 years ago

0.12.0

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago