capistrano-s3_archive 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +83 -0
- data/Rakefile +1 -0
- data/Vagrantfile +21 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/capistrano-s3_archive.gemspec +27 -0
- data/lib/capistrano/s3_archive/version.rb +5 -0
- data/lib/capistrano/s3_archive.rb +136 -0
- data/lib/capistrano/tasks/s3_archive.rake +44 -0
- data/vagrant_example/.insecure_private_key +27 -0
- data/vagrant_example/Capfile +27 -0
- data/vagrant_example/Gemfile +5 -0
- data/vagrant_example/config/deploy/production.rb +7 -0
- data/vagrant_example/config/deploy.rb +50 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f929af3d48043349bb6daae12fbab57f89944eff
|
4
|
+
data.tar.gz: 795364463429bd33d45273d179ee4164d8b1d6b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 94a42525f5804a5ed3f44dd3de4c03e2a199888844f6395432a41560d599b3a9e5190207430dddf8a8a88f1bc26b48873e5115b91876ba9bbf49386e11e074ba
|
7
|
+
data.tar.gz: bdb87791a1eb8b1f583f3d6ab426bf281acf8c673220ad4ea2ee74d7565fa363db8aa2fedf80e4634c97f21c70c7efefd36c4d8e934c4881961876c678159ed3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Capistrano::S3Archive
|
2
|
+
|
3
|
+
Capistrano::S3Archive is an extention of [Capistrano](http://www.capistranorb.com/) which enables to `set :scm, :s3_archive`.
|
4
|
+
|
5
|
+
This behaves like the [capistrano-rsync](https://github.com/moll/capistrano-rsync) except downloading sources from S3 instead of GIT by default.
|
6
|
+
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'capistrano-s3_archive', github: 'komazarari/capistrano-s3_archive'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
<!-- Or install it yourself as: -->
|
21
|
+
|
22
|
+
<!-- $ gem install capistrano-s3_archive -->
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
`set :scm, :s3_archive` in your config file.
|
27
|
+
|
28
|
+
Set a S3 path containing source archives to `repo_url`. For example, if you has following tree,
|
29
|
+
|
30
|
+
s3://yourbucket/somedirectory/
|
31
|
+
|- 201506011200.zip
|
32
|
+
|- 201506011500.zip
|
33
|
+
...
|
34
|
+
|- 201506020100.zip
|
35
|
+
`- 201506030100.zip
|
36
|
+
|
37
|
+
then `set :repo_url, 's3://yourbucket/somedirectory'`.
|
38
|
+
|
39
|
+
Set parameters to access Amazon S3:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
set :s3_client_options, { region: 'ap-northeast-1', credentials: somecredentials }
|
43
|
+
```
|
44
|
+
|
45
|
+
And set regular capistrano options. To deploy staging:
|
46
|
+
```
|
47
|
+
$ bundle exec cap staging deploy
|
48
|
+
```
|
49
|
+
|
50
|
+
Or to skip download & extruct archive and deploy local files:
|
51
|
+
```
|
52
|
+
$ bundle exec cap staging deploy_only
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
### Configuration
|
57
|
+
Set parameters with `set :key, value`.
|
58
|
+
|
59
|
+
#### Rsync Strategy (default)
|
60
|
+
|
61
|
+
Key | Default | Description
|
62
|
+
--------------|---------|------------
|
63
|
+
branch | `latest` | The S3 Object basename to download. Support `:latest` or such as `'201506011500.zip'`.
|
64
|
+
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.
|
65
|
+
rsync_options | `['-az']` | Options used to rsync.
|
66
|
+
local_cache | `tmp/deploy` | Path where to extruct your archive on local for staging and rsyncing. Can be both relative or absolute.
|
67
|
+
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.<br> Set to `nil` if you want to disable the cache.
|
68
|
+
s3_archive | `tmp/archives` | Path where to download source archives. Can be both relative or absolute.
|
69
|
+
|
70
|
+
|
71
|
+
## Development
|
72
|
+
|
73
|
+
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.
|
74
|
+
|
75
|
+
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](https://rubygems.org).
|
76
|
+
|
77
|
+
## Contributing
|
78
|
+
|
79
|
+
1. Fork it ( https://github.com/[my-github-username]/capistrano-s3_archive/fork )
|
80
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
81
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
82
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
83
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Vagrantfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure(2) do |config|
|
5
|
+
config.vm.box = "ubuntu/trusty64"
|
6
|
+
|
7
|
+
config.vm.provision "shell", inline: <<-SHELL
|
8
|
+
if ! dpkg -l | grep ruby2.2 > /dev/null; then
|
9
|
+
apt-add-repository ppa:brightbox/ruby-ng
|
10
|
+
apt-get update
|
11
|
+
apt-get install ruby2.2 -y
|
12
|
+
fi
|
13
|
+
gem install bundler --no-ri --no-rdoc
|
14
|
+
cp /vagrant/vagrant_example/.insecure_private_key /home/vagrant/.ssh/insecure_key
|
15
|
+
chmod 400 /home/vagrant/.ssh/insecure_key
|
16
|
+
chown vagrant:vagrant /home/vagrant/.ssh/insecure_key
|
17
|
+
if ! grep "`ssh-keygen -y -f .ssh/insecure_key`" /home/vagrant/.ssh/authorized_keys ;then
|
18
|
+
ssh-keygen -y -f .ssh/insecure_key >> .ssh/authorized_keys
|
19
|
+
fi
|
20
|
+
SHELL
|
21
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "capistrano/s3_archive"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/s3_archive/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano-s3_archive"
|
8
|
+
spec.version = Capistrano::S3Archive::VERSION
|
9
|
+
spec.authors = ["Takuto Komazaki"]
|
10
|
+
spec.email = ["komazarari@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Capistrano deployment from an archive on Amazon S3.}
|
13
|
+
spec.description = %q{Capistrano deployment from an archive on Amazon S3.}
|
14
|
+
spec.homepage = "https://github.com/komazarari/capistrano-s3_archive"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
22
|
+
spec.add_dependency 'capistrano', '~> 3.0'
|
23
|
+
spec.add_dependency 'aws-sdk-core', '~> 2.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
load File.expand_path("../tasks/s3_archive.rake", __FILE__)
|
2
|
+
|
3
|
+
require "capistrano/s3_archive/version"
|
4
|
+
require 'capistrano/scm'
|
5
|
+
require 'aws-sdk-core'
|
6
|
+
|
7
|
+
set :rsync_options, ['-az']
|
8
|
+
set :rsync_copy, "rsync --archive --acls --xattrs"
|
9
|
+
set :rsync_cache, "shared/deploy"
|
10
|
+
set :local_cache, "tmp/deploy"
|
11
|
+
set :s3_archive, "tmp/archives"
|
12
|
+
set :sort_proc, ->(a,b) { b.key <=> a.key }
|
13
|
+
|
14
|
+
module Capistrano
|
15
|
+
module S3Archive
|
16
|
+
class SCM < Capistrano::SCM
|
17
|
+
include FileUtils
|
18
|
+
attr_accessor :bucket, :object_prefix
|
19
|
+
|
20
|
+
def initialize(*args)
|
21
|
+
super
|
22
|
+
@bucket, @object_prefix = parse_s3_uri(repo_url)
|
23
|
+
set :local_cache_dir, "#{fetch(:local_cache)}/#{fetch(:stage)}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_object
|
27
|
+
s3_client.get_object(bucket: bucket, key: archive_object_key)
|
28
|
+
end
|
29
|
+
|
30
|
+
def list_objects(all_page = true)
|
31
|
+
response = s3_client.list_objects(bucket: bucket, prefix: object_prefix)
|
32
|
+
if all_page
|
33
|
+
response.inject([]) do |objects, page|
|
34
|
+
objects += page.contents
|
35
|
+
end
|
36
|
+
else
|
37
|
+
response
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def archive_object_key
|
42
|
+
@archive_object_key ||=
|
43
|
+
case fetch(:branch)
|
44
|
+
when :master, :latest, nil
|
45
|
+
latest_object_key
|
46
|
+
else
|
47
|
+
[object_prefix, fetch(:branch)].join('/')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def s3_client
|
53
|
+
@s3_client ||= Aws::S3::Client.new(fetch(:s3_client_options))
|
54
|
+
end
|
55
|
+
|
56
|
+
def latest_object_key
|
57
|
+
list_objects.sort(&fetch(:sort_proc)).first.key
|
58
|
+
end
|
59
|
+
|
60
|
+
def parse_s3_uri(uri)
|
61
|
+
pathes = uri.split('://')[1].split('/')
|
62
|
+
[pathes.first, pathes.drop(1).join('/')]
|
63
|
+
end
|
64
|
+
|
65
|
+
### Default strategy
|
66
|
+
private
|
67
|
+
module RsyncStrategy
|
68
|
+
def check
|
69
|
+
list_objects(false)
|
70
|
+
end
|
71
|
+
|
72
|
+
def stage
|
73
|
+
archive_file = File.join(fetch(:s3_archive), fetch(:stage).to_s, File.basename(archive_object_key))
|
74
|
+
if not File.exist?(archive_file)
|
75
|
+
mkdir_p(File.dirname(archive_file))
|
76
|
+
content = get_object.body.read
|
77
|
+
File.open(archive_file, 'w') do |f|
|
78
|
+
f.write(content)
|
79
|
+
end
|
80
|
+
else
|
81
|
+
context.info "#{archive_file} is found."
|
82
|
+
end
|
83
|
+
|
84
|
+
remove_entry_secure(fetch(:local_cache_dir)) if File.exist? fetch(:local_cache_dir)
|
85
|
+
mkdir_p(fetch(:local_cache_dir))
|
86
|
+
case archive_file
|
87
|
+
when /\.zip\Z/
|
88
|
+
dir = archive_file.gsub(/\.zip\Z/, '')
|
89
|
+
cmd = "unzip -q -d #{fetch(:local_cache_dir)} #{archive_file}"
|
90
|
+
when /\.tar\.gz\Z|\.tar\.bz2\Z/
|
91
|
+
dir = archive_file.gsub(/\.tar\.gz\Z|\.tar\.bz2\Z/, '')
|
92
|
+
cmd = "tar xf #{archive_file} -C #{fetch(:local_cache_dir)}"
|
93
|
+
end
|
94
|
+
|
95
|
+
run_locally do
|
96
|
+
execute cmd
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def release(server = context.host)
|
101
|
+
user = server.user + '@' unless server.user.nil?
|
102
|
+
key = server.keys.first || Array(server.ssh_options[:keys]).first
|
103
|
+
|
104
|
+
rsync = ['rsync']
|
105
|
+
rsync.concat fetch(:rsync_options)
|
106
|
+
rsync << fetch(:local_cache_dir) + '/'
|
107
|
+
rsync << "-e 'ssh -i #{key}'"
|
108
|
+
rsync << "#{user}#{server.hostname}:#{rsync_cache || release_path}"
|
109
|
+
|
110
|
+
run_locally do
|
111
|
+
execute *rsync
|
112
|
+
end
|
113
|
+
|
114
|
+
unless fetch(:rsync_cache).nil?
|
115
|
+
cache = rsync_cache
|
116
|
+
on server do
|
117
|
+
copy = %(#{fetch(:rsync_copy)} "#{cache}/" "#{release_path}/")
|
118
|
+
execute copy
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def current_revision
|
124
|
+
archive_object_key
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
def rsync_cache
|
129
|
+
cache = fetch(:rsync_cache)
|
130
|
+
cache = deploy_to + "/" + cache if cache && cache !~ /^\//
|
131
|
+
cache
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
namespace :s3_archive do
|
2
|
+
|
3
|
+
def strategy
|
4
|
+
@strategy ||= Capistrano::S3Archive::SCM.new(self, fetch(:s3_archive_strategy, Capistrano::S3Archive::SCM::RsyncStrategy))
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'Check that the S3 buckets are reachable'
|
8
|
+
task :check do
|
9
|
+
on release_roles :all do
|
10
|
+
strategy.check
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Extruct and stage the S3 archive in a stage directory'
|
15
|
+
task :stage do
|
16
|
+
if fetch(:skip_staging, false)
|
17
|
+
run_locally do
|
18
|
+
info "Skip extructing and staging."
|
19
|
+
end
|
20
|
+
else
|
21
|
+
on release_roles :all do
|
22
|
+
strategy.stage
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Copy repo to releases'
|
28
|
+
task :create_release => :stage do
|
29
|
+
on release_roles :all do |server|
|
30
|
+
execute :mkdir, '-p', release_path
|
31
|
+
strategy.release(server)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Determine the revision that will be deployed'
|
36
|
+
task :set_current_revision do
|
37
|
+
set :current_revision, strategy.current_revision
|
38
|
+
end
|
39
|
+
end unless Rake::Task.task_defined?("s3_archive:check")
|
40
|
+
|
41
|
+
task :deploy_only do
|
42
|
+
set :skip_staging, true
|
43
|
+
invoke :deploy
|
44
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
|
3
|
+
w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
|
4
|
+
kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
|
5
|
+
hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
|
6
|
+
Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
|
7
|
+
yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
|
8
|
+
ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
|
9
|
+
Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
|
10
|
+
TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
|
11
|
+
iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
|
12
|
+
sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf
|
13
|
+
4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP
|
14
|
+
cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk
|
15
|
+
EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN
|
16
|
+
CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX
|
17
|
+
3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG
|
18
|
+
YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
|
19
|
+
3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
|
20
|
+
dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
|
21
|
+
6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
|
22
|
+
P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
|
23
|
+
llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
|
24
|
+
kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
|
25
|
+
+vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
|
26
|
+
NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Load DSL and set up stages
|
2
|
+
require 'capistrano/setup'
|
3
|
+
|
4
|
+
# Include default deployment tasks
|
5
|
+
require 'capistrano/deploy'
|
6
|
+
|
7
|
+
# Include tasks from other gems included in your Gemfile
|
8
|
+
#
|
9
|
+
# For documentation on these, see for example:
|
10
|
+
#
|
11
|
+
# https://github.com/capistrano/rvm
|
12
|
+
# https://github.com/capistrano/rbenv
|
13
|
+
# https://github.com/capistrano/chruby
|
14
|
+
# https://github.com/capistrano/bundler
|
15
|
+
# https://github.com/capistrano/rails
|
16
|
+
# https://github.com/capistrano/passenger
|
17
|
+
#
|
18
|
+
# require 'capistrano/rvm'
|
19
|
+
# require 'capistrano/rbenv'
|
20
|
+
# require 'capistrano/chruby'
|
21
|
+
# require 'capistrano/bundler'
|
22
|
+
# require 'capistrano/rails/assets'
|
23
|
+
# require 'capistrano/rails/migrations'
|
24
|
+
# require 'capistrano/passenger'
|
25
|
+
|
26
|
+
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
27
|
+
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# config valid only for current version of Capistrano
|
2
|
+
lock '3.4.0'
|
3
|
+
|
4
|
+
set :application, 'my_app_name'
|
5
|
+
|
6
|
+
set :repo_url, 's3://<YOUR_BUCKET>/<PREFIX>'
|
7
|
+
set :s3_client_options, { region: 'ap-northeast-1' } # and credentials, etc if needed
|
8
|
+
|
9
|
+
# Default branch is :master
|
10
|
+
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
|
11
|
+
|
12
|
+
# Default deploy_to directory is /var/www/my_app_name
|
13
|
+
set :deploy_to, '/home/vagrant/my_app_name'
|
14
|
+
|
15
|
+
# Default value for :scm is :git
|
16
|
+
set :scm, :s3_archive
|
17
|
+
|
18
|
+
# Default value for :format is :pretty
|
19
|
+
# set :format, :pretty
|
20
|
+
|
21
|
+
# Default value for :log_level is :debug
|
22
|
+
# set :log_level, :debug
|
23
|
+
|
24
|
+
# Default value for :pty is false
|
25
|
+
# set :pty, true
|
26
|
+
|
27
|
+
# Default value for :linked_files is []
|
28
|
+
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
|
29
|
+
|
30
|
+
# Default value for linked_dirs is []
|
31
|
+
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
|
32
|
+
|
33
|
+
# Default value for default_env is {}
|
34
|
+
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
35
|
+
|
36
|
+
# Default value for keep_releases is 5
|
37
|
+
# set :keep_releases, 5
|
38
|
+
|
39
|
+
namespace :deploy do
|
40
|
+
|
41
|
+
after :restart, :clear_cache do
|
42
|
+
on roles(:web), in: :groups, limit: 3, wait: 10 do
|
43
|
+
# Here we can do anything such as:
|
44
|
+
# within release_path do
|
45
|
+
# execute :rake, 'cache:clear'
|
46
|
+
# end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-s3_archive
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takuto Komazaki
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk-core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: Capistrano deployment from an archive on Amazon S3.
|
70
|
+
email:
|
71
|
+
- komazarari@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- Vagrantfile
|
82
|
+
- bin/console
|
83
|
+
- bin/setup
|
84
|
+
- capistrano-s3_archive.gemspec
|
85
|
+
- lib/capistrano/s3_archive.rb
|
86
|
+
- lib/capistrano/s3_archive/version.rb
|
87
|
+
- lib/capistrano/tasks/s3_archive.rake
|
88
|
+
- vagrant_example/.insecure_private_key
|
89
|
+
- vagrant_example/Capfile
|
90
|
+
- vagrant_example/Gemfile
|
91
|
+
- vagrant_example/config/deploy.rb
|
92
|
+
- vagrant_example/config/deploy/production.rb
|
93
|
+
homepage: https://github.com/komazarari/capistrano-s3_archive
|
94
|
+
licenses: []
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 2.0.0
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.2.2
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Capistrano deployment from an archive on Amazon S3.
|
116
|
+
test_files: []
|