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

smartos-image-server

v0.2.0

Published

Serve SmartOS images

Downloads

6

Readme

smartos-image-server

bare minimum image server for SmartOS

Installing in a SmartOS zone

pkgin in nodejs scmgit
git clone https://github.com/pgte/smartos-image-server
cd smartos-image-server
make

Configuration

After installation is complete, you should update config.json for your environment. At the very least you should set an image-creator name for your organization, if you intend to use the supplied import-image script to publish images.

Running behind ngnix

config.json:

{
	"listen_port": "/var/tmp/image-server.sock",
	"prefix": "http://",
	"suffix": "",
	"loglevel": "info",
  "image-creator": "internal",
  "image-creator-uuid": "...",
  "image-vendor-uuid": "..."
}

nginx config snippet:

    server {
        listen       80;
        server_name  images.acme.com;
        location / {
            proxy_set_header Host $host;
            proxy_pass http://unix:/var/tmp/image-server.sock:;
        }
    }

Enabling the image server

After installation is complete, you can import the SMF manifest and enable the service.

svccfg import image-server.smf.xml
svcadm enable image-server

Serving images

To serve images, the "serve_dir" (configured in config.json, defaults to smartos-image-server directory) needs to be populated with manifests and zfs send streams in the proper hierarchy (see structure below).

Once populated, add http://<image_server_ip_or_hostname>/datasets to /var/db/imgadm/sources.list

Then:

imgadm update
imgadm avail

Publishing images

There's a few options for publishing images to the image server:

  • Build manifests manually (http://wiki.smartos.org/display/DOC/Managing+Images#ManagingImages-ImageManifests) and populate "serve_dir" according to structure below.
  • Someone else has written a tool to make it easy to generate manifest files: https://github.com/project-fifo/nomnom/tree/master/tools
  • Or use the included import-image script via SSH from the global zone

Using import-image

The long way, from the global zone:

zlogin a48b615e-76fb-11e2-9502-6b130bf7f4ff 
sm-prepare-image
# exit / wait for zone to stop
zfs snapshot zones/a48b615e-76fb-11e2-9502-6b130bf7f4ff@image
zfs send zones/a48b615e-76fb-11e2-9502-6b130bf7f4ff@image | gzip | ssh datasets.yourdomain.local '/path/to/import-image orgbase 1.0.0 "Base image for our organization"'
imgadm update
imgadm avail

Alternatively, there's a mkimg script included that can be copied to the global zone (/opt/local/bin), and used to make the above process simpler. To do so, first edit the mkimg script and set IMGSERVER, IMPORTPATH, and LOGIN to proper values for your environment. Once configured you can now publish images from the global zone by doing:

mkimg <uuid> <name> <version> <description>

Example:

mkimg a48b615e-76fb-11e2-9502-6b130bf7f4ff orgbase 1.0.0 "Base image for our organization"

Structure

By default, images are stored under smartos-image-server. This can be changed in config.json.

smartos-image-server/
	server.js
	config.json
  import-image
	<uuid>/
		manifest.json
		<zfs-stream-file>.<extension>

Requirements

  • nodejs>=0.8
  • node-restify

Final thoughts

There is some basic error checking, but it could probably be improved.

Patches Welcome!!