Giter Site home page Giter Site logo

capistrano-s3_archive's Introduction

Capistrano::S3Archive

Caution: This repo uses code that is specific to a particular workflow. It's not useful outside of this workflow. Strongly suggest you use the upstream plugin: https://github.com/komazarari/capistrano-s3_archive

Capistrano::S3Archive is an extention of Capistrano which enables to set :scm, :s3_archive.

This behaves like the capistrano-rsync except downloading sources from S3 instead of GIT by default.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-s3_archive'

And then execute:

$ bundle

Usage

set :scm, :s3_archive in your config file.

Set a S3 path containing source archives to repo_url. For example, if you has following tree,

s3://yourbucket/somedirectory/
                  |- 201506011200.zip
                  |- 201506011500.zip
                  ...
                  |- 201506020100.zip
                  `- 201506030100.zip

then set :repo_url, 's3://yourbucket/somedirectory'.

Set parameters to access Amazon S3:

set :s3_client_options, { region: 'ap-northeast-1', credentials: somecredentials }

And set regular capistrano options. To deploy staging:

$ bundle exec cap staging deploy

Or to skip download & extruct archive and deploy local files:

$ bundle exec cap staging deploy_only

Configuration

Set parameters with set :key, value.

Rsync Strategy (default)

Key Default Description
branch latest The S3 Object basename to download. Support :latest or such as '201506011500.zip'.
sort_proc ->(a,b) { b.key <=> a.key } Sort algorithm used to detect :latest object basename. It should be proc object for a,b as Aws::S3::Object comparing.
rsync_options ['-az'] Options used to rsync.
local_cache tmp/deploy Path where to extruct your archive on local for staging and rsyncing. Can be both relative or absolute.
rsync_cache shared/deploy Path where to cache your repository on the server to avoid rsyncing from scratch each time. Can be both relative or absolute.
Set to nil if you want to disable the cache.
s3_archive tmp/archives Path where to download source archives. Can be both relative or absolute.
Experimental configration
Key Default Description
hardlink nil Enable --link-dest option when remote rsyncing. It could speed deployment up in the case rsync_cache enabled.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/capistrano-s3_archive/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.