probo-asset-receiver
[![Build Status](https://travis-ci.org/ProboCI/probo-asset-receiver.svg?branch=master)](https://travis-ci.org/ProboCI/probo-asset-receiver) [![Coverage Status](https://coveralls.io/repos/ProboCI/probo-asset-receiver/badge.svg?branch=master&service=github)
Last updated 5 years ago by tizzo .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install probo-asset-receiver 
SYNC missed versions from official npm registry.

Probo Asset Receiver

Build Status Coverage Status

Allows the upload of an asset

This project is designed to be used in conjunction with the corresponding CLI client (probo-uploader) to allow you to upload assets for use in probo builds.

Authentication

Token-based authentication can be enabled for all APIs except file upload. To enable it, add at least one token in the config file:

tokens:
  - token1
  - token2

To authenticate API calls use a bearer-token authentication header: Authentication: Bearer token1

curl -H "Authentication: Bearer token1" http://localhost:3000/buckets/foo

Usage

  1. Create a bucket to hold assets.
  2. Create a token that can be used to post assets into that bucket.
  3. Upload an asset into a bucket with the upload token.

1. Create a bucket

The following will create a bucket called foo and store the associated metadata key some with value metadata.

curl -XPOST -H "Content-Type: application/json" -i -d '{"some":"metadata"}' http://localhost:3000/buckets/foo

2. Create a token that can be used to post assets into that bucket

In order to upload assets to a bucket, you'll need an upload token. This is a shared secret (essentially like an API key) that allows you to upload assets to a particular bucket. You can create any number of these tokens per bucket and in

curl -i -XPOST http://localhost:3000/buckets/foo/token/bar

To delete a token:

curl -i -XDELETE http://localhost:3000/buckets/foo/token/bar

3. Use the super secret token to upload a file

The following curl command will upload our database.sql.gz file as raw binary data and name the asset baz for later reference.

curl -i -XPOST --data-binary @database.sql.gz http://localhost:3000/asset/bar/baz

4. Download the file that you uploaded

curl -i http://localhost:3000/asset/bar/baz > baz

5. Using Amazon S3 to storage your assets

You can use Amazon S3 storage to store your assets by using the AwsS3Storage Plugin. There is the example config file AwsS3Storage.config.yaml in this repository. You will need to provide your own access keys and bucket name from your Amazon account. You will want to move your config file outside of your git repo or add it to your .gitignore file. You can then use the config argument -c to tell the Probo Asset Reciever to override the defaults.config.yaml file with your own configuration file. Example:

./bin/probo-asset-receiver -c path/to/config-file/awsS3Storage.config.yaml

6. Pausing and unpausing file uploads

If doing server maintenance, it is often nice to be able to prevent new files from coming in but still allowing existing files to be served. This allows builds to continue to function even though new assets will not be allowed. This is helpful when migrating the files to a new server or system.

curl -X POST -H "Authorization: Bearer" -H content-type:application/json --data-binary '{"uploadsPaused": true}' http://localhost:3000/service/upload-status

Current Tags

  • 2.3.0                                ...           latest (4 years ago)

8 Versions

  • 2.3.0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.0.3                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (14)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |