Skip to content

Leiningen plugin for syncing a local directory to an S3 bucket

Notifications You must be signed in to change notification settings

kanej/lein-s3-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lein-s3-sync Build Status

A Leiningen plugin to synchronise the contents of a local folder to a bucket on Amazon's S3 service.

The sync operates recursively within the local file directory. Files are compared by MD5 hash with their remote equivalent and pushed if it does not exist or has been changed locally.

Useful for pushing the html/js/css output files of a leiningen project to S3 for hosting.

The synchronisation functionality is available as a separate lib s3-sync, please see the README in this repo's subfolder.

Usage

Add lein-s3-sync as a plugin dependency of your project or profiles:

Clojars Project

Add to your project or profile an s3-sync config map, specifying your S3 credentials, the bucket to upload to and the local directory to sync:

:s3-sync {
  :access-key "XXX"
  :secret-key "XXX"
  :local-dir  "./out"
  :bucket     "mybucket"
  :public true
  :metadata {:cache-control "public, max-age=31536000"}
}

With the profile map setup, run a sync at the command line:

    $ lein s3-sync

Alternatively, any of the :s3-sync keys can be overriden on the command line:

    $ lein s3-sync :local-dir "./out/public" :bucket "www.mywebsite.com"

An optional parameter of :public true can be set under the :s3-sync map to set uploaded files as readable by all users in S3.

Similarly S3 metadata options against the files can be passed under :metadata:

:s3-sync {
  ...
  :metadata {:cache-control "public, max-age=31536000"}
}

Development

To run the unit tests:

    $ lein sub test

To run the integration tests:

    $ lein sub test :integration

License

Copyright © 2018 Kane

Distributed under the Eclipse Public License, the same as Clojure.

About

Leiningen plugin for syncing a local directory to an S3 bucket

Resources

Stars

Watchers

Forks

Packages

No packages published