Better Deployment with Node.js
Fast, simple deployment of static sites.
var envoy=require'envoy'ftpOptions =username: 'Fluffy'password: 'McChubbers'host: 'ftp.cheeseburger.com's3Options ="bucket": "<BUCKET NAME>""key": "<AWS ACCESS KEY>""secret": "<AWS SECRET KEY>""region": "<AWS REGION>" //us-west-1simpleWebsite ="index.html": '<h1>Welcome, Humans!</h1>'iferrconsoleerr"Uh-oh: " + err;elseconsole.log"Website Deployed!";console.log"Deployment log:";forvar i=0 ii=loglength; i<ii; i++console.loglogi;;// Deploying a local folder to S3envoydeployFolder'./my-website-folder' 's3' s3Options afterDeploy;// Deploying a collection of files to FTPenvoydeployCollectionsimpleWebsite 'ftp' ftpOptions afterDeploy;
You can perform lower level calls with the adapters directly.
var client = './lib/adapters/ftp'opts = username:'donkey' password:'kong';clientbeforeoptsclientput'some_file.txt' 'Some Data'clientafterconsole.log"Done!";;;;
All adapters support three operations
Certain adapters like FTP will support more operations unique to their operation
Take a look at the tests for more.
.envoyfile in the remote directory to speed up future deploys. Make sure your FTP server is configured to show dotfiles.
You'll need a
tests/secrets.json file to run the tests with
jake test. See
tests/secrets.example.json for an example
secrets.json file. To test integration with different backends, you can have multiple secret files, name them
secrets.somestring.json and run the tests with
x-amz-acl = public-readon uploaded objects