deployer

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 12 Imported by: 0

README

Deployer

Deploy applications using GitHub Deployments API.

  1. Listen/poll new GitHub deployments
  2. Create pending GitHub deployment status and empty Gist
  3. Execute command file that deploys application
  4. Create success/failure Github deployment status and update Gist
  5. Sleep 30 seconds
  6. 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.

Usage

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)

Installation

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

Example

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

Build

make

Contributing

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.

License

Deployer is available as open source under the terms of the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL