Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 2.37 KB

README.md

File metadata and controls

59 lines (39 loc) · 2.37 KB

lein-s3-static-deploy

A Leiningen plugin to deploy a directory as a static website on s3.

Simply give it your AWS credentials, a bucket name and a directory to deploy and it will ensure the bucket exists with the correct permissions etc. It employs s3-sync to ensure that only changed files are uploaded.

This plugin was built to support the use case of creating a static Angular ClojureScript app.

Configuration

To use lein-s3-static-deploy, you'll need to add a few additional values to your project.clj file.

First, add lein-s3-static-deploy as a plugin: Put [lein-s3-static-deploy "0.1.0"] into the :plugins vector.

Put [lein-s3-static-deploy "0.1.0"] into the :plugins vector of your project.clj.

You'll also need to give lein-s3-static-deploy a few instructions so it knows what to do.

lein-s3-static-deploy plays nice with other aws plugins such as lein-beanstalk and shares their configuration block so you don't have to repeat AWS credentials etc..

So inside your project.clj do:

:aws { :access-key ~(System/getenv "AWS_ACCESS_KEY") :secret-key ~(System/getenv "AWS_SECRET_KEY") :endpoint "REGION-SPECIFIC ENDPOINT" :s3-static-deploy {:bucket "THE BUCKET YOU WANT TO DEPLOY TO" :local-root "LOCAL DIRECTORY YOU WANT TO DEPLOY FROM"}}

The :endpoint keyword is only required if you want to connect to a region-specific endpoint (see list of regions and endpoints). This may be necessary for buckets in regions that only support AWS Signature Version 4.

Deploy

You should now be able to deploy your website to the AWS using the following command:

$ lein s3-static-deploy

Thanks

Thanks to s3-sync for providing the functionality to efficiently sync contents to the s3 bucket and clj-aws-s3 for providing a nice S3 API.

Contributions welcome

This plugin is very simple and supports our narrow use case. We would welcome contributions so please fork away!

License

Copyright © 2014 Thoughtworks Inc

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.