GithubHelp home page GithubHelp logo

deploy-s3's Introduction

Deploy S3

Build Status

Usage

Install with npm:

npm i --save deploy-s3

In your package.json, you must have the following properties defined:

"name": "oms-ui"
"deploy": "myDeployDirectory/"

In a file or in env variables, you must have the credentials for using S3:

{
    "key": "somestring",
    "secret": "somebigstring"
} 

In your task runner, create a knox-compatible S3 client and deploy:

S3Deployer = require 'deploy-s3'

# Read your package.json file
pkg = JSON.parse fs.readFileSync './package.json'

# Read your access key and secret key
credentials = JSON.parse fs.readFileSync '/credentials.json'

# Choose your bucket
credentials.bucket = 'vtex-io'

# Create a client with your credentials
client = knox.createClient credentials

# Create a new S3Deployer 
deployer = new S3Deployer(pkg, client)

doneHandler = -> console.log 'Done'
failHandler = console.error
progressHandler = console.log

# deploy() returns a promise and notifies of each uploaded file
deployer.deploy().then doneHandler, failHandler, progressHandler

This will cause every file under myDeployDirectory/ to be deployed to the vtex-io bucket under the oms-ui directory.

If your doneHandler is called, that means your deploy is complete.

Options

S3Deployer accepts a third parameter with options:

dryrun: if upload should be skipped. Defaults to false.
chunk: how many files to upload in parallel. Defaults to 20.
batchTimeout: timeout for entire upload. millis. Defaults to 1000 * 60 * 5.
fileTimeout: timeout for upload of each file. millis. Defaults to 1000 * 30.

deploy-s3's People

Contributors

guifromrio avatar tarunc avatar

Watchers

 avatar  avatar  avatar

Forkers

adrianoaguiar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.