/sid

Simple Instant Deployment - CLI tool for quick and simple deployment using Docker and Nginx

Primary LanguageJavaScriptMIT LicenseMIT

Sid

Simple Instant Deployment

CLI tool for quick and simple deployment using Docker and Nginx. Sid aim to splifiy service deployment on simple infrastructure such as single node selfhosted home server. It's only requireing Docker and a functionning SSH server on the server.

Server configuration

First, you need to have docker installed and running

# apt-get install docker-ce docker-ce-cli containerd.io
# systemctl enable --now docker

For each user, create an account and add it to the docker group to allow this user to execute docker commands

# usermod -aG docker sid-user

Warning : Allowing a user to execute docker commands allow this user to control your infrastructure and, basically, a root access. Be careful of the people that are allowed to deploy with sid.

Create a network for all your services containing the main nginx and all user services

# docker network create sid

Start an Nginx container for directing HTTP trafic of your services

# docker run -d --name main-nginx -p 80:80 -p 443:443 -v /etc/nginx/conf.d/:/etc/nginx/conf.d/ --restart always --network sid nginx:latest

Make sure to mount a folder for nginx configurations generated by sid.

Add a file to configure sid for your server into /etc/sid/server.json containing the following keys

{
    "nginxContainerName": "main-nginx",
    "nginxConfigFile": "/etc/nginx/conf.d/sid-{username}.conf",
    "domainName": "{id}-{name}.example.org",
    "dockerNetwork": "sid"
}
  • nginxContainerName Name of the main nginx container that drives trafic to services, this name is used to trigger configuration refresh of nginx
  • nginxConfigFile The name of the nginx config file to generate sid config into, can be relative to variables (see below)
  • domainName Domain name of each deployment, can be relative to variables (see below)
  • dockerNetwork Network containing all services deployed with sid

Some fields can be relative to deployment variables

  • id Identifier of the current deployment
  • username Username of the user making the deployment
  • name Name of the deployed project

You must allow the user to edit it's own nginx file or the ability to create it's file.

Some resources