aws_deploy 0.2.6.1 → 0.3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ Deployment Version: 140515.192340 master
2
+ * wip/notification
@@ -8,14 +8,14 @@ require './lib/deploy/aws_send.rb'
8
8
  # CONFIGURABLE
9
9
  # -------------------------------------------------------------------------------------
10
10
 
11
- zip_file = "projeto_rga"
11
+ zip_file = "aws_deploy"
12
12
  md5_file = "#{zip_file}"
13
13
 
14
- aws_access_key_id = "bb"
15
- aws_secret_access_key = "cc"
16
- aws_bucket = "projeto_rga/deploy"
14
+ aws_access_key_id = "AKIAIFAGHVI7XSIVDQ2A"
15
+ aws_secret_access_key = "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"
16
+ aws_bucket = "deploy_aws_deploy"
17
17
 
18
- _temp_dir = "#{File.expand_path("~")}/Temp/playliststore"
18
+ _temp_dir = "#{File.expand_path("~")}/Temp/www.aws_deploy.com"
19
19
 
20
20
  #
21
21
  # -------------------------------------------------------------------------------------
@@ -30,16 +30,14 @@ temp_dir = "#{_temp_dir}/#{time}"
30
30
 
31
31
 
32
32
 
33
- puts "------------------------------------------------------------------------------
34
-
35
- "
33
+ puts "------------------------------------------------------------------------------ "
36
34
 
37
35
 
38
36
  # puts "------------------------------------------------------------------------------ "
39
37
  puts "3. Version.txt"
40
38
  # puts "------------------------------------------------------------------------------ "
41
39
 
42
- GitVersionTag.new(time, "gitlab", public_dir.path).version_it
40
+ # GitVersionTag.new(time, "gitlab", public_dir.path).version_it
43
41
 
44
42
 
45
43
 
@@ -47,7 +45,7 @@ GitVersionTag.new(time, "gitlab", public_dir.path).version_it
47
45
  puts "2. Git tag"
48
46
  # puts "------------------------------------------------------------------------------ "
49
47
 
50
- GitVersionTag.new(time, "gitlab", public_dir.path).tag_it
48
+ # GitVersionTag.new(time, "gitlab", public_dir.path).tag_it
51
49
 
52
50
 
53
51
  # puts "------------------------------------------------------------------------------ "
@@ -68,6 +66,7 @@ exclude_dirs << ".git"
68
66
  exclude_dirs << ".gitignore"
69
67
  exclude_dirs << ".autotest"
70
68
  exclude_dirs << "tmp"
69
+ exclude_dirs << "doc"
71
70
  exclude_dirs << ".svn"
72
71
  exclude_dirs << "wip"
73
72
  exclude_dirs << "log/*"
@@ -76,6 +75,7 @@ exclude_dirs << "script/security/*"
76
75
  exclude_dirs << "README.rdoc"
77
76
  exclude_dirs << "public/app"
78
77
 
78
+ rsync_command = "rsync -avz --exclude '#{exclude_dirs.join("' --exclude '")}' ../ #{temp_dir}"
79
79
  system("#{rsync_command}")
80
80
 
81
81
 
@@ -101,7 +101,7 @@ puts "3.3 - Generating MD5 - #{Time.now}"
101
101
  # puts "------------------------------------------------------------------------------ "
102
102
 
103
103
  system("rm -rf #{temp_dir}/../#{md5_file}.md5")
104
- system("cd #{temp_dir}; md5 <<< "#{Time.now}" >> ../#{md5_file}.md5")
104
+ system("cd #{temp_dir}; md5 <<< \"#{Time.now}\" >> ../#{md5_file}.md5")
105
105
 
106
106
 
107
107
 
@@ -1,6 +1,6 @@
1
1
  require "fileutils"
2
2
  require "aws-sdk"
3
-
3
+
4
4
  class AwsSend
5
5
 
6
6
  DEFAULT_ENV = "development_remote"
@@ -23,7 +23,8 @@ class AwsSend
23
23
  obj = bucket.objects[base_file_name]
24
24
  obj.delete
25
25
  obj.write(Pathname.new("#{file_name}"))
26
-
26
+
27
+ system("rake aws:notifty_deploy") if (file_name.end_with?(".md5"))
27
28
  end
28
29
 
29
30
  end
@@ -7,11 +7,11 @@ require "aws-sdk"
7
7
  # CONFIGURABLE
8
8
  # -------------------------------------------------------------------------------------
9
9
 
10
- AWS.config(:access_key_id => "bb", :secret_access_key => "cc")
10
+ AWS.config(:access_key_id => "AKIAIFAGHVI7XSIVDQ2A", :secret_access_key => "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")
11
11
 
12
- base_dir = "/app/deploy/"
13
- project_name = "dd"
14
- bucket = "dd/deploy"
12
+ data_dir = File.expand_path File.dirname(__FILE__)
13
+ file_pattern = "aws_deploy"
14
+ bucket = "deploy_aws_deploy"
15
15
 
16
16
  #
17
17
  # -------------------------------------------------------------------------------------
@@ -28,8 +28,8 @@ else
28
28
  puts "ERR - Invalid Environment: (#{ARGV[0]})"
29
29
  else
30
30
 
31
- s3_filename = "#{project_name}-#{ARGV[0]}.zip"
32
- s3_filename_md5 = "#{project_name}-#{ARGV[0]}.md5"
31
+ s3_filename = "#{file_pattern}-#{ARGV[0]}.zip"
32
+ s3_filename_md5 = "#{file_pattern}-#{ARGV[0]}.md5"
33
33
 
34
34
 
35
35
  # # puts "------------------------------------------------------------------------------ "
@@ -42,9 +42,9 @@ else
42
42
  obj = bucket.objects[s3_filename_md5]
43
43
 
44
44
  if obj.exists?
45
- File.delete("#{base_dir}#{s3_filename_md5}") if File.exist?("#{base_dir}#{s3_filename_md5}")
45
+ File.delete("#{data_dir}/#{s3_filename_md5}") if File.exist?("#{data_dir}/#{s3_filename_md5}")
46
46
 
47
- File.open("#{base_dir}#{s3_filename_md5}", 'wb') do |file|
47
+ File.open("#{data_dir}/#{s3_filename_md5}", 'wb') do |file|
48
48
  obj.read do |chunk|
49
49
  file.write(chunk)
50
50
  end
@@ -55,10 +55,10 @@ else
55
55
  puts "2. Checking MD5 ... "
56
56
 
57
57
  # md5 checking...
58
- md5_file_data = File.read("#{base_dir}#{s3_filename_md5}")
58
+ md5_file_data = File.read("#{data_dir}/#{s3_filename_md5}")
59
59
 
60
- if File.exist?("#{base_dir}#{s3_filename_md5}.local")
61
- md5_local = File.read("#{base_dir}#{s3_filename_md5}.local")
60
+ if File.exist?("#{data_dir}/#{s3_filename_md5}.local")
61
+ md5_local = File.read("#{data_dir}/#{s3_filename_md5}.local")
62
62
  else
63
63
  md5_local = "new__#{md5_file_data}"
64
64
  end
@@ -76,7 +76,7 @@ else
76
76
 
77
77
  if obj.exists?
78
78
 
79
- File.open("#{base_dir}#{s3_filename}", 'w+b') do |file|
79
+ File.open("#{data_dir}/#{s3_filename}", 'w+b') do |file|
80
80
  obj.read do |chunk|
81
81
  file.write(chunk)
82
82
  end
@@ -86,21 +86,21 @@ else
86
86
  puts "4. Writing controls ... .log and .md5.local files "
87
87
 
88
88
 
89
- system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_YES.log")
89
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{data_dir}/#{file_pattern}-#{ARGV[0]}_YES.log")
90
90
  # updating local MD5
91
- File.open("#{base_dir}#{s3_filename_md5}.local", 'w+') { |file| file.write("#{md5_file_data}") }
91
+ File.open("#{data_dir}/#{s3_filename_md5}.local", 'w+') { |file| file.write("#{md5_file_data}") }
92
92
 
93
93
  puts "5. Deploying...."
94
- system("#{base_dir}deploy.sh #{ARGV[0]}")
94
+ system("#{data_dir}/deploy.sh #{ARGV[0]}")
95
95
 
96
96
  else
97
- system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_NO.log")
97
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{data_dir}/#{file_pattern}-#{ARGV[0]}_NO.log")
98
98
  end
99
99
  else
100
- system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_NO.log")
100
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{data_dir}/#{file_pattern}-#{ARGV[0]}_NO.log")
101
101
  end
102
102
  else
103
- system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_NO.log")
103
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{data_dir}/#{file_pattern}-#{ARGV[0]}_NO.log")
104
104
  end
105
105
 
106
106
  end
@@ -1,18 +1,18 @@
1
1
  #!/bin/bash
2
2
  #
3
3
  # Usage:
4
- # ./deploy.sh [app|test2]
4
+ # ./deploy.sh [RAILS_ENV]
5
5
  #
6
6
  #
7
7
 
8
8
 
9
- DATA_DIR=/app/deploy
10
- ZIP_FILE_NAME=samsung-g11.zip
11
- UNPACK_DIR=$DATA_DIR/tmp/unpack_playliststore
9
+ DATA_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
10
+ ZIP_FILE_NAME=zip_file.zip
11
+ UNPACK_DIR=$DATA_DIR/tmp/npack_www.aws_deploy.com
12
12
  HOST=`hostname`
13
13
  NOW=$(date +"%y%m%d-%H%M%S")
14
14
 
15
- BASE_DEPLOY_DIR=/app/www
15
+ BASE_DEPLOY_DIR=/app/www/
16
16
  clear screen
17
17
 
18
18
  TODAY=$(date)
@@ -30,10 +30,10 @@
30
30
  echo " "
31
31
  echo " onde:"
32
32
  echo " "
33
- echo " production => www.playliststore.com"
34
- echo " staging => staging.playliststore.com"
35
- echo " development_remote => test.playliststore.com"
36
- echo " admin => admin.playliststore.com"
33
+ echo " production => www.www.aws_deploy.com.com"
34
+ echo " staging => staging.www.aws_deploy.com.com"
35
+ echo " development_remote => test.www.aws_deploy.com.com"
36
+ echo " admin => admin.www.aws_deploy.com.com"
37
37
  echo " "
38
38
  echo "***********************************************************************************"
39
39
  exit
@@ -41,26 +41,26 @@
41
41
  if [ "$1" == "admin" ]
42
42
  then
43
43
  export RAILS_ENV=production
44
- ZIP_FILE_NAME=playliststore-admin.zip
45
- BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/admin.playliststore.com.br
44
+ ZIP_FILE_NAME=aws_deploy-admin.zip
45
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/admin.www.aws_deploy.com.com.br
46
46
  fi
47
47
  if [ "$1" == "development_remote" ]
48
48
  then
49
49
  export RAILS_ENV=development_remote
50
- ZIP_FILE_NAME=playliststore-development_remote.zip
51
- BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/test.playliststore.com.br
50
+ ZIP_FILE_NAME=aws_deploy-development_remote.zip
51
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/test.www.aws_deploy.com.com.br
52
52
  fi
53
53
  if [ "$1" == "staging" ]
54
54
  then
55
55
  export RAILS_ENV=staging
56
- ZIP_FILE_NAME=playliststore-staging.zip
57
- BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/staging.playliststore.com.br
56
+ ZIP_FILE_NAME=aws_deploy-staging.zip
57
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/staging.www.aws_deploy.com.com.br
58
58
  fi
59
59
  if [ "$1" == "production" ]
60
60
  then
61
61
  export RAILS_ENV=production
62
- ZIP_FILE_NAME=playliststore-production.zip
63
- BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/www.playliststore.com.br
62
+ ZIP_FILE_NAME=aws_deploy-production.zip
63
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/www.www.aws_deploy.com.com.br
64
64
  fi
65
65
 
66
66
  fi
@@ -115,7 +115,7 @@
115
115
  # echo "-----------------------------------------------------------------------------------"
116
116
 
117
117
  # nginx_restart
118
- sudo service nginx restart
118
+ service nginx restart
119
119
 
120
120
 
121
121
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.1
4
+ version: 0.3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcio Mangar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -116,11 +116,11 @@ files:
116
116
  - test/dummy/config.ru
117
117
  - test/dummy/db/development.sqlite3
118
118
  - test/dummy/log/development.log
119
- - test/dummy/log/local.log
120
119
  - test/dummy/public/404.html
121
120
  - test/dummy/public/422.html
122
121
  - test/dummy/public/500.html
123
122
  - test/dummy/public/favicon.ico
123
+ - test/dummy/public/version.txt
124
124
  - test/dummy/Rakefile
125
125
  - test/dummy/README.rdoc
126
126
  - test/dummy/script/deploy.rb
@@ -182,11 +182,11 @@ test_files:
182
182
  - test/dummy/config.ru
183
183
  - test/dummy/db/development.sqlite3
184
184
  - test/dummy/log/development.log
185
- - test/dummy/log/local.log
186
185
  - test/dummy/public/404.html
187
186
  - test/dummy/public/422.html
188
187
  - test/dummy/public/500.html
189
188
  - test/dummy/public/favicon.ico
189
+ - test/dummy/public/version.txt
190
190
  - test/dummy/Rakefile
191
191
  - test/dummy/README.rdoc
192
192
  - test/dummy/script/deploy.rb
File without changes