npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@stencila/sparkla

v0.13.0

Published

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

Downloads

21

Readme

✨ 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

| Name | Description | Type | Default | | --------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------ | -------------------- | | debug | Output debug level log entries? | boolean | false | | host | The host address that the server should listen on. | string | "127.0.0.1" | | port | The port that the server should listen on. | number | 9000 | | jwtSecret | The JWT secret to use to sign and verify JWT tokens. If null then a random secret will be generated. | string, null | null | | sessionType | The class of sessions created. | "firecracker", "docker" | "docker" | | cpuTotal | The total number of CPUs that can be allocated to sessions. null = use the number of CPUs on the machine. | number, null | null | | memoryTotal | The total number amount of memory (Gib) that can be allocated to sessions. null = use the total amount of memory on the machine. | number, null | null | | expiryInterval | Interval in seconds between checks for expired sessions. | number | 15 | | durationWarning | Number of seconds to provide clients with a warning prior to reaching maximum session duration. | number | 600 | | timeoutWarning | Number of seconds to provide clients with a warning prior to a reaching session timeout. | number | 60 | | staleInterval | Interval in seconds between checks for stale sessions. | number | 60 | | stalePeriod | Number of seconds that a stopped session is considered stale and will be removed from the list of sessions. | number | 3600 | | statsInterval | Interval in seconds for collecting system statistics | number | 60 | | statsPrometheus | The port to serve Prometheus compatible metrics on. Set to 0 to turn off Prometheus exporting. | number | 9464 | | logsSentry | The Sentry DSN (Data Source Name) to record warning and error log entries. Set to null to not send logs to Sentry. | string | "https://[email protected]/1818023" | | peerSwarm | The 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