- Notifications
You must be signed in to change notification settings - Fork14
Sailor is a tiny PaaS to install on your servers/VPS that uses git push to deploy micro-apps, micro-services, sites with SSL, on your own servers or VPS
License
mardix/sailor
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Sailor is a tinyPaaS to install on your servers/VPS (DigitalOcean, Hetzner, Linode).
It usesgit push to deploy micro-apps, micro-services and sites.
It natively supports Python, Nodejs, Static sites, and any other languages that can use the command line.
Sites deployed withSailor automatically have SSL assigned with LetsEncrypt.
Sailor can run long-running background workers and cron jobs.
It allows you to deploy multiple sites/apps using a single repository.
It gives you the option of having testing/staging/production environment deployed from the same codebase.
Sailor let's you see some stats about your apps, along with scaling them.
Sailor makes deploying apps a smooth sailing.
Ship it like aSailor!
- Automatic HTTPS
- Git Push deployment
- Deploy multiple apps on a single server / VPS
- Deploy multiple apps from a single repository
- Runs long running apps
- Runs workers/background applications
- Easy configuration with sailor.yml manifest
- Easy command line setup
- Cron-like/Scheduled script executions
- App management:
ls, start, stop, reload, rm, stop, scale, log, infoetc - Run scripts during application lifecycle:
release, predeploy, postdeploy, destroy - SSL/HTTPS with LetsEncrypt and ZeroSSL
- Supports any Shell script, therefore any other languages are supported
- Metrics to see app's health
- Create static sites
- Multi languages: Python, Nodejs, PHP, HTML/Static
- Support Flask, Django, Express, etc...
- Python >= 3.8
- Nginx
- Logs
- Fresh server (highly recommended)
- SSH to server with root access
- Ubuntu 22.04
On the server, run the code below to setup the environment for Sailor and install all its dependencies. A new user,sailor, will be created and will be used to interact with SSH for Sailor.
curl https://raw.githubusercontent.com/mardix/sailor/master/install.sh> install.shchmod 755 install.sh./install.shOn your local machine, point a Git remote to your Sailor server (set in step 2), withsailor as username.
Format:git remote add sailor sailor@$host:$app_name
With:
$hostThe server name or IP address$app_nameThe name of the application, that is set in thesailor.yml(the manifest to deploy)
Example:git remote add sailor sailor@my-server-host.com:myappname.com
...go into your repo and do what you do best, like asailor!
At the root of your app directory, createsailor.yml (required).
# sailor.yml---apps: # -> with remote: sailor@$host:myapp.com - name: myapp.com runtime: python process: web: cmd: app:app server_name: myapp.com workers: 2 cron: "0 0 * * * python backup.py" myownworker: python events-listener.pyExample:git remote add sailor sailor@$host:myapp.com
Push your code: git push sailor master
We did it,Okurrr!
Sailor communicates with your server via SSH, with the user name:sailor
You must already already have SSH access to the machine for it to work.
ie:ssh sailor@$host
ssh sailor@$hostssh sailor@$host lsThe command above will show the minimal info. To expand:
ssh sailor@$host ls xssh sailor@$host start $app_namessh sailor@$host stop $app_nameTo completely delete the application
ssh sailor@$host rm $app_nameTo force remove an app without promptrm -f $app_name
ssh sailor@$host rm -f $app_nameTo reload a running application
ssh sailor@$host reload $app_namessh sailor@$host info $app_namessh sailor@$host log $app_nameTo re-issue the SSL
ssh sailor@$host reset-ssl $app_nameTo increase/decrease the total workers for this process
ssh sailor@$host scale $app_name $proc=$count $proc2=$count2Example:
ssh sailor@$host scale site.com web=4ssh sailor@$host apps:reload-allssh sailor@$host apps:stop-allssh sailor@$host system:versionTo update Sailor to the latest from Github
ssh sailor@$host system:updateAdditionally, you can update from a specific branch, usually for testing purposes
ssh sailor@$host system:update $branch-nameSailor is a utility to install on a host machine, that allows you to deploy multiple apps, micro-services, webites, run scripts and background workers on a single VPS (Digital Ocean, Linode, Hetzner).
Sailor follows a process similar to Heroku or Dokku where you Git push code to the host andSailor will:
- create an instance on the host machine
- deploy the new code
- create virtual environments for your application
- get a free SSL from LetsEncrypt and assign it to your domain
- execute scripts to be executed
- put your application online
- monitor the application
- restart the application if it crashes
Sailor supports deployment for:
- Python (Flask/Django)
- Nodejs (Express)
- PHP
- HTML (React/Vuejs/Static).
- any of shell scripts
Sailor is a simpler alternative to Docker containers or Dokku. It mainly deals with your application deployment, similar to Heroku.
Sailor takes away all the complexity of Docker Containers or Dokku and gives you something simpler to deploy your applications, similar to Heroku, along with SSL.
- Python
- Nodejs
- Static HTML
- PHP
- Any shell script
Sailor supports a Heroku-like workflow, like so:
- Create a
gitSSH remote pointing to yourSailor server with the app name as repo name.git remote add sailor sailor@[yourserver]:[appname]. - Push your code:
git push sailor master. - Sailor determines the runtime and installs the dependencies for your app (building whatever's required).
- For Python, it installs and segregates each app's dependencies from
requirements.txtinto avirtualenv. - For Node, it installs whatever is in
package.jsonintonode_modules.
- For Python, it installs and segregates each app's dependencies from
- It then looks at
sailor.ymland starts the relevant applications using a generic process manager. - You can optionally also specify a
releaseworker which is run once when the app is deployed. - A
staticworker type, with the root path as the argument, can be used to deploy a gh-pages style static site.
sailor.yml is a manifest format for describing apps. It declares environment variables, scripts, and other information required to run an app on your server. This document describes the schema in detail.
sailor.yml contains an array of all apps to be deploy, and they are identified byname.
When setting up the remote, thename must match thename in the sailor.yml
# ~ Sailor ~# sailor.yml# Sailor Configuration (https://mardix.github.io/sailor)#---# *required: list/array of all applications to runapps: -# *required - the name of the applicationname:# runtime: python|node|static|shell# python for wsgi application (default python)# node: for node application, where the command should be ie: 'node inde.js 2>&1 | cat'# static: for HTML/Static page and PHP# shell: for any script that can be executed via the shell script, ie: command 2>&1 | catruntime:static# auto_restart (bool): to force server restarts when deployingauto_restart:true# static_paths (array): specify list of static path to expose, [/url:path, ...]static_paths:# SSL issuer: letsencrypt(default)|zerosslssl_issuer:letsencrypt# threads (int): The total threads to usethreads:4# wsgi (bool): if runtime is python by default it will use wsgi, if false it will fallback to the command providedwsgi:true# nginx (object): nginx specific config. can be omittednginx:include_file:''# uwsgi (object): uwsgi specific config. can be omitteduwsgi:gevent:falseasyncio:false# env (object) custom environment variableenv:KEY:VALUEKEY2:VALUE2# scripts to run during application lifecyclescripts:# release (array): commands to execute each time the application is released/pushedrelease:# destroy (array): commands to execute when the application is being deleteddestroy:# predeploy (array): commands to execute before spinning the apppredeploy:# postdeploy (array): commands to execute after spinning the apppostdeploy:# *required - process - list of all processes to run.# 'web' is special, it’s the only process type that can receive external HTTP traffic# only one web proctype can exist# all other process name will be regular worker.# The name doesn't matterprocess:# == web# (dict/object): it’s the only process type that can receive external HTTP trafficweb:# == (required) cmd(str) - the command to execute#-> cmd: app:app (for python using wsgi)#-> cmd: node server.js 2>&1 cat (For other web app which requires a server command)#-> cmd: /web-root-dir-name (for static html+php)cmd:# == (required) server_name(str)# the server name without http/httpsserver_name:# == server_port(str)# to use IP/PORT based instead of server_name. To give access to http://IP:8080# ie:# server_name: _ # server_name must be set to '_'# server_port: 8080server_port:# === workers(int)# the number of workers to run, by default 1workers:1# === enabled(bool)# a boolean to enable/disable this process, by default trueenabled:true# ==# other processes (string): command to run, with a name. The name doesn't matter - It can be named anythingworker1:# == (required) cmd(str) - the command to executecmd:# === workers(int)# the number of workers to run, by default 1workers:1# === enabled(bool)# a boolean to enable/disable this process, by default trueenabled:true# ==# for simplicity you can pass the command in the name as a string# workerX: python script.pyworkerX:# == cron# Cron proc allows you to run script periodically like cronjob# similar to web, only one cron can exist. And it can only have 1 worker# Also, put the cron in quotes to prevent deploy error# Simple cron expression:# minute [0-59], hour [0-23], day [0-31], month [1-12], weekday [1-7] (starting Monday, no ranges allowed on any field)# cron: "* * * * * python cron.py"cron:
You can deploy a site without a server name.
The server IP will be used instead of a server name
You need to set theweb.server_port to the desired port.
Beware the connection will not be behind NGINX nor use SSL.
This option is mainly for internal or IP based app.
# example sailor.yml... process: web: ..., #-- set server name to _ server_name: _ #-- set server port server_port: 8081TODO
- Allow multiple server name on same app with their own ssl
- Auto scaling, up to a max workers
0.12.0
- Now installs on Ubuntu 22.04
- Supports Python 3.11 as
python3.11 - Ubuntu 20.04 is still supported by using
install-2004.sh
0.11.1
- Update command
rm -f|--forceto force remove an application without the prompt. ie:sailor rm -f $app_name
- Update command
0.11.0
- Added possibility to deploy site without server_name but using IP and desired PORT
- Change commands to be more streamline
- ls
- start
- rm
- x:update
- x:version
0.10.0
- RebrandingSailor
- Added process option
enabledto run/not-run a process. Especially if you don't want to run a process without removing the code. - Fixed undefined value in setup_node_runtime
- fixed bindaddress bug
0.5.0
- Added revision hash info and deploy time.
- Log deploy info
0.4.0
- added new proctype 'cron' To help execute cron.
cronworkers, which require a simplifiedcronexpression preceding the command to be run (e.g.cron: * * * * * python batch.pyto run a batch every minyte
proces: cron: "* * * * * python cron.py"- expand process list to allow process to have extended properties as dict/hash:
process: web: cmd: server_name: workers: others: cmd: workers:- renamed command: 'app' -> 'apps'
- fixed bug: log issues due to permission
- remove environment settings from command. Can now be added in the yml file
server_namecan now be added inprocess.web.server_name- allow to system:update to be able to update from a different branch
system:update 1.2.0
- added new proctype 'cron' To help execute cron.
0.3.1
- fixed letsencrypt issue
0.2.0
- Rebranding Boxie to Sailor with Cardi B image, Okrrrrrr! (joke, joke)
- Remove Python 2 support.
- Recommend Ubuntu 20.04.
- Added separate install process for Ubuntu 2018.04
- Added custom index.html page
- Added aplication/json in nginx
- No longer supports self-signed SSL
0.1.0
- Initial
- sailor.yml contains the application configuration
- 'app.run.web' is set for static/web/wsgi command. Static accepts one path
- added 'cli.upgrade' to upgrade to the latest version
- 'sailor.json' can now have scripts to run
- 'uwsgi' and 'nginx' are hidden, 'app.env' can contain basic key
- 'app.static_paths' is an array
- Fixed python virtualenv setup, if the repo was used for a different runtime
- Simplifying "web" worker. No need for static or wsgi.
- Python default to wsgi worker, to force to a standalone set env.wsgi: false
- reformat uwsgi file name '{app-name}___{kind}.{index}.ini' (3 underscores)
- static sites have their own directives
- combined static html & php
- Support languages: Python(2, 3), Node, Static HTML, PHP
- simplify command name
- added metrics
- Letsencrypt
- ssl default
- https default
- Multiple domain name deployment
Credit: Sailor is a fork ofPikuhttps://github.com/piku/piku. Great work and Thank you.
Author: Mardix
License: MIT
Copyright 2021, 2022 to Forever
About
Sailor is a tiny PaaS to install on your servers/VPS that uses git push to deploy micro-apps, micro-services, sites with SSL, on your own servers or VPS
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
