capistrano-jelastic 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +17 -15
- data/capistrano-jelastic.gemspec +0 -1
- data/lib/capistrano-jelastic.rb +1 -0
- data/lib/capistrano/install.rb +2 -0
- data/lib/capistrano/jelastic.rb +1 -0
- data/lib/capistrano/jelastic/version.rb +1 -1
- data/lib/capistrano/tasks/install_capistrano_jelastic.rake +45 -0
- data/lib/capistrano/templates/Capfile +8 -0
- data/lib/capistrano/templates/deploy.rb.erb +8 -0
- data/lib/capistrano/templates/stage.rb.erb +37 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9c4cddb6eaa2b8a06c1219e7989204b0a61290d
|
4
|
+
data.tar.gz: cbc622ff434cbf3f6be6b9a88c3739593e3f9312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13da783232fcbc1fd936a0d725c3b6794559e6ed8e225fc34a40a7be0d7854197cd22c7b7c3840a3c46be166f7497539942b132d52fa0466119a283f472f6eaf
|
7
|
+
data.tar.gz: cffd23f50773a05dbd8bdaeae0ae8ca188d45f63c65d622c41dd5f80350ccea8f0880d5c0546d5e85140a343bf5d1877c019b00022491172ee2859e6d29e3a01
|
data/README.md
CHANGED
@@ -8,15 +8,24 @@ Add this line to your application's Gemfile:
|
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
# Use Capistrano for deployment
|
11
|
-
group :development
|
12
|
-
# Capistrano gem and others also included in this gem
|
13
|
-
gem 'capistrano-jelastic', github: 'gerardo-navarro/capistrano-jelastic'
|
14
|
-
end
|
11
|
+
gem 'capistrano-jelastic', group: :development
|
15
12
|
```
|
16
13
|
|
17
|
-
|
14
|
+
Do `bundle install`
|
18
15
|
|
19
|
-
|
16
|
+
Do `bundle exec cap install` and adjust the deployment config variables in the generated files:
|
17
|
+
- `config/deploy.rb` - general config variables for thw whole deployment
|
18
|
+
- `config/deploy/{production,staging}.rb` - specific config variables for each deployment environment
|
19
|
+
|
20
|
+
Finalize the setup on the deployment jelastic machine by:
|
21
|
+
- Adding `export RAILS_ENV=production` to `~/.bashrc`
|
22
|
+
- Adding `passenger_app_env production;` to `/etc/nginx/app_servers/nginx-passenger.conf`
|
23
|
+
|
24
|
+
Now you can do `bundle exec cap production deploy` and everything should be taken care of ;-D
|
25
|
+
|
26
|
+
## Generated capistrano deployment files
|
27
|
+
|
28
|
+
### `Capfile`
|
20
29
|
```ruby
|
21
30
|
# This import will load all other necessary scripts, e.g. capistrano/rvm or capistrano/bundler
|
22
31
|
# It will also import all capistrano rake tasks within the installed gems (lib/capistrano/tasks/*.rake)
|
@@ -25,9 +34,8 @@ require 'capistrano/jelastic'
|
|
25
34
|
Rake::Task[:production].invoke
|
26
35
|
```
|
27
36
|
|
28
|
-
|
37
|
+
### `config/deploy.rb`
|
29
38
|
```ruby
|
30
|
-
|
31
39
|
# Define the name of the application
|
32
40
|
set :application, 'some_cool_app_name'
|
33
41
|
|
@@ -38,7 +46,7 @@ set :application, 'some_cool_app_name'
|
|
38
46
|
set :repo_url, 'https://github.com/gerardo-navarro/capistrano-jelastic'
|
39
47
|
```
|
40
48
|
|
41
|
-
|
49
|
+
### `config/deploy/{production,staging}.rb`
|
42
50
|
```ruby
|
43
51
|
# Custom Roles Config
|
44
52
|
# ==================
|
@@ -76,12 +84,6 @@ set :linked_files, fetch(:linked_files, []) | ['config/database.yml', 'config/se
|
|
76
84
|
# Feel free to include any config variable in the `config/deploy.rb` or in config/deploy/*.rb to customize your setup. This variables will override the default values defined in `lib/capistrano/tasks/capistrano_jelastic_defaults.cap`. For available Capistrano configuration variables see the documentation page: http://capistranorb.com/documentation/getting-started/configuration/
|
77
85
|
```
|
78
86
|
|
79
|
-
Finalize the setup on the jelastic machine by:
|
80
|
-
- Adding `export RAILS_ENV=production` to `~/.bashrc`
|
81
|
-
- Adding `passenger_app_env production;` to `/etc/nginx/app_servers/nginx-passenger.conf`
|
82
|
-
|
83
|
-
Now you can do `bundle exec cap production deploy` and everything should be taken care of ;-D
|
84
|
-
|
85
87
|
## Contributing
|
86
88
|
|
87
89
|
You are more than welcome to constribute to this repository.
|
data/capistrano-jelastic.gemspec
CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
18
|
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
19
|
spec.require_paths = ["lib"]
|
21
20
|
|
22
21
|
spec.required_ruby_version = '>= 2.0'
|
data/lib/capistrano-jelastic.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
# require 'capistrano/dsl/task_enhancements_extension'
|
@@ -0,0 +1,2 @@
|
|
1
|
+
# When capistrano is executed, this file overrides the lib/capistrano/install.rb in the capistrano gem (https://github.com/capistrano/capistrano/blob/master/lib/capistrano/install.rb) and redirects to a custom install rake tasks
|
2
|
+
load File.expand_path(File.join(File.dirname(__FILE__),'tasks/install_capistrano_jelastic.rake'))
|
data/lib/capistrano/jelastic.rb
CHANGED
@@ -13,6 +13,7 @@ require 'capistrano/rails/migrations'
|
|
13
13
|
|
14
14
|
load File.expand_path('../tasks/capistrano_jelastic_defaults.cap', __FILE__)
|
15
15
|
load File.expand_path('../tasks/deploy_on_jelastic.cap', __FILE__)
|
16
|
+
load File.expand_path('../tasks/install_capistrano_jelastic.rake', __FILE__)
|
16
17
|
|
17
18
|
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
18
19
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This should be just a copy of https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/install.rake
|
2
|
+
# Unfortunately, we cannot simply "load 'capistrano/tasks/install.rake'", because the path to the template files are hard coded and bound to the capistrano gem.
|
3
|
+
|
4
|
+
require 'erb'
|
5
|
+
require 'pathname'
|
6
|
+
|
7
|
+
desc 'Install and setting up Capistrano for the Jelastic cloud'
|
8
|
+
task :install do
|
9
|
+
envs = ENV['STAGES'] || 'staging,production'
|
10
|
+
|
11
|
+
tasks_dir = Pathname.new('lib/capistrano/tasks')
|
12
|
+
config_dir = Pathname.new('config')
|
13
|
+
deploy_dir = config_dir.join('deploy')
|
14
|
+
|
15
|
+
deploy_rb = File.expand_path("../../templates/deploy.rb.erb", __FILE__)
|
16
|
+
stage_rb = File.expand_path("../../templates/stage.rb.erb", __FILE__)
|
17
|
+
capfile = File.expand_path("../../templates/Capfile", __FILE__)
|
18
|
+
|
19
|
+
mkdir_p deploy_dir
|
20
|
+
|
21
|
+
entries = [{ template: deploy_rb, file: config_dir.join('deploy.rb') }]
|
22
|
+
entries += envs.split(',').map { |stage| { template: stage_rb, file: deploy_dir.join("#{stage}.rb") } }
|
23
|
+
|
24
|
+
entries.each do |entry|
|
25
|
+
if File.exist?(entry[:file])
|
26
|
+
warn "[skip] #{entry[:file]} already exists"
|
27
|
+
else
|
28
|
+
File.open(entry[:file], 'w+') do |f|
|
29
|
+
f.write(ERB.new(File.read(entry[:template])).result(binding))
|
30
|
+
puts I18n.t(:written_file, scope: :capistrano, file: entry[:file])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
mkdir_p tasks_dir
|
36
|
+
|
37
|
+
if File.exist?('Capfile')
|
38
|
+
warn "[skip] Capfile already exists"
|
39
|
+
else
|
40
|
+
FileUtils.cp(capfile, 'Capfile')
|
41
|
+
puts I18n.t(:written_file, scope: :capistrano, file: 'Capfile')
|
42
|
+
end
|
43
|
+
puts I18n.t :capified, scope: :capistrano
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# This import will load all other necessary scripts, e.g. capistrano/rvm or capistrano/bundler
|
2
|
+
# It will also import all capistrano rake tasks within the installed gems (lib/capistrano/tasks/*.rake)
|
3
|
+
require 'capistrano/jelastic'
|
4
|
+
|
5
|
+
Rake::Task[:production].invoke
|
6
|
+
|
7
|
+
# Load custom tasks from `{RAILS_ROOT}/lib/capistrano/tasks` if you have any defined
|
8
|
+
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Define the name of the application
|
2
|
+
set :application, 'some_cool_app_name' <-- change this
|
3
|
+
|
4
|
+
# Define url to the VCS repository so that capistrano can initiate a checkout; git is autmatically set as version control system
|
5
|
+
# Note: You need to have registered the SSH public key of the jelastic nginx server to the specified source code repository. Otherwise, you’ll get a “Permission denied” error. If there is no public SSH key on the jelastic machine, you need to perform `ssh-keygen` and copy & paste `~/.ssh/id_rsa.pub` in your repository.
|
6
|
+
#
|
7
|
+
# You can also use the HTTPS link of the following type: `set :repo_url, "https://example.net/GIT_user_name/repo_name.git"`
|
8
|
+
set :repo_url, 'https://github.com/some_cool_repository' <-- change this
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Custom Roles Config
|
2
|
+
# ==================
|
3
|
+
# Defines a role with one or multiple servers. Specify the username and a domain or IP for the server.
|
4
|
+
# The of the url is composed of {nodeid}-{uid}@gate.jelastic.{your.hoster}, where `nodeid` is the node ID value of the Apache application server container in your environment and `uid` is the number before @ symbol in your SSH connection string.
|
5
|
+
# Be aware the nodeid of the database should be different to the nodeid of the `app` and `web` role
|
6
|
+
role :app, '123456-78900@gate.jelastic.hoster.com' <-- change this
|
7
|
+
role :web, '123456-78900@gate.jelastic.hoster.com' <-- change this
|
8
|
+
role :db, '123456-78900@gate.jelastic.hoster.com' <-- change this
|
9
|
+
|
10
|
+
# Custom Server Config
|
11
|
+
# ==================
|
12
|
+
# Defines a single server with a list of roles and multiple properties.
|
13
|
+
# See http://docs.jelastic.com/ssh-capistrano
|
14
|
+
server 'gate.jelastic.hoster.com', user: '123456-78900', roles: %w{web app} <-- change this
|
15
|
+
|
16
|
+
# Custom SSH Options
|
17
|
+
# ==================
|
18
|
+
# You may pass any option but keep in mind that net/ssh understands a
|
19
|
+
# limited set of options, consult the Net::SSH documentation.
|
20
|
+
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
|
21
|
+
set :ssh_options, {
|
22
|
+
port: 3022
|
23
|
+
# keys: %w(/home/rlisowski/.ssh/id_rsa),
|
24
|
+
# forward_agent: false,
|
25
|
+
# auth_methods: %w(password)
|
26
|
+
}
|
27
|
+
|
28
|
+
# Configuration
|
29
|
+
# =============
|
30
|
+
# Defines the files that need to be linked in order to inject production properties from the folder `/var/www/webroot/shared/config/`
|
31
|
+
# To get this working you need to ssh-log into the system and `cd /var/www/webroot/shared/config`. Then create the production files you need, e.g. `/var/www/webroot/shared/config/database.yml` or `/var/www/webroot/shared/config/secrets.yml`
|
32
|
+
set :linked_files, fetch(:linked_files, []) | ['config/database.yml', 'config/secrets.yml']
|
33
|
+
|
34
|
+
# Feel free to include any config variable in the `config/deploy.rb` or in config/deploy/*.rb to customize your setup. This variables will override the default values defined in:
|
35
|
+
# https://github.com/gerardo-navarro/capistrano-jelastic/blob/master/lib/capistrano/tasks/capistrano_jelastic_defaults.cap
|
36
|
+
#
|
37
|
+
# For available Capistrano configuration variables see the documentation page: http://capistranorb.com/documentation/getting-started/configuration/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-jelastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerardo Navarro Suarez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -86,11 +86,16 @@ files:
|
|
86
86
|
- capistrano-jelastic.gemspec
|
87
87
|
- circle.yml
|
88
88
|
- lib/capistrano-jelastic.rb
|
89
|
+
- lib/capistrano/install.rb
|
89
90
|
- lib/capistrano/jelastic.rb
|
90
91
|
- lib/capistrano/jelastic/version.rb
|
91
92
|
- lib/capistrano/tasks/capistrano_jelastic_defaults.cap
|
92
93
|
- lib/capistrano/tasks/deploy_on_jelastic.cap
|
94
|
+
- lib/capistrano/tasks/install_capistrano_jelastic.rake
|
93
95
|
- lib/capistrano/tasks/print_config_variables.cap
|
96
|
+
- lib/capistrano/templates/Capfile
|
97
|
+
- lib/capistrano/templates/deploy.rb.erb
|
98
|
+
- lib/capistrano/templates/stage.rb.erb
|
94
99
|
homepage: https://github.com/gerardo-navarro/capistrano-jelastic
|
95
100
|
licenses:
|
96
101
|
- MIT
|