一个golang写的部署GitHub上最新代码到服务器上的小工具:GoShip
GoShip是一个golang写的部署GitHub上最新代码到服务器上的小工具。
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.
Installation
- Install go development environment
- rungo get github.com/gengo/goship
- rungo build github.com/gengo/goship
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
- Write configurations in YAML.
- Store the configuration into etcd withgoshipcfgin tools