一个golang写的部署GitHub上最新代码到服务器上的小工具:GoShip

jopen 4年前

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.

一个golang写的部署GitHub上最新代码到服务器上的小工具:GoShip

Installation

  1. Install go development environment
  2. rungo get github.com/gengo/goship
  3. rungo build github.com/gengo/goship

Usage

  1. Export your GitHub API token:

    export GITHUB_API_TOKEN="your-organization-github-token-here"
  2. 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.

  3. Create an etcd server

    1. Follow the instructions in the etcd README
    2. Write configurations in YAML.
    3. Store the configuration into etcd withgoshipcfgin tools
      • You can also directly access to etcd entries for small amount of change.
        • etcd exposes a single set of APIs. [reference]. There are many tools to call the APIs, e.g. etcdctl.
    </li> </ol>

    项目主页:http://www.open-open.com/lib/view/home/1447653914322