Deploy applications using GitHub Deployments API.
- Listen/poll new GitHub deployments
- Create pending GitHub deployment status and empty Gist
- Execute command file that deploys application
- Create success/failure Github deployment status and update Gist
- Sleep 30 seconds
- Go to step #1
To register github deployments you can use curl, slashdeploy or something else.
If you are using Slack, you can enable 'Deploy Events -> Show deployment statuses' to get slack notifications with links to Gist.
deployer -h
-env string
Github deployment environment (required)
-file string
File to execute when new deployment is available (required)
-org string
GitHub org (required)
-p string
GitHub password (required)
-repo string
GitHub repo (required)
-sleep int
Time to sleep between loops (defaults to 30 seconds) (default 30)
-u string
GitHub username (required)
Install deployer
on application server:
$ sudo -i
$ curl -L -o /usr/local/bin/deployer https://github.com/mak-it/deployer/releases/download/v0.2.0/deployer-linux-amd64
$ chmod +x /usr/local/bin/deployer
Start deployer
on system reboot using cron
and screen
(assuming you already have a custom deployment script /home/deployuser/deploy-myapp-demo
):
$ su - deployuser
$ echo "@reboot /usr/bin/screen -d -m /usr/local/bin/deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -file /home/deployuser/deploy-myapp-demo -sleep 30" | crontab -
Start deployer
in screen
:
$ su - deployuser
$ /usr/bin/screen -d -m /usr/local/bin/deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -file /home/deployuser/deploy-myapp-demo -sleep 30
Trigger deployment from developer's machine:
$ deploy --branch v49.3 --env demo
On the application server:
$ deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -file bin/deploy-stub -sleep 30
Output:
Deployer
ghuser ghpass mak-it myapp demo myapp-demo
Sleep duration: 30s
2017/08/24 13:32:52 Getting deployment demo
2017/08/24 13:32:53 Problem in getting deployment Deployment statuses already present
2017/08/24 13:32:53 Sleeping 30s
2017/08/24 13:33:23 Getting deployment demo
2017/08/24 13:33:23 123 v49.3 demo
2017/08/24 13:33:24 Gist create ID: 123, Ref: v49.3, Environment: demo
2017/08/24 13:33:25 Gist https://gist.github.com/...
2017/08/24 13:33:25 Deployment status create pending
2017/08/24 13:33:26 Executing File bin/deploy-stub
-----> Deploying version: v49.3...
-----> Adding BUILD_ENV to build environment...
-----> Compiling Ruby/Rails
=====> Application deployed:
http://ruby-rails-sample.dokku.me
2017/08/24 13:33:26 Deployment status create success
2017/08/24 13:33:26 Gist update
make
Bug reports and pull requests are welcome on GitHub at https://github.com/mak-it/deployer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Deployer is available as open source under the terms of the MIT License.