atech_cloud 1.0.6 → 1.0.8
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/lib/atech_cloud/deploy.rb +12 -6
- metadata +19 -41
data/lib/atech_cloud/deploy.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
Capistrano::Configuration.instance(:must_exist).load do
|
2
2
|
|
3
|
+
## Define the roles
|
4
|
+
role :app
|
5
|
+
role :storage
|
6
|
+
|
3
7
|
## Server configuration
|
4
8
|
set :user, `whoami`.chomp
|
5
9
|
set :ssh_options, {:forward_agent => true, :port => 22}
|
@@ -28,7 +32,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
28
32
|
default
|
29
33
|
end
|
30
34
|
|
31
|
-
task :update_code, :roles => :app do
|
35
|
+
task :update_code, :roles => [:app, :storage] do
|
32
36
|
## Create a branch for previous (pre-deployment)
|
33
37
|
run "cd #{deploy_to} && git branch -d rollback && git branch rollback"
|
34
38
|
## Update remote repository and merge deploy branch into current branch
|
@@ -36,7 +40,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
36
40
|
finalise
|
37
41
|
end
|
38
42
|
|
39
|
-
task :finalise, :roles => :app do
|
43
|
+
task :finalise, :roles => [:app, :storage] do
|
40
44
|
execute = Array.new
|
41
45
|
execute << "cd #{deploy_to}"
|
42
46
|
execute << "git submodule init"
|
@@ -49,7 +53,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
49
53
|
end
|
50
54
|
|
51
55
|
desc 'Setup the repository on the remote server for the first time'
|
52
|
-
task :setup, :roles => :app do
|
56
|
+
task :setup, :roles => [:app, :storage] do
|
53
57
|
run "rm -rf #{deploy_to}"
|
54
58
|
run "git clone -n #{fetch(:repository)} #{deploy_to} --branch #{fetch(:branch)}"
|
55
59
|
run "cd #{deploy_to} && git branch rollback && git checkout -b deploy && git branch -d #{fetch(:branch)}"
|
@@ -58,7 +62,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
58
62
|
end
|
59
63
|
|
60
64
|
desc 'Upload the database configuration file'
|
61
|
-
task :upload_db_config, :roles => :app do
|
65
|
+
task :upload_db_config, :roles => [:app, :storage] do
|
62
66
|
put "production:\n adapter: mysql2\n encoding: utf8\n reconnect: false\n database: #{fetch(:application, 'databasename')}\n pool: 5\n username: #{fetch(:application, 'dbusernmae')}\n password: #{ENV['DBPASS'] || 'xxxx'}\n host: #{fetch(:database_host, 'db-a.cloud.atechmedia.net')}\n", File.join(deploy_to, 'config', 'database.yml')
|
63
67
|
end
|
64
68
|
end
|
@@ -68,14 +72,16 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
68
72
|
## ==================================================================
|
69
73
|
desc 'Run database migrations on the remote'
|
70
74
|
task :migrate, :roles => :app, :only => {:database_ops => true} do
|
71
|
-
|
75
|
+
for environment in environments
|
76
|
+
run "cd #{deploy_to} && RAILS_ENV=#{environment} bundle exec rake db:migrate"
|
77
|
+
end
|
72
78
|
end
|
73
79
|
|
74
80
|
## ==================================================================
|
75
81
|
## Rollback
|
76
82
|
## ==================================================================
|
77
83
|
desc 'Rollback to the previous deployment'
|
78
|
-
task :rollback, :roles => :app do
|
84
|
+
task :rollback, :roles => [:app, :storage] do
|
79
85
|
run "cd #{deploy_to} && git reset --hard rollback"
|
80
86
|
deploy.finalise
|
81
87
|
deploy.restart
|
metadata
CHANGED
@@ -1,69 +1,47 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: atech_cloud
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 6
|
10
|
-
version: 1.0.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.8
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Adam Cooke
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-04-08 00:00:00 +01:00
|
19
|
-
default_executable:
|
12
|
+
date: 2011-09-20 00:00:00.000000000Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
14
|
description:
|
23
15
|
email: adam@atechmedia.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
19
|
+
files:
|
31
20
|
- lib/atech_cloud/deploy.rb
|
32
21
|
- lib/atech_cloud/unicorn.rb
|
33
22
|
- lib/atech_cloud.rb
|
34
|
-
has_rdoc: true
|
35
23
|
homepage: http://atechmedia.com
|
36
24
|
licenses: []
|
37
|
-
|
38
25
|
post_install_message:
|
39
26
|
rdoc_options: []
|
40
|
-
|
41
|
-
require_paths:
|
27
|
+
require_paths:
|
42
28
|
- lib
|
43
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
30
|
none: false
|
45
|
-
requirements:
|
46
|
-
- -
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
|
49
|
-
|
50
|
-
- 0
|
51
|
-
version: "0"
|
52
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
36
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
61
41
|
requirements: []
|
62
|
-
|
63
42
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.
|
43
|
+
rubygems_version: 1.8.6
|
65
44
|
signing_key:
|
66
45
|
specification_version: 3
|
67
46
|
summary: The RubyGem for the aTech Cloud
|
68
47
|
test_files: []
|
69
|
-
|