mina-blue_green 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c27f1b290d4f661378b7cfa236a0f89d245d659a
4
- data.tar.gz: a4bc943b6a07742dc771a6e7d2e5abc9b02ef595
3
+ metadata.gz: 6ef958ec1fc63c1265b387d88fcde9e0013e44c3
4
+ data.tar.gz: 798f9ea9eb71f3f1eae75e1f9c4a7b2aec09ba7b
5
5
  SHA512:
6
- metadata.gz: c8fd7b5da8d580afda0e8bfb145c067fc83bf97a8e003782d161955f8dc8e979a3ca480bbca7490cb7c1fdc0d53fa0b1ffd2e277161144ab4067d6dbf047a2f8
7
- data.tar.gz: a76d51eaa0a6525bc92b5053b9bfc05adab1b38282122e56d87deea04a98898163ab6254ac1ef8cf48a88eba6ac14d2d81f944727d068ea043232b3b249c6e22
6
+ metadata.gz: 5cc8a28eb295d40c753a0ec422e900724a4eeb876e14b6f428bb7e0edad3ac6020b1ff53e5288d873c3f5885e8d25b397dd523385df13592a4fc4f4ffa0c0e7b
7
+ data.tar.gz: be648aeca36107a6104544f4fa43adfbe45f299671817cbe228c0bfe742118655748463a4579f0b7c6fd30a5328939ebdf078ec3669e94e7a98f988c95fed063
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Modules: BlueGreen
2
2
 
3
- Mina module for [Blue Green Deployment](http://martinfowler.com/bliki/BlueGreenDeployment.html).
3
+ [![Gem Version](https://badge.fury.io/rb/mina-blue_green.svg)](https://badge.fury.io/rb/mina-blue_green)
4
+
5
+ [Mina](https://github.com/mina-deploy/mina) module for [Blue Green Deployment](http://martinfowler.com/bliki/BlueGreenDeployment.html).
4
6
 
5
7
  ## Installation
6
8
 
@@ -43,10 +45,10 @@ end
43
45
  Then run:
44
46
 
45
47
  ```shell
46
- $ bundle exec mina blue_green
48
+ $ bundle exec mina blue status
47
49
  ```
48
50
 
49
- To run a command on either blue or green:
51
+ You can run commands on either blue or green:
50
52
 
51
53
  ```shell
52
54
  $ bundle exec mina green unicorn:start
@@ -58,7 +60,27 @@ Or:
58
60
  $ bundle exec mina blue deploy
59
61
  ```
60
62
 
61
- If you have `mina-multistage` installed then all commands will default to production environment.
63
+ With `mina-multistage`:
64
+
65
+ ```shell
66
+ $ bundle exec mina production green deploy
67
+ ```
68
+
69
+ # Suggestions for use with AWS
70
+
71
+ This requires two EC2 instances (blue and green) and two ELBs (production and staging). The production ELB's health check gets a healthy response when an instance is running in production. Likewise, the staging ELB points to an endpoint that only responds healthily when an instance is running in staging. In this way, by promoting an instance to production it will automatically go live. If no staging environment is needed, both blue and green can be run in production mode and the ELB will balance their load.
72
+
73
+ # Switching environments
74
+
75
+ If you're running unicorn you need to stop it first:
76
+
77
+ ```shell
78
+ $ bundle exec mina blue unicorn:stop
79
+ ```
80
+
81
+ ```shell
82
+ $ bundle exec mina staging blue deploy
83
+ ```
62
84
 
63
85
  ## Contributing
64
86
 
@@ -1,39 +1,30 @@
1
1
  set_default :blue, 'CHANGE THIS'
2
2
  set_default :green, 'CHANGE THIS'
3
3
 
4
- _color = ARGV.first
5
4
 
6
5
  %w(blue green).each do |color|
6
+ if ARGV.delete(color)
7
+ _color = color
8
+ end
7
9
  desc "Set the target environment to '#{color}'."
8
10
  task(color) do
9
11
  val = settings.send(color.to_sym)
10
12
  if _color == color and val != 'CHANGE THIS'
11
- set :stage, 'production'
12
13
  set :domain, val
13
14
  end
14
15
  end
15
16
  end
16
17
 
17
- namespace :blue_green do
18
- desc 'Blue Green status'
19
- task :status do
20
- isolate do
21
- queue %{
22
- #{echo_cmd %[SHA=$(git --git-dir=#{deploy_to}/scm describe --always HEAD)]}
23
- #{echo_cmd %[ENV=$(pgrep -af unicorn | sed -n 1p | sed 's/.*-E //' | awk '{print $1}')]}
24
- echo "-----> Revision $SHA running in $ENV."
25
- }
26
-
27
- set :domain, blue
28
- print_str "-----> Blue"
29
- run!
30
-
31
- set :domain, green
32
- print_str "-----> Green"
33
- run!
34
- end
18
+ desc 'Blue Green status'
19
+ task :status do
20
+ isolate do
21
+ queue %{
22
+ current_sha=$(git --git-dir=#{deploy_to}/scm describe --always HEAD)
23
+ current_branch=$(git --git-dir=#{deploy_to}/scm branch --contains $current_sha | sed -n 1p)
24
+ current_rails_env=$(ps auxf | grep unicorn | sed -n 1p | sed 's/.*-E //' | awk '{print $1}')
25
+ echo "-----> Revision $current_sha ($current_branch) running in $current_rails_env."
26
+ }
27
+ run!
35
28
  end
36
29
  end
37
30
 
38
- desc 'Blue Green status'
39
- task :blue_green => 'blue_green:status'
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module BlueGreen
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-blue_green
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reed Law
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler