grunt-azure-cdn-deploy
A Grunt plugin for for uploading files to Azure Blob Storage. Wraps a vanilla node package https://github.com/bestander/grunt-azure-cdn-deploy. It is perfect for deploying compiled assets to Microsoft Azure CDN as a last step in a Continuous Integration setup.
Features
- Ability to execute a "dry run" of deployment. The logging will indicate all files that will be deleted or uploaded but no actual changes to the blob storage will be done
- Ability to gzip content and set a proper content encoding. If gzipped file becomes larger than original then only the original file will be uploaded
- Ability to recursively remove files in a path of Azure Blob Storage
- Ability to control number of concurrent files to be uploaded to avoid network congestion
- Grunt and gulp plugins available
Installing
npm install grunt-azure-cdn-deploy
Using
Deploying a set of files to a path in blob storage
grunt; grunt;
Debugging
run
grunt azure-cdn-deploy --debug
To see the log of deleted and uploaded files
Parameters
deployOptions
- azure cdn and upload configsserviceOptions
: [] - custom arguments to azure.createBlobService, or you can use Azure SDK environment variables AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEYcontainerName
: null - container name, requiredcontainerOptions
: {publicAccessLevel: "blob"} - container optionsfolder
: '', // path within container. Default is root directory of containerdeleteExistingBlobs
: true, // set it to false to skip recursive deleting blobs in folderconcurrentUploadThreads
: 10, // number of concurrent uploads, choose best for your network conditionzip
: false, // true if want to gzip the files before uploading. File will be zipped only if compressed file is smaller than originalmetadata
: {cacheControl: 'public, max-age=31556926'} // metadata for each uploaded filetestRun
: false, // set to true if you just want to check connectivity and see deployment logs. No blobs will be removed or uplaoded.