capistrano-jelastic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5f56ad8d949bd0dfadfec1dfa5e38bb8cb89041
4
+ data.tar.gz: 3597b70f4e53ddf446889e326bab30247d6bdda3
5
+ SHA512:
6
+ metadata.gz: 773fb15cc130c5fcec297a73114da487cf124e7938dd38c66d83501c961a5aeb4f49be39e31d7f8132e90414eb0327f7ba119a9034a5a69a17d685b46fd26f43
7
+ data.tar.gz: 18f11725651801380bfe76eacdd7e70029337841ef2e660e3af94f23fde76f93bc7237504f44c652702137f44acf1160527bc4e3c6526126261875bd3d5927cb
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-jelastic.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Gerardo Navarro Suarez
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,91 @@
1
+ # capistrano-jelastic
2
+
3
+ Deploying rails apps on Jelastic server in an easy way. This gem is an integration for capistrano which incapsulates the capistrano deployment on Jelastic. The deployment flow in this gem is inspired by the official jelastic documentation for capistrano, see https://docs.jelastic.com/ssh-capistrano
4
+
5
+ ## Getting Started
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ # Use Capistrano for deployment
11
+ group :development do
12
+ # Capistrano gem and others also included in this gem
13
+ gem 'capistrano-jelastic', github: 'gerardo-navarro/capistrano-jelastic'
14
+ end
15
+ ```
16
+
17
+ And then execute: `bundle install`
18
+
19
+ Create `{RAILS_ROOT}/Capfile` file and add the following lines:
20
+ ```ruby
21
+ # This import will load all other necessary scripts, e.g. capistrano/rvm or capistrano/bundler
22
+ # It will also import all capistrano rake tasks within the installed gems (lib/capistrano/tasks/*.rake)
23
+ require 'capistrano/jelastic'
24
+
25
+ Rake::Task[:production].invoke
26
+ ```
27
+
28
+ Create `{RAILS_ROOT}/config/deploy.rb` to define general config for all deployment environments. Add the following config entries to this file:
29
+ ```ruby
30
+
31
+ # Define the name of the application
32
+ set :application, 'some_cool_app_name'
33
+
34
+ # Define url to the VCS repository so that capistrano can initiate a checkout; git is autmatically set as version control system
35
+ # 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.
36
+ #
37
+ # You can also use the HTTPS link of the following type: `set :repo_url, "https://example.net/GIT_user_name/repo_name.git"`
38
+ set :repo_url, 'https://github.com/gerardo-navarro/capistrano-jelastic'
39
+ ```
40
+
41
+ Create `{RAILS_ROOT}/config/deploy/production.rb` to define config for a specific deployment environment:
42
+ ```ruby
43
+ # Custom Roles Config
44
+ # ==================
45
+ # Defines a role with one or multiple servers. Specify the username and a domain or IP for the server.
46
+ # 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.
47
+ # Be aware the nodeid of the database should be different to the nodeid of the `app` and `web` role
48
+ role :app, '123456-78900@gate.jelastic.hoster.com' <-- change this
49
+ role :web, '123456-78900@gate.jelastic.hoster.com' <-- change this
50
+ role :db, '123456-78900@gate.jelastic.hoster.com' <-- change this
51
+
52
+ # Custom Server Config
53
+ # ==================
54
+ # Defines a single server with a list of roles and multiple properties.
55
+ # See http://docs.jelastic.com/ssh-capistrano
56
+ server 'gate.jelastic.hoster.com', user: '123456-78900', roles: %w{web app} <-- change this
57
+
58
+ # Custom SSH Options
59
+ # ==================
60
+ # You may pass any option but keep in mind that net/ssh understands a
61
+ # limited set of options, consult the Net::SSH documentation.
62
+ # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
63
+ set :ssh_options, {
64
+ port: 3022
65
+ # keys: %w(/home/rlisowski/.ssh/id_rsa),
66
+ # forward_agent: false,
67
+ # auth_methods: %w(password)
68
+ }
69
+
70
+ # Configuration
71
+ # =============
72
+ # Defines the files that need to be linked in order to inject production properties from the folder `/var/www/webroot/shared/config/`
73
+ # 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`
74
+ set :linked_files, fetch(:linked_files, []) | ['config/database.yml', 'config/secrets.yml']
75
+
76
+ # 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
+ ```
78
+
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
+ ## Contributing
86
+
87
+ You are more than welcome to constribute to this repository.
88
+
89
+ ## License
90
+
91
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "capistrano/jelastic"
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,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/jelastic/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-jelastic"
8
+ spec.version = Capistrano::Jelastic::VERSION
9
+ spec.authors = ['Gerardo Navarro Suarez']
10
+ spec.email = ['gerardo.navarro@edeka.de']
11
+
12
+ spec.summary = %q{Deploying rails apps on Jelastic server in an easy way.}
13
+ spec.description = %q{Deploying rails apps on Jelastic server in an easy way. This gem is an integration for capistrano which incapsulates the capistrano deployment on Jelastic. The deployment flow in this gem is inspired by the official jelastic documentation for capistrano, see https://docs.jelastic.com/ssh-capistrano }
14
+ spec.homepage = 'https://github.com/gerardo-navarro/capistrano-jelastic'
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "bundler", "~> 1.10"
23
+ spec.add_dependency 'capistrano', '~> 3.1'
24
+ # Because rvm is used on jelastic to handle ruby versions
25
+ spec.add_dependency 'capistrano-rvm'
26
+ spec.add_dependency 'capistrano-bundler'
27
+ spec.add_dependency 'capistrano-rails'
28
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Jelastic
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # Load DSL and set up stages
2
+ require 'capistrano/setup'
3
+
4
+ # Include default deployment tasks
5
+ require 'capistrano/deploy'
6
+
7
+ # Loading normal stuff
8
+ require 'capistrano/rvm'
9
+ require 'capistrano/bundler'
10
+ require 'capistrano/rails/assets'
11
+ require 'capistrano/rails/migrations'
12
+ # require 'capistrano/nginx'
13
+
14
+ load File.expand_path('../tasks/capistrano_jelastic_defaults.cap', __FILE__)
15
+ load File.expand_path('../tasks/deploy_on_jelastic.cap', __FILE__)
16
+
17
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
18
+
19
+ # Rake::Task[:production].invoke?
@@ -0,0 +1,24 @@
1
+ namespace :load do
2
+
3
+ task :capistrano_jelastic_defaults do
4
+
5
+ # Locking the capistrano version to '3.4.0'
6
+ lock '3.4.0'
7
+
8
+ # Default branch is :master
9
+ # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
10
+ ask :branch, 'master'
11
+ set :deploy_to, '/var/www/webroot'
12
+ set :scm, :git
13
+ set :format, :pretty
14
+ set :log_level, :debug
15
+ set :pty, true
16
+
17
+ # Default value for linked_dirs is []
18
+ set :linked_dirs, fetch(:linked_dirs, []) | ['log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system']
19
+
20
+ set :seeding_enabled, true
21
+ end
22
+
23
+ after :defaults, :capistrano_jelastic_defaults
24
+ end
@@ -0,0 +1,49 @@
1
+ namespace :deploy do
2
+
3
+ desc 'Creating symlink'
4
+ task :symlink do
5
+ on roles(:app) do
6
+ execute :rm, "-rf #{fetch(:deploy_to)}/ROOT"
7
+ execute :ln, "-s #{fetch(:deploy_to)}/current #{deploy_path}/ROOT"
8
+ end
9
+ end
10
+
11
+ desc "reload the database with seed data"
12
+ task :seed => [:set_rails_env] do
13
+ if fetch :seeding_enabled
14
+ on primary fetch(:migration_role) do
15
+ within release_path do
16
+ with rails_env: fetch(:rails_env) do
17
+ execute :rake, "db:seed"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ #Just restart the app, do not restart the whole webserver!
25
+ #desc 'Restart Nginx and create symlink'
26
+ #task :restart do
27
+ # on roles(:app) do
28
+ # execute :touch, release_path.join('tmp/restart.txt')
29
+ # end
30
+ #end
31
+
32
+ #before :restart, "nginx:reload"
33
+ #before :restart, :prepare_symlinks_for_capistrano
34
+
35
+ desc 'restart passenger'
36
+ task :restart_passenger do
37
+ on roles(:web), in: :groups, limit: 3, wait: 10 do
38
+ within release_path do
39
+ execute :touch, 'tmp/restart.txt'
40
+ end
41
+ end
42
+ end
43
+
44
+ before :restart, :symlink
45
+ after :restart, :restart_passenger
46
+
47
+ end
48
+
49
+ after 'deploy:publishing', 'deploy:restart'
@@ -0,0 +1,17 @@
1
+ # namespace :deploy do
2
+ # task :print_config_variables do
3
+ # puts
4
+ # puts '------- Printing all config variables -------'
5
+ # env.keys.each do |config_variable_key|
6
+ # if is_question?(config_variable_key)
7
+ # puts "#{config_variable_key.inspect} => Question (awaits user input on next fetch(#{config_variable_key.to_sym}))"
8
+ # else
9
+ # puts "#{config_variable_key.inspect} => #{fetch(config_variable_key).inspect}"
10
+ # end
11
+ # end
12
+
13
+ # puts
14
+ # end
15
+ # end
16
+
17
+ # before 'deploy:starting', 'deploy:print_config_variables'
File without changes
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-jelastic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gerardo Navarro Suarez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-16 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.10'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capistrano
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capistrano-rvm
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: capistrano-bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: capistrano-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: 'Deploying rails apps on Jelastic server in an easy way. This gem is
84
+ an integration for capistrano which incapsulates the capistrano deployment on Jelastic.
85
+ The deployment flow in this gem is inspired by the official jelastic documentation
86
+ for capistrano, see https://docs.jelastic.com/ssh-capistrano '
87
+ email:
88
+ - gerardo.navarro@edeka.de
89
+ executables: []
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - .gitignore
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - capistrano-jelastic.gemspec
101
+ - lib/capistrano-jelastic.rb
102
+ - lib/capistrano/jelastic.rb
103
+ - lib/capistrano/jelastic/version.rb
104
+ - lib/capistrano/tasks/capistrano_jelastic_defaults.cap
105
+ - lib/capistrano/tasks/deploy_on_jelastic.cap
106
+ - lib/capistrano/tasks/print_config_variables.cap
107
+ homepage: https://github.com/gerardo-navarro/capistrano-jelastic
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.8
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Deploying rails apps on Jelastic server in an easy way.
131
+ test_files: []