0.3.1 • Published 8 years ago

hobs-registry v0.3.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Hobs Registry

status-stable Build Status

Quarry is Hobs' community repository for packages, currently hosted at quarry.crambit.com. The registry can also be used internally in your organization, behind the firewall.

Requirements

  • Node.js 0.10+
  • MongoDB 2.6+
  • Memcached 1.4.0+

Installation

$ npm install hobs-registry

API function list

Find packages

$ curl https://quarry.crambit.com/api/packages?q=zeta-server

List packages

$ curl https://quarry.crambit.com/api/packages?direction=desc&sort=downloads

Response

[
  {
    "_id": "56d4c6b4a8a954b4210ff930",
    "name": "zeta-server",
    "description": "Zeta server monitoring",
    "tags": [ "#zeta" ],
    "owner": {
      "_id": "56cc29c42b445817e010c45b",
      "name": "bob",
      "email": "bob@example.com"
    },
    "latest_version": "0.1.0",
    "url": "https://github.com/elafleur/zeta-server",
    "created_at": "2015-12-02T13:28:38.108Z",
    "updated_at": "2015-12-02T13:28:38.108Z",
    "downloads": 23
  },
]

Download package

$ curl https://quarry.crambit.com/api/packages/zeta-server/download?version=latest \
     -o zeta-server.tar.gz

Publish package

$ curl -X POST https://quarry.crambit.com/api/packages \
     -H "Authorization: Bearer <JSON_Web_Token>" \
     --data-binary "@horuspack.tar.gz"

or

$ curl -X POST https://quarry.crambit.com/api/packages \
     -H "Authorization: Bearer <JSON_Web_Token>" \
     -d url=https://github.com/elafleur/zeta-server

Unpublish package

$ curl -X DELETE https://quarry.crambit.com/api/packages \
     -H "Authorization: Bearer <JSON_Web_Token>" \
     -d name=zeta-server

It is generally considered bad behavior to remove a package that others are depending on!

Register

$ curl -X POST https://quarry.crambit.com/api/users \
     -d name=jack \
     -d email=jack@example.net \
     -d password=secret_password

Login

$ curl -X POST https://quarry.crambit.com/api/users \
     -u username:password

Response

  {
    "name": "jack",
    "registry": "quarry.crambit.com",
    "token": "<JSON_Web_Token>"
  }

Logout

$ curl -X POST https://quarry.crambit.com/api/users/logout \
     -H "Authorization: Bearer <JSON_Web_Token>"

This will invalidate the current token associated to your user on the registry.

Configuration

KeyDescriptionDefault Value
portListening port3000
bindBind address'0.0.0.0'
hostExternal host address'localhost:3000'
secureSecure protocol (https)false
skipValidationSkip checking repo via gitfalse
skipNormalizationLeave ssh URLs as isfalse
tmpDirTemp directory'/tmp'
maxSizePackage size limit in bytes1000000
token.secretSecret to sign JWTs'secret_token'
token.expiresInJWTs TTL'30d'
database.urlMongoDB address'mongodb://127.0.0.1:27017/reg_dev'
memcached.serversMemcached server addresses'127.0.0.1:11211'
memcached.usernameMemcached usernamenull
memcached.passwordMemcached passwordnull
mailer.transportTransport configuration'smtp'
mailer.options.urlTransporter optionsnull

Testing

Make sure you installed MongoDB and Memcached and properly configured config/test.js, and then:

$ NODE_ENV=test npm test

License

MIT