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 +4 -4
- data/README.md +26 -4
- data/lib/mina/blue_green.rb +13 -22
- data/lib/mina/blue_green/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ef958ec1fc63c1265b387d88fcde9e0013e44c3
|
|
4
|
+
data.tar.gz: 798f9ea9eb71f3f1eae75e1f9c4a7b2aec09ba7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cc8a28eb295d40c753a0ec422e900724a4eeb876e14b6f428bb7e0edad3ac6020b1ff53e5288d873c3f5885e8d25b397dd523385df13592a4fc4f4ffa0c0e7b
|
|
7
|
+
data.tar.gz: be648aeca36107a6104544f4fa43adfbe45f299671817cbe228c0bfe742118655748463a4579f0b7c6fd30a5328939ebdf078ec3669e94e7a98f988c95fed063
|
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Modules: BlueGreen
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](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
|
|
48
|
+
$ bundle exec mina blue status
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
|
|
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
|
-
|
|
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
|
|
data/lib/mina/blue_green.rb
CHANGED
|
@@ -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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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'
|
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.
|
|
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-
|
|
11
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|