gorf

0.6.1 • Public • Published

gorf is a very specific tool that exposes endpoints to listen for deploy commands for git repositories with a Dockerfile. When a deploy command is sent, it clones the repository and builds the project.

gorf is very much still a work in progress. It should only be used experimentally at this time.

Install

npm install -g gorf

Github / Gitlab hooks

Github and Gitlab both exposes an option called webhooks. Whenever a commit is pushed, it calls the specified webhook URL with a payload containing information about the commit.

What gorf does

gorf exposes a small express server that can receive these calls. The webhook URL, along with the webhook payload, contains the information that gorf uses to deploy the application.

Right now, gorf's reaction to a push is always to clone and build the expected Dockerfile inside the project. It then runs the built image.

How to use it

The minimum configuration is to set the SECRET env var, which is used to obfuscate the URL used for deployments:

SECRET=very-secret-url gorf

gorf then exposes the webhooks on localhost:9900. You can optionally set a HOST env var, which will be passed on to the started containers (see below).

The endpoints at which gorf will receive instructions to deploy are defined as follows:

  • Github: /SECRET/github/push/id
  • Gitlab: /SECRET/gitlab/push/id
  • Manual: /SECRET/manual/push/id

The id is passed on to the env vars for the started containers (see below).

Usage with nginx-proxy

When the built image is run, a VIRTUAL_HOST env variable is set to [ref].[id].[host]. ref will be the git ref name with any slashes converted to underscore (master / feature_add-input), if available. If it does not have a ref, it will be the commit sha. id is the last part of the push URL. host is ENV var set for gorf (for example test.com), and will default to localhost.

So, for instance, the resulting URL could be master.myproject.test.com.

If the docker machine is running a nginx-proxy image, the VIRTUAL_HOST env var will be automatically picked up and proxied through this service.

Readme

Keywords

none

Package Sidebar

Install

npm i gorf

Weekly Downloads

2

Version

0.6.1

License

ISC

Last publish

Collaborators

  • kparkov