This builds, packages, and deploys software to servers using only a couple shell scripts, docker, tar, and rsync. It's a bit rough, and definitely not suitable for corporate use, but will get the job done if you have simple needs.
- A server with all the proper runtimes, languages, and SSH keys you'd normally need to run and deploy your application.
deployuser which SSH access and a home directory.
/srv/www, owned by
deploy-appscript in this repo should be uploaded to every production server at
/usr/local/bin/deploy-app, and should be executable.
- Another repo for project configuration. This repo should only ever contain
the upstream deploy-app scripts; you should nest another git repo of your own
./workspacein this directory (it is git-ignored) to hold your project configuration files.
For an example of what the workspace repo should look like, check out: blackieops/deploy-app-example
If you use Ansible, check out blackieops/deploy-app-ansible,
which provides an Ansible role for configuring servers for
First, fill out
servers by providing a newline-separated list of server
hostnames or IPs. These will be iterated through and deployed in order.
Each project is stored under the
./workspace directory. Configuring a project
requires you to just create a directory with some scripts and files:
workspace/myproject/ ├── Dockerfile ├── build.sh ├── postdeploy.sh └── remote
Dockerfilewill be built on every run and the app will be built inside it. It should set up everything necessary to compile your software. If you do not need Docker, you can simply omit the Dockerfile and the build will execute locally instead.
build.shwill be invoked inside the container and should run all the necessary things to compile and/or release your software.
postdeploy.shwill be sent to the production server and executed in the root of your project code after it has been extracted; use this to install dependencies, restart services, notify load balancers, etc.
remoteis a plain text file with nothing except a URL to the git remote we should clone to get your app's source code.
Once you have a project configured as per above, and you have servers that have
been configured and are accessible in your
servers manifest, then just:
myproject is the name of the directory under
If you want to deploy from a specific branch, such as
for example, simply set
BRANCH when calling
BRANCH=staging ./deploy.sh myproject