slurp

command module
v0.0.5-0...-1633514 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2019 License: MIT Imports: 7 Imported by: 0

README

Build Status GoDoc

Slurp

Intermediary to the stored build/blob, used specifically to speed up publishing nanobox builds.

Quickstart:

# Once hoarder is running, slurp can be quickly started by running:
slurp -b /tmp/build

# register a new build
curl -k https://localhost:1566/stages -d '{"new-id": "test"}'
# sync up your build (current directory)
rsync -v --delete -aR . -e 'ssh -p 1567' test@127.0.0.1:test
# tell slurp you are done syncing
curl -k https://localhost:1566/stages/test -X PUT
# Congratulations!

Part II:

# after modifying your code, register a new build
curl -k https://localhost:1566/stages -d '{"old-id": "test", "new-id": "test2"}'
# sync up your build (current directory)
rsync -v --delete -aR . -e 'ssh -p 1567' test2@127.0.0.1:this-location-really-doesnt-matter
# tell slurp you are done syncing
curl -k https://localhost:1566/stages/test2 -X PUT
# Congratulations!

Usage:

As a Server

To start slurp as a server, run:

slurp

An optional config file can also be passed on startup:

slurp -c /path/to/config.json

config.json

{ "api-token": "secret", "api-address": "https://127.0.0.1:1566", "build-dir": "/var/db/slurp/build/", "insecure": true, "log-level": "info", "ssh-addr": "127.0.0.1:1567", "ssh-host": "/var/db/slurp/slurp_rsa", "store-addr": "hoarders://127.0.0.1:7410", "store-token": "" }


`slurp -h` will show usage and a list of commands:

slurp - build intermediary

Usage: slurp [flags]

Flags: -a, --api-address="https://127.0.0.1:1566": Listen uri for the API (scheme defaults to https) -t, --api-token="secret": Token for API Access -b, --build-dir="/var/db/slurp/build/": Build staging directory -c, --config-file="": Configuration file to load -i, --insecure[=true]: Disable tls certificate verification when connecting to storage -l, --log-level="info": Log level to output [fatal|error|info|debug|trace] -s, --ssh-addr="127.0.0.1:1567": Address ssh server will listen on (ip:port combo) -k, --ssh-host="/var/db/slurp/slurp_rsa": SSH host (private) key file -S, --store-addr="hoarders://127.0.0.1:7410": Storage host address -T, --store-token="": Storage auth token -v, --version[=false]: Print version info and exit


## API:

| Route | Description | Payload | Output |
| --- | --- | --- | --- |
| **POST** | /stages | Stage a new build | json stage object | json auth object |
| **PUT** | /stages/:id | Commit a new build | nil | success/err message |
| **DELETE** | /stages/:id | Delete a build | nil | success/err message |
- Commit will clean up the staged build *after* pushing it to storage
- Delete will clean up the staged build *without* pushing it to storage

## Data types:

### Stage
json:
```json
{
  "old-id": "abc123",
  "new-id": "def456"
}

Fields:

  • old-id: ID (in storage) of build to update
  • new-id: ID for the new build (required)
Auth

json:

{
  "secret": "def456"
}

Fields:

  • secret: Contains the username to ssh with (ID of new build)

Todo

  • rebuild auth user list on reboot
  • routinely clean up undeleted builds

Changelog

  • v0.0.4 (July 26, 2016)

    • Explicitly define protocols
    • Unchanged builds keep the same md5 in hoarder
  • v0.0.3 (July 22, 2016)

    • Stream data to/from hoarder, lowering memory footprint
  • v0.0.2 (May 4, 2016)

    • Create config option (store-ssl) to enable cert verification to storage backend
    • Add -v and --version as a command
  • v0.0.1 (April 25, 2016)

    • slurp is born

nanobox oss logo

Documentation

Overview

Slurp is an intermediary to the stored build/blob, used specifically to speed up publishing nanobox builds.

Usage

To start slurp as a server, simply run:

slurp

For more specific usage information, refer to the help doc (slurp -h):

Usage:
  slurp [flags]

Flags:
  -a, --api-address="https://127.0.0.1:1566": Listen uri for the API (scheme defaults to https)
  -t, --api-token="secret": Token for API Access
  -b, --build-dir="/var/db/slurp/build/": Build staging directory
  -c, --config-file="": Configuration file to load
  -i, --insecure[=true]: Disable tls certificate verification when connecting to storage
  -l, --log-level="info": Log level to output [fatal|error|info|debug|trace]
  -s, --ssh-addr="127.0.0.1:1567": Address ssh server will listen on (ip:port combo)
  -k, --ssh-host="/var/db/slurp/slurp_rsa": SSH host (private) key file
  -S, --store-addr="hoarders://127.0.0.1:7410": Storage host address
  -T, --store-token="": Storage auth token
  -v, --version[=false]: Print version info and exit

Directories

Path Synopsis
Package "api" defines the routes accessible and the logic when they are hit.
Package "api" defines the routes accessible and the logic when they are hit.
Package "backend" is the layer between slurp and the long stored blobs.
Package "backend" is the layer between slurp and the long stored blobs.
Package "config" is a central location for configuration options.
Package "config" is a central location for configuration options.
Package "slurp" contains the core logic to fetch, pipe, and un/compress builds.
Package "slurp" contains the core logic to fetch, pipe, and un/compress builds.
Package "ssh" contains the ssh server logic.
Package "ssh" contains the ssh server logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL