• Stars
    star
    100
  • Rank 338,730 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple, api-driven storage system for storing code builds and cached libraries for cloud-based deployment services.

Hoarder

Build Status GoDoc

Hoarder is a simple, api-driven, storage system for storing anything for cloud based deployment services.

Usage

As a server

To start hoarder as a server run:

hoarder --server

An optional config file can also be passed on startup:

hoarder --server --config /path/to/config

As a CLI

Simply run hoarder <COMMAND>

hoarder or hoarder -h will show usage and a list of commands:

Usage:
  hoarder [flags]
  hoarder [command]

Available Commands:
  add         Add file to hoarder storage
  list        List all files in hoarder storage
  remove      Remove a file from hoarder storage
  show        Display a file from the hoarder storage
  update      Update a file in hoarder

Flags:
  -b, --backend string       Hoarder backend (default "file:///var/db/hoarder")
  -g, --clean-after uint     Age, in seconds, after which data is deemed garbage (default 0)
  -c, --config string        Path to config file (with extension)
  -H, --listen-addr string   Hoarder listen uri (scheme defaults to https) (default "https://127.0.0.1:7410")
      --log-level string     Output level of logs (TRACE, DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
  -s, --server               Run hoarder as a server
  -t, --token string         Auth token used when connecting to a secure Hoarder
  -v, --version              Display the current version of this CLI

Use "hoarder [command] --help" for more information about a command.

Configuration

To configure hoarder, a config.yml file can be passed with --config. Configuration read in through a file will overwrite the same configuration specified by a flag. If no config file is passed, and no flags are set, reasonable defaults will be used.

backend     : "file:///var/db/hoarder"    # the pluggable backend the api will use for storage
listen-addr : "https://127.0.0.1:7410"    # the connection host uri (scheme defaults to https)
log-level   : "INFO"                      # the output log level (trace, debug, info, warn, error, fatal)
server      : false                       # run as a server
token       : ""                          # the secure token used to connect with (no auth by default)

API:

| Method |     Route     | Functionality |
------------------------------------------
| GET    | /blobs/{:id} | Retrieve a blob
| HEAD   | /blobs/{:id} | Retrieve file information about a blob
| POST   | /blobs/{:id} | Publish a new blob
| PUT    | /blobs/{:id} | Update an existing blob
| DELETE | /blobs/{:id} | Remove an existing blob
| GET    | /blobs       | List all blobs
| HEAD   | /blobs       | Retrieve file information for all blobs

Examples

ping:
$ curl -k https://localhost:7410/ping
=> pong
create:
$ curl -k https://localhost:7410/blobs/test -d "data"
=> 'test' created!
get:
$ curl -k https://localhost:7410/blobs/test
=> data
get head:
$ curl -k https://localhost:7410/blobs/test -I
=> HTTP/1.1 200 OK
=> Content-Length: 4
=> Date: Tue, 01 Mar 2016 21:14:28 UTC
=> Last-Modified: Tue, 01 Mar 2016 21:13:57 UTC
=> Content-Type: text/plain; charset=utf-8
update:
$ curl -k https://localhost:7410/blobs/test -d "new data" -X PUT
=> 'test' created!
list:
$ curl -k https://localhost:7410/blobs
=> [{"Name":"test","Size":4,"ModTime":"2016-03-01T21:13:57.534706044Z"}]
delete:
$ curl -k https://localhost:7410/blobs/test -X DELETE
=> 'test' destroyed!

Note: all examples are run without auth. If auth was enabled when the server was started then an additional header needs to be present:

-H "X-AUTH-TOKEN: TOKEN"

Data

Hoarder simply stores whatever data you give it as a string. So you can literally store whatever you want as long is it can be "stringified".

Some examples of what data could look like when creating a new blob:

string
$ curl -k https://localhost:7410/blobs/test -d "some string"
JSON
$ curl -k https://localhost:7410/blobs/test -d "{\"key\":\"value\"}"

When it retrieves data it might look like the following:

{
	"Name": "test",
	"Size": 4,
	"ModTime": "2016-03-01T21:13:57.534706044Z"
}

Todo

Contributing

Contributions to hoarder are welcome and encouraged. Hoarder is a Nanobox project and contributions should follow the Nanobox Contribution Process & Guidelines.

open source

More Repositories

1

yoke

Postgres high-availability cluster with auto-failover and automated cluster recovery.
Go
1,344
star
2

mist

A distributed, tag-based pub-sub service for modern web applications and container-driven cloud.
Go
664
star
3

shaman

Small, lightweight, api-driven dns server.
Go
449
star
4

portal

An api-driven, in-kernel layer 2/3 load balancer.
Go
103
star
5

redundis

Redis high-availability cluster using Sentinel to transparently proxy connections to the active primary member.
Go
88
star
6

logvac

Simple, lightweight, api-driven log aggregation service with realtime push capabilities and historical persistence.
Go
70
star
7

shon

A simple tool to convert json or yaml into a shell-compliant data structure.
Go
47
star
8

pulse

Dynamic, api-driven stats collector service for realtime stats publishing and historical aggregation with Influxdb.
Go
46
star
9

nanoinit

A small, proper, init process for docker containers.
C
44
star
10

red

A fast, in-kernel, ad-hoc point-to-point vxlan network.
C
34
star
11

flip

Simple, lightweight, virtual IP management utility for moving IPs around nodes in response to cluster events.
Lua
22
star
12

redd

The red management plane daemon.
C
20
star
13

narc

Small utility to watch log files and ship to syslog service.
C
18
star
14

hookit

A devops configuration management tool that responds to events, with a chef-like dsl.
Ruby
14
star
15

shuttle

Lightweight, transparent, api-driven tcp proxy service.
10
star
16

sherpa

DEPRECATED - An api-driven approach to building machine images with Packer.
Go
8
star
17

nanopack.github.io

HTML for the Nanopack site
HTML
4
star
18

nanopack

Hub for nanopack resources and content
3
star
19

siphon

A simple output stream formatter
C
3
star
20

mist-client-js

Javascript client for interacting with the mist service
JavaScript
2
star