Code Monkey home page Code Monkey logo

deployer's Introduction

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.

deployer's People

Contributors

ebeigarts avatar medinst avatar

Stargazers

Tuan Duc Tran avatar paul avatar Andreas Motl avatar  avatar  avatar

Watchers

Arvis avatar Ingus Skaistkalns avatar Oskars avatar James Cloos avatar Kristaps Kulikovskis avatar Janis Vitols avatar

deployer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.