Skip to content

gnomix/goship

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

GoShip

A simple tool for deploying code to servers.

pirate gopher

What it does:

GoShip SSHes into the machines that you list in ETCD and gets the latest revision from the specified git repository. It then compares that to the latest revision on GitHub and, if they differ, shows a link to the diff as well as a Deploy button. You can then deploy by clicking the button, and will show you the output of the deployment command, as well as save the output, diff, and whether the command succeeded.

GoShip Index Page Screenshot

Usage

Export your GitHub API token:

export GITHUB_API_TOKEN="your-organization-github-token-here"

Github Omniauth Integration:

Users who are collaborator on a repo can 'see' that repo in Goship.
You must create a developer application to use omniauth.
If you do NOT add the appropriate env keys below AUTH will be OFF I.E. Please be careful and check the logs.
Please  note the "Authorization callback URL" should match your site i.e. "http://<your-url-and-port>/auth/github/callback"

export GITHUB_RANDOM_HASH_KEY="some-random-hash-here";
export GITHUB_OMNI_AUTH_ID="github-application-id";
export GITHUB_OMNI_AUTH_KEY="github-application-key";
export GITHUB_CALLBACK_URL="http://<your-url-and-port>";  // must match that given to Github! Would be 127.0.0.1:port for testing

If authentication is 'turned on', organization 'team' members who are collaborators and exclusively on a 'pull' only team will be able to see a repo, however the deploy button will be diasbled for them.

Create an ETCD server / follow the instructions in the etcd README:

https://github.com/coreos/etcd

There are various tools to update your ETCD server including the etcdctl client or curl, you can also use a variety of clients and JSON formatting: There is also a convert.go in tools that can be used to 'bootstrap' etcd.

#example setup using etcd https://github.com/coreos/etcdctl/

   etcdctl set /deploy_user 'deployer'
   etcdctl mkdir 'projects'
   etcdctl mkdir 'projects/my-project'
   etcdctl set /projects/my-project/repo_name 'my-project'
   etcdctl set /projects/my-project/repo_owner 'github-user'
   etcdctl set /projects/my-project/project_name 'My Project'

#curl example

   curl -L http://127.0.0.1:4001/projects/my-project/environments/staging/deploy -XPUT -d value="/path/to/deployscripts/myproj_staging.sh"

#convert.go example in the tools folder of goship. ( config.yml and etcd settings are configurable - run with -h for options)

   go run convert.go -c /mnt/srv/http/gengo/goship/shared/config.yml 

Then run the server manually

go run goship.go -b localhost:8888 -k ~/.ssh/id_rsa

Available command line flags for the go run goship.go command are:

 -b [bind address]             Address to bind (default localhost:8000)
 -k [id_rsa key]               Path to private SSH key for connecting to Github (default id_rsa)
 -d [data path]                Path to data directory (default ./data/)
 -e [etcd location]            Full URL to ETCD Server. Defaults to localhost
 -f [deploy confirmation flag] Flag to specify if user is prompted with confirmation dialog before deploys. Defaults to True

Chat Notifications

To notify a chat room when the Deploy button is pushed, create a script that takes a message as an argument and sends the message to the room, and then add it to the config like so:

notify: ./notifications/notify.sh

Sevabot is a good choice for Skype.

Tools

There are some tools added in the /tools directory that can be used interface with Goship

  1. convert.go: takes a config.yml file and converts it to ETCD. Used for bootstrapping ETCD from the original conf file.
  2. deploy.go: Can be used as a script by the "deploy" to create a knife solo command which reads in the appropriate servers from ETCD and runs knife solo.

Plugins

Goship suffices as a basic application to aid your deployments. However, you may wish to extend Goship with some custom UI on its home page with plugins.

To do so, head over to Plugins.

GoShip was inspired by Rackspace's Dreadnot (UI image) and Etsy's Deployinator (UI image).

The GoShip logo is an adaptation of the Go gopher created by Renee French under the Creative Commons Attribution 3.0 license.

About

A simple tool for deploying code to servers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 78.0%
  • HTML 13.9%
  • JavaScript 7.2%
  • CSS 0.9%