capistrano-conjure 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 +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/History.md +4 -0
- data/License.txt +21 -0
- data/README.md +89 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/capistrano-conjure.gemspec +21 -0
- data/lib/capistrano-conjure.rb +0 -0
- data/lib/capistrano/conjure.rb +2 -0
- data/lib/capistrano/conjure/version.rb +5 -0
- data/lib/capistrano/tasks/conjure.cap +34 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0de9b71f3ea3a3db83e2794eab26204977d2000f
|
4
|
+
data.tar.gz: e6c891052b85e4e202671406ce150f2c72139152
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 70139ed1d6e4fc3557f010fb5c39ef6c04e2766c5af0cd215f79996fc6d47f5aa1b3f22ea5415470ef216a5773c05d7e4baeea120487cee8037a944587d45bfc
|
7
|
+
data.tar.gz: 617ed9a7c4dec07e2ba46dd4205797145168370cb3b8be44a75a9ae5e4445994051491ae6052b30bde59b8a7d25a503f2e557367aba2204a0e137c21da7e02a0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/History.md
ADDED
data/License.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Brian Auton
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
## Capistrano::Conjure
|
2
|
+
|
3
|
+
Capistrano-conjure adds commands for Capistrano 3.x that use [Conjure](https://github.com/brianauton/conjure) to create and update cloud servers suitable for deploying with Capistrano.
|
4
|
+
|
5
|
+
WARNING: Capistrano-conjure creates server instances and other resources using service provider accounts that you specify. In most cases this incurs service charges that will recur until you explicitly cancel them. You are responsible for all charges incurred through your use of Capistrano-conjure.
|
6
|
+
|
7
|
+
WARNING: Capistrano-conjure attempts to have a good security model and to treat your code and data responsibly, but this is not guaranteed. You are responsible for the security and confidentiality of the code of applications deployed with Capistrano-conjure, the data handled by these applications, and your service credentials and public keys used for deployment.
|
8
|
+
|
9
|
+
### Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'capistrano-conjure'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install capistrano-conjure
|
24
|
+
|
25
|
+
### Usage
|
26
|
+
|
27
|
+
Add this line to your `Capfile`:
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
require 'capistrano/conjure'
|
31
|
+
```
|
32
|
+
|
33
|
+
Then you can provision a new server for any stage defined in your Capistrano configuration:
|
34
|
+
|
35
|
+
``` bash
|
36
|
+
$ cap staging conjure:provision
|
37
|
+
```
|
38
|
+
|
39
|
+
After provisioning is complete, you'll see some data about the new instance that needs to be added back to your capistrano configuration. For example,
|
40
|
+
|
41
|
+
```bash
|
42
|
+
Provisioning complete. Add the following settings to Capistrano:
|
43
|
+
ip_address: 11.22.33.44
|
44
|
+
port: 2222
|
45
|
+
user: app
|
46
|
+
```
|
47
|
+
|
48
|
+
You'll need to add these values to the configuration for your Capistrano stage before you can deploy. For example, if the stage you just provisioned is defined in `config/deploy/staging.rb`, you could change the first line of the file to this:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
server "11.22.33.44", roles: [:web, :app, :db], user: "app", port: 2222
|
52
|
+
```
|
53
|
+
|
54
|
+
Then you're ready to deploy to your new server instance as normal.
|
55
|
+
|
56
|
+
```bash
|
57
|
+
cap staging deploy
|
58
|
+
```
|
59
|
+
|
60
|
+
### Updating an existing instance
|
61
|
+
|
62
|
+
Conjure can update existing server instances, to continue an interrupted provisioning or to rebuild any containers that are missing.
|
63
|
+
|
64
|
+
```bash
|
65
|
+
cap staging conjure:update
|
66
|
+
```
|
67
|
+
|
68
|
+
This will expect to find a Conjure-provisioned server at the IP address configured for the stage. If you want to update an existing server to the latest version of Conjure or change its provisioning options, you can manually delete the `passenger` Docker container from the server and then use this command (an easier way to do this may be added in the future).
|
69
|
+
|
70
|
+
### Conjure options
|
71
|
+
|
72
|
+
Conjure has several options that control the staging instance and the environment that it contains for running your Rails application. All these options are listed in the README file for the [Conjure project](https://github.com/brianauton/conjure). You can add any of these options to the `conjure_options` setting in your Capistrano configuration, and they'll be used for all conjure-related commands. For example, you could add this to your `config/deploy/staging.rb`:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
set :conjure_options, {
|
76
|
+
max_upload_mb: 300,
|
77
|
+
system_packages: [:pdftk],
|
78
|
+
}
|
79
|
+
```
|
80
|
+
|
81
|
+
### Development
|
82
|
+
|
83
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec capistrano-conjure` to use the gem in this directory, ignoring other installed copies of this gem.
|
84
|
+
|
85
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
86
|
+
|
87
|
+
### Contributing
|
88
|
+
|
89
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/brianauton/capistrano-conjure](https://github.com/brianauton/capistrano-conjure).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "capistrano/conjure"
|
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,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/conjure/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano-conjure"
|
8
|
+
spec.version = Capistrano::Conjure::VERSION
|
9
|
+
spec.authors = ["Brian Auton"]
|
10
|
+
spec.email = ["brianauton@gmail.com"]
|
11
|
+
spec.summary = "Conjure provisioning support for Capistrano 3.x"
|
12
|
+
spec.homepage = "https://github.com/brianauton/capistrano-conjure"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
spec.add_dependency "capistrano", "~> 3.0"
|
17
|
+
spec.add_dependency "conjure", "~> 0.2.10"
|
18
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
19
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
20
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
21
|
+
end
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "conjure"
|
2
|
+
|
3
|
+
namespace :conjure do
|
4
|
+
desc "Provision a new server with Conjure"
|
5
|
+
task :provision do
|
6
|
+
instance = Conjure::Instance.create conjure_options
|
7
|
+
puts "Provisioning complete. Add the following settings to Capistrano:"
|
8
|
+
[:ip_address, :port, :user].each { |k, v| puts " #{k}: #{instance.send k}" }
|
9
|
+
puts "Create these files on the server before deploying:" if instance.pending_files.any?
|
10
|
+
instance.pending_files.each { |f| puts " #{f}" }
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Update an existing server with Conjure"
|
14
|
+
task :update do
|
15
|
+
ip_address = roles(:all).first.hostname
|
16
|
+
Conjure::Instance.update conjure_options.merge(ip_address: ip_address)
|
17
|
+
puts "Update complete."
|
18
|
+
end
|
19
|
+
|
20
|
+
def conjure_options
|
21
|
+
options_from_cap_environment.merge(options_from_user)
|
22
|
+
end
|
23
|
+
|
24
|
+
def options_from_cap_environment
|
25
|
+
{
|
26
|
+
app_name: fetch(:application),
|
27
|
+
rails_env: (fetch(:rails_env) || fetch(:stage)),
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def options_from_user
|
32
|
+
fetch(:conjure_options, {})
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-conjure
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Auton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-04 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: conjure
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.10
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.10
|
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.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
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
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.4'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- brianauton@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- History.md
|
95
|
+
- License.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- capistrano-conjure.gemspec
|
101
|
+
- lib/capistrano-conjure.rb
|
102
|
+
- lib/capistrano/conjure.rb
|
103
|
+
- lib/capistrano/conjure/version.rb
|
104
|
+
- lib/capistrano/tasks/conjure.cap
|
105
|
+
homepage: https://github.com/brianauton/capistrano-conjure
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.4.5.1
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Conjure provisioning support for Capistrano 3.x
|
129
|
+
test_files: []
|