Skip to content

tomzhang/tugboat

 
 

Repository files navigation

Tugboat is an API and AngularJS client for aggregating deployments of GitHub repos.

Providers

Tugboat by itself isn't all that exciting; it won't perform deployments for you, but it does provide an API for deployment providers to hook into.

Writing your own providers is really simple and you can write them in any language that you want.

Provider API

Tugboat exposes an API for registering deployments, add logs, and updating the status. For an example of how to create an external provider with Go, see provider_test.go.


Authorization

The API expects the user part of a basic auth Authorization header to be a provider auth token. You can generate a provider auth token using the following:

$ tugboat tokens create <provider>
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJQcm92aWRlciI6ImZvbyJ9.UYMrZD7cgBdeEXLf11nwEiZpUI2DuOdRsGOZyG2SluU

Create Deployment

Creates a new Deployment within tugboat. In general, this would include a post body extracted from a GitHub deployment event webhook payload.

The response from this endpoint will be a Deployment resource.

POST /deployments

Example Request

{
  "ID": 1234,
  "Sha": "abcd...xyz",
  "Ref": "master"
}

Example Response

{
  "ID": "01234567-89ab-cdef-0123-456789abcdef",
  "Repo": "remind101/r101-api",
  "Token": "01234567-89ab-cdef-0123-456789abcdef"
}

Add Log Lines

This adds lines of logs to the deployment. You can simply stream your logs and they will be added as they come in. Logs show up automatically in the UI via pusher events.

POST /deployments/:id/logs

Example Request

Authorization: dXNlcjo=\n

Deploying to production
Deployed

Update Status

Updates the status of the deployment. The status field should be one of succeeded, failed or errored. If the status is errored then you can provide an error field with details about the error. This will also update the status of the deployment within GitHub itself.

POST /deployments/:id/status

Example Request

{
  "status": "succeeded"
}

Setup

  1. Git clone this repo into $GOPATH/src/github.com/remind101/tugboat
  2. Run the before_install steps in .travis.yml to set up dependencies and env.
  3. Run the script steps in .travis.yml to test your setup.

Roadmap

About

Rest API and AngularJS client for deploying github repos.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 80.4%
  • JavaScript 14.2%
  • HTML 2.8%
  • CSS 2.2%
  • Other 0.4%