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.
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.nameis 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).
passphraseis a password you choose for your keys.
This script will:
- Install Docker.
- Generate ca certificate and keys in
- Change the docker config to enable HTTPS connection.
- Restart Docker daemon.
You need to copy
$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
npm install -g ssd
Command Line Interface
ssd [-s stage-name] <action> [action options]-s testingactions:init Scaffold current projectstatus Checkout the information of image and containerup [-c false] Build the image and start containerwith `-c` flag, we will build using cachestart Start containerstop Stop containerrestart Stop then start containerexec [commands...] Execute a command inside the container
You can also require
ssd in your own build script.
var Server = ;var s = '<stage name>';sstatus;// `s` is a event emitter instances;s;// `end` is emitted when `up` finish or on errors;// status messages will be emitted on `s` instances;
Local Project Structure Config
Local projects should follow a specific directory structure:
source/meta.jsonDockerfile<...other app files...>stage/production/ssd.json<...more stages.../>
sourcecontains source code and the information to build and run the app.
stagecontains stages. You can consider each stage as a remote machine.
meta.jsoncontains information to build and run Docker container.
Dockerfileused to build Docker image.
ssd.jsonused to define connection information for a remote machine belongs to current stage.
- Support multiple images and containers
- Support dependencies among containers
- Support logging progress information in CLI when pulling baseimages while building image