Skip to content

bitterblue/lein-s3-static-deploy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Lein task to deploy static website to s3 bucket.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 100.0%