The Shipa Developer Hub

Welcome to the Shipa developer hub. You'll find comprehensive guides and documentation to help you start working with Shipa as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Changelog

Creating a Platform

In case there is a requirement of a platform that’s not already available in Shipa's platforms repository, Shipa makes it quite easy to create and add new ones, utilizing current and existing platforms as a base.

Platforms are Docker images that are used to deploy your application code on Shipa. Shipa provides a base image that platform developers can use to build upon. This platform provides a base deployment script that handles package downloading and extraction in a proper path and an operating system package manager.

Every platform in the repository extends the base-platform adding the specifics of each platform. They are a great way to learn how to create a new one.

Sample Platform Creation

For the example below, we will create a Node.js platform. First, let’s define its Dockerfile:

FROM  shipa/base-platform
ADD . /var/lib/shipa/nodejs
RUN cp /var/lib/shipa/nodejs/deploy /var/lib/shipa
RUN /var/lib/shipa/nodejs/install

In the file above, we extend the shipa/base-platform, adding our deploy and installing scripts to the right place: /var/lib/shipa.

The install script runs when we add or update the platform on shipa. It’s the perfect place to install dependencies that every application on its platform needs:

#!/bin/bash -le

source ${SOURCE_DIR}/base/rc/config

apt-get update
apt-get install git -y
git clone /etc/nvm
cd /etc/nvm && git checkout `git describe --abbrev=0 --tags`

cat >> ${HOME}/.profile <<EOF
if [ -e ${HOME}/.nvm_bin ]; then
    export PATH="${HOME}/.nvm_bin:$PATH"

On the code above, dependencies are being installed and the environment prepared for the applications.

The ${SOURCE_DIR}/base/rc/config provides some bootstrap configuration that is usually needed.

The next step is to define the deploy script, which runs every time a deploy occurs:

#!/bin/bash -le

source ${SOURCE_DIR}/base/rc/config
source ${SOURCE_DIR}/base/deploy

export NVM_DIR=${HOME}/.nvm
[ ! -e ${NVM_DIR} ] && mkdir -p ${NVM_DIR}

. /etc/nvm/

nvm install stable

rm -f ~/.nvm_bin
ln -s $NVM_BIN ~/.nvm_bin

if [ -f ${CURRENT_DIR}/package.json ]; then
    pushd $CURRENT_DIR && npm install --production

We run some base scripts to do some heavy lifting on the code above: ${SOURCE_DIR}/base/rc/config and ${SOURCE_DIR}/base/deploy.

After that, it’s just a matter of application specifics dependencies using npm.

Adding Newly Created Platforms

After creating a platform as a Dockerfile, users can add it to Shipa using Shipa's client package:

$ shipa platform add your-platform-name --dockerfile http://url-to-dockerfile

If the image is pushed to a Docker Registry, users can use:

$ shipa platform add your-platform-name -i your-user/image-name

Updated 5 months ago

Creating a Platform

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.