cap_bootstrap 0.2 → 0.3.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.
data/README.md CHANGED
@@ -32,26 +32,12 @@ In your project, run the following:
32
32
 
33
33
  capify .
34
34
 
35
- Overwrite the default deploy.rb with the following:
36
-
37
- require "bundler/capistrano"
38
- require "cap_bootstrap/capistrano"
39
- server "99.99.99.99", :web, :app, :db, primary: true
40
- set :user, "deployer"
41
- set :application, "blog"
42
- set :deploy_to, "/home/#{user}/apps/#{application}"
43
- set :deploy_via, :remote_cache
44
- set :use_sudo, false
45
- set :scm, "git"
46
- set :repository, "git@github.com:GITHUB_USER/#{application}.git"
47
- set :branch, "master"
48
- default_run_options[:pty] = true
49
- ssh_options[:forward_agent] = true
50
- after "deploy", "deploy:cleanup" # keep only the last 5 releases
51
-
52
- Customize the server IP address, the application name, and the repository.
53
-
54
- Back in your project:
35
+ Then run this generator with an optional IP address to copy over a deploy.rb that is more suited to this gem.
36
+ The application name defaults to the same name as your rails app and the repository is pulled from your .git/config.
37
+
38
+ rails g cap_bootstrap:install 99.99.99.99
39
+
40
+ Double check the settings in config/deploy.rb and then run:
55
41
 
56
42
  cap deploy:install
57
43
  cap deploy:setup
@@ -59,11 +45,17 @@ Back in your project:
59
45
 
60
46
  ## Advanced Options
61
47
 
48
+ Shown below are the default advanced settings, but they can overridden.
49
+
50
+ ### Setup
51
+
52
+ set(:domain) { "#{application}.com" }
53
+
62
54
  ### PostgreSQL
63
55
 
64
56
  set :postgresql_host, "localhost"
65
- set :postgresql_user { application }
66
- set :postgresql_database { "#{application}_production" }
57
+ set(:postgresql_user) { application }
58
+ set(:postgresql_database) { "#{application}_production" }
67
59
 
68
60
  ### Ruby
69
61
 
@@ -72,16 +64,19 @@ Back in your project:
72
64
 
73
65
  ### Unicorn
74
66
 
75
- set :unicorn_user { user }
76
- set :unicorn_pid { "#{current_path}/tmp/pids/unicorn.pid" }
77
- set :unicorn_config { "#{shared_path}/config/unicorn.rb" }
78
- set :unicorn_log { "#{shared_path}/log/unicorn.log" }
67
+ set(:unicorn_user) { user }
68
+ set(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
69
+ set(:unicorn_config) { "#{shared_path}/config/unicorn.rb" }
70
+ set(:unicorn_log) { "#{shared_path}/log/unicorn.log" }
79
71
  set :unicorn_workers, 2
80
72
 
81
73
  ## Future Plans
82
74
 
83
75
  Version 0.1 uses Ryan's recipes pulled directly from Railscast episode #337 Capistrano Recipes. You will always be able to access this version
84
- with tag v0.1. Future versions will incorporate optional installs such as MySQL, Apache, Phusion Passenger and additional server config such as setting a hostname and installing a firewall.
76
+ with tag v0.1.
77
+
78
+ Future versions will incorporate optional installs such as MySQL, Apache, Phusion Passenger and additional server config such as setting a hostname.
79
+ Also considering changes to allow deploying multiple apps onto a single server and provisioning Linode slices using their api.
85
80
 
86
81
  ## Alternatives
87
82
 
@@ -2,9 +2,16 @@ upstream unicorn_<%= application %> {
2
2
  server unix:/tmp/unicorn.<%= application %>.sock fail_timeout=0;
3
3
  }
4
4
 
5
+ # Redirect example.com to www.example.com
6
+ #server {
7
+ # listen 80;
8
+ # server_name example.com;
9
+ # rewrite ^(.*) http://www.example.com$1 permanent;
10
+ #}
11
+
5
12
  server {
6
- listen 80 default deferred;
7
- # server_name example.com;
13
+ listen 80 default deferred; # Remove default and deferred for multiple apps on a single server
14
+ # server_name www.example.com;
8
15
  root <%= current_path %>/public;
9
16
 
10
17
  location ^~ /assets/ {
@@ -1,3 +1,3 @@
1
1
  module CapBootstrap
2
- VERSION = "0.2"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,10 @@
1
+ Description:
2
+ Generates a deploy.rb that works better with cap_bootstrap.
3
+ Pulls application name from the Rails app name and the repository
4
+ from the git config for remote origin.
5
+
6
+ Example:
7
+ rails generate cap_bootstrap 255.255.255.255
8
+
9
+ This will create:
10
+ config/deploy.rb
@@ -0,0 +1,28 @@
1
+ module CapBootstrap
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+ argument :ip, type: :string, default: '255.255.255.255'
6
+
7
+ def generate_deploy_file
8
+ template "deploy.rb", "config/deploy.rb"
9
+ end
10
+
11
+ private
12
+
13
+ def application
14
+ File.basename Rails.root
15
+ end
16
+
17
+ def git_url
18
+ default = 'git@github.com:GITHUB_USER/#{application}.git'
19
+ begin
20
+ git_url = `/usr/bin/env git config --get remote.origin.url`.strip
21
+ rescue
22
+ default
23
+ end
24
+ git_url.blank? ? default : git_url
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ require "bundler/capistrano"
2
+ require "cap_bootstrap/capistrano"
3
+
4
+ server "<%= ip %>", :web, :app, :db, primary: true
5
+
6
+ set :user, "deployer"
7
+ set :application, "<%= application %>"
8
+ set :deploy_to, "/home/#{user}/apps/#{application}"
9
+ set :deploy_via, :remote_cache
10
+ set :use_sudo, false
11
+ set :scm, "git"
12
+ set :repository, "<%= git_url %>"
13
+ set :branch, "master"
14
+
15
+ default_run_options[:pty] = true
16
+ ssh_options[:forward_agent] = true
17
+
18
+ after "deploy", "deploy:cleanup" # keep only the last 5 releases
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-02 00:00:00.000000000 Z
12
+ date: 2012-04-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Capistrano tasks for deploying Rails applications using Ubuntu 10.04,
15
15
  rbenv, nginx, Unicorn and PostgreSQL.
@@ -42,6 +42,9 @@ files:
42
42
  - lib/cap_bootstrap/recipes/unicorn.rb
43
43
  - lib/cap_bootstrap/recipes/utilities.rb
44
44
  - lib/cap_bootstrap/version.rb
45
+ - lib/generators/cap_bootstrap/install/USAGE
46
+ - lib/generators/cap_bootstrap/install/install_generator.rb
47
+ - lib/generators/cap_bootstrap/install/templates/deploy.rb
45
48
  homepage: http://github.com/cwsaylor/cap_bootstrap
46
49
  licenses: []
47
50
  post_install_message:
@@ -56,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
59
  version: '0'
57
60
  segments:
58
61
  - 0
59
- hash: 2692874588853330221
62
+ hash: -3861110876988738660
60
63
  required_rubygems_version: !ruby/object:Gem::Requirement
61
64
  none: false
62
65
  requirements:
@@ -65,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
68
  version: '0'
66
69
  segments:
67
70
  - 0
68
- hash: 2692874588853330221
71
+ hash: -3861110876988738660
69
72
  requirements: []
70
73
  rubyforge_project:
71
74
  rubygems_version: 1.8.11