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

ssd

v1.0.2

Published

Simple Server Docker

Downloads

9

Readme

Build Status

SSD (Single Server of Dockers)

SSD wants to automate the process of deploying simple hobby and test web apps, make it easier so you can focus on the fun part.

Heads Up

SSD uses Docker to build isolated environment and deploy your project. Thus, some Docker knowledge is expected.

SSD requires to setup Docker with HTTPS connections, it may sound hassle at the beginning. But I got a bash script to set it up for you. Though you do have to copy files from your remote machine to you computer. However, I only have scripts for Ubuntu 14.04 for AWS. You are welcome to contribute more setup scripts here.

Prepare Remote Server

First, install Docker on your server and make Docker accept HTTPS connection. Copy setup-docker.sh in this repo to your remote machine. And run:

bash setup-docker.sh <you.host.name> <passphrase>
  • you.host.name is a public domain that associated with your server's IP. Unfortunately, generating certificate for HTTPS requires a domain name to do so (EC2 instance always come with a domain name).
  • passphrase is a password you choose for your keys.

This script will:

  1. Install Docker.
  2. Generate ca certificate and keys in $HOME/.docker directory.
  3. Change the docker config to enable HTTPS connection.
  4. Restart Docker daemon.

You need to copy ca.pem, cert.pem and key.pem from $HOME/.docker to your local machine for SSD to connect. You can test connections on your local machine (assuming you have docker installed on your local, OSX users refer to boot2docker) with:

docker --tlsverify --tlscacert=<path/to/ca.pem> --tlscert=<path/to/cert.pem> --tlskey=<path/to/key.pem> -H=<your.host.name>:2376 version

Usage

Install

npm install -g ssd

Command Line Interface

ssd [-s stage-name] <action> [action options]

    -s testing

    actions:
        init                Scaffold current project
        status              Checkout the information of image and container
        up  [-c false]      Build the image and start container
                                with `-c` flag, we will build using cache
        start               Start container
        stop                Stop container
        restart             Stop then start container
        exec [commands...]  Execute a command inside the container

API

You can also require ssd in your own build script.

var Server = require('ssd');

var s = new Server('<stage name>');

s.status().then(function () {
  console.log(s.images);
  console.log(s.containers);
});

// `s` is a event emitter instance
s.on('info', function (msg) {

});

s.on('error', function (err) {

});

// `end` is emitted when `up` finish or on error
s.on('end', function () {

});

// status messages will be emitted on `s` instance
s.up({cache: false});

Local Project Structure Config

Local projects should follow a specific directory structure:

source/
    meta.json
    Dockerfile
    <...other app files...>
stage/
    production/
        ssd.json
    <...more stages.../>
  • source contains source code and the information to build and run the app.
  • stage contains stages. You can consider each stage as a remote machine.
  • meta.json contains information to build and run Docker container.
  • Dockerfile used to build Docker image.
  • ssd.json used to define connection information for a remote machine belongs to current stage.

TODO

  • Support multiple images and containers
  • Support dependencies among containers
  • Support logging progress information in CLI when pulling baseimages while building image