A build proxy server using Docker container for Golang apps.
- Start a torokko server.
- Access a build endpoint.
$ curl -X POST http://torokko-server/{remote}/{owner}/{repo}/{GOOS}/{GOARCH}/{version}
# e.g. http://torokko-server/github.com/monochromegane/torokko/linux/amd64/v0.0.1
And access a download endpoint after a few minutes 🍻
$ curl -OJL http://torokko-server/{remote}/{owner}/{repo}/{GOOS}/{GOARCH}/{version}
Here is a demo API server. Try it now :)
Build a go binary.
POST /{remote}/{owner}/{repo}/{GOOS}/{GOARCH}/{version}
Example request:
$ curl -X POST http://torokko-server/github.com/monochromegane/torokko/linux/amd64/v0.0.1
- remote - Remote repository. (e.g. github.com)
- owner - Repository owner.
- repo - Repository name.
- GOOS - Cross compilation environment. (e.g. linux, darwin, windows)
- GOARCH - Cross compilation environment. (e.g. amd64, 386)
- version - Repository version tag name. (e.g. v0.0.1)
See also Custom build section.
Example response:
{
"build_id": "1a7452d077faed659af0e85731664938"
}
- build_id - build id (See also Log endpoint)
Status code
- 202 - no error (build offer is accepted)
- 409 - already exists (The binary is already built, try download)
- 500 - server error
Get build logs.
GET /builds/{build_id}/logs
Example request:
$ curl http://torokko-server/builds/1a7452d077faed659af0e85731664938/logs
Example response:
{
"build_id": "1a7452d077faed659af0e85731664938",
"level": "info",
"msg": "Your build started.",
"time": "2015-08-13T11:46:26+09:00",
"workspace": "795098082"
}
{
"build_id": "1a7452d077faed659af0e85731664938",
"level": "info",
"msg": "checking binary...",
"time": "2015-08-13T11:46:26+09:00"
}
{
"build_id": "1a7452d077faed659af0e85731664938",
"level": "info",
"msg": "cloning repository...",
"time": "2015-08-13T11:46:26+09:00"
}
Status code
- 200 - no error
- 500 - server error
Download a go binary.
GET /{remote}/{owner}/{repo}/{GOOS}/{GOARCH}/{version}
- remote - Remote repository. (e.g. github.com)
- owner - Repository owner.
- repo - Repository name.
- GOOS - Cross compilation environment. (e.g. linux, darwin, windows)
- GOARCH - Cross compilation environment. (e.g. amd64, 386)
- version - Repository version tag name. (e.g. v0.0.1)
Example request:
$ curl -OJL http://torokko-server/github.com/monochromegane/torokko/linux/amd64/v0.0.1
- Specify
-OJL
option, because torokko server redirect and addContent-Disposion
header. - If you use
wget
, try--content-disposition
option.
Status code
- 200 - no error
- 404 - not found
- 500 - server error
Torokko use make
command for building your app.
If your repository don't have Makefile
, Torokko use default Makefile:
build:
go get -d ./...
go build
If your app have to customize build step, put a Makefile on your repository.
If your repository is private, you can add Authorization: token <TOKEN>
header to build and download requests.
$ curl -H "Authorization: token <TOKEN>" -X POST http://torokko-server/github.com/monochromegane/torokko/linux/amd64/v0.0.1
Caution
Demo API server is non-SSL site. I don't recommend you use for private repository.
$ go get github.com/monochromegane/torokko
Torokko server require the following.
- Docker
- Docker Remote API
- Golang build images (Now torokko use
golang:1.4.2-cross
) - git
- lsof
- workspace, log, storage directories.
- Support build trigger from GitHub Webhook.
- Dockernize.
- Separate build queue process.
- Support GitHub releases backend.
- Support S3 backend.
- Add more tests.
- Fork it
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...
command and confirm that it passes - Run
gofmt -s
- Create new Pull Request