vagrant-capistrano 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/Vagrantfile +144 -0
- data/lib/vagrant/capistrano/config.rb +41 -0
- data/lib/vagrant/capistrano/plugin.rb +21 -0
- data/lib/vagrant/capistrano/provisioner.rb +32 -0
- data/lib/vagrant/capistrano/version.rb +5 -0
- data/lib/vagrant/capistrano.rb +3 -0
- data/vagrant-capistrano.gemspec +23 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a5946799050c81410f4d157820c316043266d58f
|
4
|
+
data.tar.gz: 645a902a282df9ff5c19df637d90389154364a1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 540e3bf84aaf7d22e505bb237c79264d52bf40e22df5239548ecc400eb7f58f96b4b8de90e43f10641af90aef6f6f306c7a28e61e11260c88060b6ee666f738f
|
7
|
+
data.tar.gz: ecf9deece10e735b9cc6a8f755eb83d9d5823b2d80aafd69b48e72002c64974613dc5513a8d4d115b3c7a50e54fbe7d5930c7ab48bf3b01ab57af6164b2a12c3
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in vagrant-capistrano.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# useful when developing the plugin
|
7
|
+
group :development do
|
8
|
+
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
|
9
|
+
end
|
10
|
+
|
11
|
+
group :plugins do
|
12
|
+
gem "vagrant-capistrano", path: "."
|
13
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 ART+COM
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Vagrant::Capistrano
|
2
|
+
|
3
|
+
This vagrant-plugin allows you to call capistrano from vagrant. Useful in combination with the puppet provisioner.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
vagrant plugin install vagrant-capistrano
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
config.vm.provision "capistrano" do |cap|
|
15
|
+
cap.capfile = '../some-project/Capfile'
|
16
|
+
cap.rubystring = 'ruby-2.0.0-p458@project'
|
17
|
+
cap.stage = 'testing'
|
18
|
+
cap.post_setup_tasks = ['rvm:install']
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
This provisioner will set the following environment variables before executing capistrano:
|
23
|
+
|
24
|
+
```
|
25
|
+
DEPLOYMENT_USER = 'vagrant' (or whatever the vagrant ssh user is set to)
|
26
|
+
SSH_IDENTITY = private ssh key of the DEPLOYMENT_USER
|
27
|
+
HOSTS= IP address and port of the vagrant ssh daemon
|
28
|
+
```
|
29
|
+
|
30
|
+
In order for this plugin to successfully execute your capsitrano tasks, should your include the following in your Capfile (or deploy.rb):
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
# required for vagrant
|
34
|
+
set :ssh_options, { keys: [ENV['SSH_IDENTITY']] } if ENV['SSH_IDENTITY']
|
35
|
+
set :user, ENV['DEPLOYMENT_USER'] || "deployment"
|
36
|
+
```
|
37
|
+
|
38
|
+
This provisioner will cd into the directory containing your Capfile, then perform
|
39
|
+
|
40
|
+
```
|
41
|
+
cap (stage) rvm_install_ruby
|
42
|
+
cap (stage) deploy:setup
|
43
|
+
```
|
44
|
+
|
45
|
+
then any capistrano tasks in post_setup_tasks, followed by
|
46
|
+
|
47
|
+
```
|
48
|
+
cap (stage) deploy
|
49
|
+
```
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it ( http://github.com/artcom/vagrant-capistrano/fork )
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Vagrantfile
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
# All Vagrant configuration is done here. The most common configuration
|
9
|
+
# options are documented and commented below. For a complete reference,
|
10
|
+
# please see the online documentation at vagrantup.com.
|
11
|
+
|
12
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
13
|
+
config.vm.box = "ubuntu/trusty64"
|
14
|
+
|
15
|
+
# Disable automatic box update checking. If you disable this, then
|
16
|
+
# boxes will only be checked for updates when the user runs
|
17
|
+
# `vagrant box outdated`. This is not recommended.
|
18
|
+
# config.vm.box_check_update = false
|
19
|
+
|
20
|
+
# Create a forwarded port mapping which allows access to a specific port
|
21
|
+
# within the machine from a port on the host machine. In the example below,
|
22
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
23
|
+
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
24
|
+
|
25
|
+
# Create a private network, which allows host-only access to the machine
|
26
|
+
# using a specific IP.
|
27
|
+
# config.vm.network "private_network", ip: "192.168.33.10"
|
28
|
+
|
29
|
+
# Create a public network, which generally matched to bridged network.
|
30
|
+
# Bridged networks make the machine appear as another physical device on
|
31
|
+
# your network.
|
32
|
+
# config.vm.network "public_network"
|
33
|
+
|
34
|
+
# If true, then any SSH connections made will enable agent forwarding.
|
35
|
+
# Default value: false
|
36
|
+
# config.ssh.forward_agent = true
|
37
|
+
|
38
|
+
# Share an additional folder to the guest VM. The first argument is
|
39
|
+
# the path on the host to the actual folder. The second argument is
|
40
|
+
# the path on the guest to mount the folder. And the optional third
|
41
|
+
# argument is a set of non-required options.
|
42
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
43
|
+
|
44
|
+
# Provider-specific configuration so you can fine-tune various
|
45
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
46
|
+
# Example for VirtualBox:
|
47
|
+
#
|
48
|
+
# config.vm.provider "virtualbox" do |vb|
|
49
|
+
# # Don't boot with headless mode
|
50
|
+
# vb.gui = true
|
51
|
+
#
|
52
|
+
# # Use VBoxManage to customize the VM. For example to change memory:
|
53
|
+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# View the documentation for the provider you're using for more
|
57
|
+
# information on available options.
|
58
|
+
|
59
|
+
# Enable provisioning with CFEngine. CFEngine Community packages are
|
60
|
+
# automatically installed. For example, configure the host as a
|
61
|
+
# policy server and optionally a policy file to run:
|
62
|
+
#
|
63
|
+
# config.vm.provision "cfengine" do |cf|
|
64
|
+
# cf.am_policy_hub = true
|
65
|
+
# # cf.run_file = "motd.cf"
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# You can also configure and bootstrap a client to an existing
|
69
|
+
# policy server:
|
70
|
+
#
|
71
|
+
# config.vm.provision "cfengine" do |cf|
|
72
|
+
# cf.policy_server_address = "10.0.2.15"
|
73
|
+
# end
|
74
|
+
|
75
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
76
|
+
# are contained in a directory path relative to this Vagrantfile.
|
77
|
+
# You will need to create the manifests directory and a manifest in
|
78
|
+
# the file default.pp in the manifests_path directory.
|
79
|
+
#
|
80
|
+
# config.vm.provision "puppet" do |puppet|
|
81
|
+
# puppet.manifests_path = "manifests"
|
82
|
+
# puppet.manifest_file = "site.pp"
|
83
|
+
# end
|
84
|
+
|
85
|
+
config.vm.provision "capistrano" do |cap|
|
86
|
+
cap.capfile = "~/dev/mz/mz-back-end-deployment/exco/mz-exco-web/Capfile"
|
87
|
+
cap.stage = "testing"
|
88
|
+
cap.apache_vhost = "exco-web"
|
89
|
+
cap.apache_port = "8080"
|
90
|
+
cap.config = {
|
91
|
+
app_settings: {
|
92
|
+
foo: "bar"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
end
|
96
|
+
config.vm.provision "capistrano" do |cap|
|
97
|
+
cap.capfile = "../exco/websockets_bridge/Capfile"
|
98
|
+
cap.stage = "testing"
|
99
|
+
cap.apache_vhost = "websockets-bridge"
|
100
|
+
cap.apache_port = "8080"
|
101
|
+
cap.config = {
|
102
|
+
app_settings: {
|
103
|
+
foo: "bar"
|
104
|
+
}
|
105
|
+
}
|
106
|
+
end
|
107
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
108
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
109
|
+
# some recipes and/or roles.
|
110
|
+
#
|
111
|
+
# config.vm.provision "chef_solo" do |chef|
|
112
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
113
|
+
# chef.roles_path = "../my-recipes/roles"
|
114
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
115
|
+
# chef.add_recipe "mysql"
|
116
|
+
# chef.add_role "web"
|
117
|
+
#
|
118
|
+
# # You may also specify custom JSON attributes:
|
119
|
+
# chef.json = { mysql_password: "foo" }
|
120
|
+
# end
|
121
|
+
|
122
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
123
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
124
|
+
#
|
125
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
126
|
+
# ORGNAME in the URL and validation key.
|
127
|
+
#
|
128
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
129
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
130
|
+
# validation key to validation.pem.
|
131
|
+
#
|
132
|
+
# config.vm.provision "chef_client" do |chef|
|
133
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
134
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# If you're using the Opscode platform, your validator client is
|
138
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
139
|
+
#
|
140
|
+
# If you have your own Chef Server, the default validation client name is
|
141
|
+
# chef-validator, unless you changed the configuration.
|
142
|
+
#
|
143
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
144
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module Capistrano
|
5
|
+
|
6
|
+
class Config < Vagrant.plugin(2, :config)
|
7
|
+
attr_accessor :capfile
|
8
|
+
attr_accessor :rubystring
|
9
|
+
attr_accessor :stage
|
10
|
+
attr_accessor :post_setup_tasks
|
11
|
+
attr_accessor :hiera_root
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@capfile = UNSET_VALUE
|
15
|
+
@rubystring = UNSET_VALUE
|
16
|
+
@stage = UNSET_VALUE
|
17
|
+
@post_setup_tasks = []
|
18
|
+
@hiera_root = UNSET_VALUE
|
19
|
+
end
|
20
|
+
|
21
|
+
def finalize!
|
22
|
+
@capfile = nil if @capfile == UNSET_VALUE
|
23
|
+
@rubystring = nil if @rubystring == UNSET_VALUE
|
24
|
+
@stage = nil if @stage == UNSET_VALUE
|
25
|
+
@post_setup_tasks = nil if @post_setup_tasks == UNSET_VALUE
|
26
|
+
@hiera_root = nil if @hiera_root == UNSET_VALUE
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def validate(machine)
|
31
|
+
errors = []
|
32
|
+
|
33
|
+
if !@capfile
|
34
|
+
errors << "missing capfile parameter"
|
35
|
+
end
|
36
|
+
|
37
|
+
return { :capistrano => errors }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Capistrano
|
3
|
+
class Plugin < Vagrant.plugin("2")
|
4
|
+
name "vagrant-capistrano"
|
5
|
+
description <<-DESC
|
6
|
+
A Vagrant plugin to install capified projects.
|
7
|
+
DESC
|
8
|
+
|
9
|
+
config :capistrano, :provisioner do
|
10
|
+
require_relative "config"
|
11
|
+
Config
|
12
|
+
end
|
13
|
+
|
14
|
+
provisioner :capistrano do
|
15
|
+
require_relative "provisioner"
|
16
|
+
Provisioner
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Capistrano
|
3
|
+
|
4
|
+
class Provisioner < Vagrant.plugin(2, :provisioner)
|
5
|
+
|
6
|
+
def provision
|
7
|
+
@machine.env.ui.info "provisioning: #{@config.capfile} with #{@config.rubystring}"
|
8
|
+
env = {
|
9
|
+
"BUNDLE_GEMFILE" => nil,
|
10
|
+
"DEPLOYMENT_USER" => @machine.ssh_info[:username],
|
11
|
+
"SSH_IDENTITY" => @machine.ssh_info[:private_key_path].join(":"),
|
12
|
+
"HOSTS" => "#{@machine.ssh_info[:host]}:#{@machine.ssh_info[:port]}",
|
13
|
+
"HIERA_ROOT" => File.expand_path(@config.hiera_root),
|
14
|
+
"HIERA_CONFIG_PATH" => File.join(File.expand_path(@config.hiera_root),'hiera.yaml')
|
15
|
+
}
|
16
|
+
rvm_do = "rvm #{@config.rubystring} do "
|
17
|
+
commands = ["cd #{File.dirname(@config.capfile)}"]
|
18
|
+
commands << "#{rvm_do} cap #{@config.stage} rvm:install_ruby"
|
19
|
+
commands << "#{rvm_do} cap #{@config.stage} deploy:setup"
|
20
|
+
@config.post_setup_tasks.each do |task|
|
21
|
+
commands << "#{rvm_do} cap #{@config.stage} #{task}"
|
22
|
+
end
|
23
|
+
system(env, commands.join(" && "))
|
24
|
+
|
25
|
+
# now do cap deploy
|
26
|
+
commands = ["cd #{File.dirname(@config.capfile)}"]
|
27
|
+
commands << "#{rvm_do} cap #{@config.stage} deploy"
|
28
|
+
system(env, commands.join(" && "))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant/capistrano/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-capistrano"
|
8
|
+
spec.version = VagrantPlugins::Capistrano::VERSION
|
9
|
+
spec.authors = ["Martin Skinner"]
|
10
|
+
spec.email = ["martin@artcom.de"]
|
11
|
+
spec.summary = %q{Capistrano Provisioner for Vagrant}
|
12
|
+
spec.description = %q{Allows you to call capistrano from vargrant}
|
13
|
+
spec.homepage = "https://github.com/artcom/vagrant-capistrano"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-capistrano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Skinner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Allows you to call capistrano from vargrant
|
42
|
+
email:
|
43
|
+
- martin@artcom.de
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- Vagrantfile
|
54
|
+
- lib/vagrant/capistrano.rb
|
55
|
+
- lib/vagrant/capistrano/config.rb
|
56
|
+
- lib/vagrant/capistrano/plugin.rb
|
57
|
+
- lib/vagrant/capistrano/provisioner.rb
|
58
|
+
- lib/vagrant/capistrano/version.rb
|
59
|
+
- vagrant-capistrano.gemspec
|
60
|
+
homepage: https://github.com/artcom/vagrant-capistrano
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Capistrano Provisioner for Vagrant
|
84
|
+
test_files: []
|