idlc-sdk-deploy 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c772936eed90a71ce9bbd7349f5e5d4bdd28c64a
4
+ data.tar.gz: 9829c39dc713dd373e39b94246150ef9f325237c
5
+ SHA512:
6
+ metadata.gz: cce7efd06ae1bc772f9a995a943d05e08b8f8acbd87ea45d3532f789f1b50d50f87126e4b5addb78364fc20afc71e6ce583164dd3830da46ea0f891905900c56
7
+ data.tar.gz: d51e77d628a0f4c03311d467e1bf46682fe842a36b65a950500e2af1b078b077beb69fb031703cb2d3f86f2a53599a199247f895a5035b9d28ba426cdbb46322
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.4
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ -m markdown
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in idlc-sdk-deploy.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Nathan Cazell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Idlc::Sdk::Deploy
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/idlc/sdk/deploy`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'idlc-sdk-deploy'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install idlc-sdk-deploy
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/idlc-sdk-deploy.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "idlc/sdk/deploy"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'idlc-sdk-deploy/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'idlc-sdk-deploy'
9
+ spec.version = Idlc::Deploy::VERSION
10
+ spec.authors = ['Nathan Cazell']
11
+ spec.email = ['nathan.cazell@imageapi.com']
12
+
13
+ spec.summary = 'IDLC SDK for AWS resources - Deploy'
14
+ spec.description = 'Provides deploy libraries for idlc-sdk. This gem is part of the IDLC SDK'
15
+ spec.homepage = 'https://github.com/nathantcz/idlc-sdk'
16
+ spec.license = 'MIT'
17
+
18
+ spec.metadata = {
19
+ 'source_code_uri' => 'https://github.com/nathantcz/idlc-sdk-deploy'
20
+ }
21
+
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ f.match(%r{^(test|spec|features)/})
24
+ end
25
+
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.15'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ spec.add_development_dependency 'rubocop', '0.48.1'
32
+ spec.add_development_dependency 'pry'
33
+ spec.add_development_dependency 'yard'
34
+
35
+ spec.add_runtime_dependency 'idlc-sdk-core'
36
+ spec.add_runtime_dependency 'aws-sdk-elasticsearchservice'
37
+ spec.add_runtime_dependency 'aws-sigv4'
38
+ spec.add_runtime_dependency 'net-telnet'
39
+ spec.add_runtime_dependency 'packer-binary'
40
+ spec.add_runtime_dependency 'rubocop', '0.48.1'
41
+ spec.add_runtime_dependency 'sshkey'
42
+ spec.add_runtime_dependency 'terraform-binary'
43
+ end
@@ -0,0 +1,22 @@
1
+ require 'aws-sdk-elasticsearchservice'
2
+ require 'aws-sigv4'
3
+ require 'net/https'
4
+ require 'net-telnet'
5
+ require 'rspec/core/rake_task'
6
+ require 'sshkey'
7
+ require 'terraform/binary'
8
+ require 'tmpdir'
9
+
10
+ # Use the packer-binary gem to provide the executable
11
+ Terraform::Binary.configure do |config|
12
+ config.version = '0.8.7'
13
+ end
14
+
15
+ require 'idlc-sdk-core'
16
+
17
+ require 'idlc-sdk-deploy/config'
18
+ require 'idlc-sdk-deploy/power'
19
+ require 'idlc-sdk-deploy/keypair'
20
+ require 'idlc-sdk-deploy/elasticsearchv2'
21
+
22
+ Idlc::Deploy::Config.load_tasks
@@ -0,0 +1,82 @@
1
+ module Idlc
2
+ module Deploy
3
+ class Config
4
+ include Idlc::Helpers
5
+
6
+ class << self
7
+ def load_tasks
8
+ Dir.glob("#{__dir__}/tasks/*.rake").each do |task_file|
9
+ load task_file
10
+ end
11
+ end
12
+
13
+ def add_deployment_var(key, value)
14
+ ENV["TF_VAR_#{key}"] = value
15
+ end
16
+
17
+ def get_deployment_var(key)
18
+ ENV["TF_VAR_#{key}"]
19
+ end
20
+
21
+ def get_deployment_output(key)
22
+ Terraform::Binary.output(key).strip!
23
+ end
24
+ end
25
+
26
+ def initialize(region)
27
+ @region = region
28
+
29
+ Idlc::Utility.check_for_creds
30
+
31
+ rescue Idlc::Utility::MissingCredentials => e
32
+ err("ERROR: #{e.message}\n")
33
+ exit 1
34
+ end
35
+
36
+ def configure_state(bucket, sub_bucket)
37
+ validate_environment
38
+
39
+ args = []
40
+ args << '-backend=s3'
41
+ args << '-backend-config="acl=private"'
42
+ args << "-backend-config=\"bucket=#{bucket}\""
43
+ args << '-backend-config="encrypt=true"'
44
+ args << "-backend-config=\"key=#{sub_bucket}/terraform.tfstate\""
45
+ args << "-backend-config=\"region=#{@region}\""
46
+
47
+ Terraform::Binary.remote("config #{args.join(' ')}")
48
+ end
49
+
50
+ def parse(config_file)
51
+ raise ArgumentError, "#{config_file} does not exist" unless File.exist? config_file
52
+ Config.add_deployment_var('inf_config_file', config_file)
53
+
54
+ # Parse the config file
55
+ YAML.load_file(config_file)['configuration'].each do |section, body|
56
+ next if section == 'dynamics' # skip the dynamics sections
57
+ next unless (section =~ /overrides/).nil? # skip the app overrides sections
58
+ next if body.nil?
59
+ body.each do |key, value|
60
+ debug("#{section}: #{key} = #{value}")
61
+ Config.add_deployment_var(key, value)
62
+ end
63
+ end
64
+ end
65
+
66
+ private
67
+
68
+ def validate_environment
69
+ %w[
70
+ SIZE
71
+ TF_VAR_tfstate_bucket
72
+ TF_VAR_job_code
73
+ TF_VAR_env
74
+ TF_VAR_domain
75
+ TF_VAR_public_dns
76
+ ].each do |var|
77
+ raise "missing #{var} in environment" unless ENV.include? var
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,183 @@
1
+ module Idlc
2
+ module Deploy
3
+ class ElasticsearchV2
4
+ include Idlc::Helpers
5
+
6
+ def initialize(credentials, region, endpoint)
7
+ @service_name = 'es'
8
+ @credentials = credentials
9
+ @region = region
10
+ @endpoint = endpoint.strip
11
+ @index_migrations = []
12
+ @tmp_dir = Dir.mktmpdir('es-temp')
13
+ @full_release_path = ''
14
+
15
+ # Instantiate an S3 Client
16
+ @s3 = Aws::S3::Client.new(
17
+ region: @region,
18
+ access_key_id: @credentials[:access_key_id],
19
+ secret_access_key: @credentials[:secret_access_key]
20
+ )
21
+ end
22
+
23
+ def create_index(app_release, bucket, prefix)
24
+ mapping = es_mapping(bucket, prefix, app_release)
25
+ parts = parse_request(mapping)
26
+
27
+ send_signed_request(
28
+ parts[:method],
29
+ "#{@endpoint}#{parts[:path]}",
30
+ parts[:body]
31
+ )
32
+ end
33
+
34
+ def delete_index(index)
35
+ send_signed_request('DELETE', "#{@endpoint}/#{index}", '{}')
36
+ end
37
+
38
+ def run_migrations(app_release, bucket, prefix)
39
+ migrations = es_migrations(bucket, prefix, app_release)
40
+
41
+ migrations.each do |migration|
42
+ parts = parse_request(migration)
43
+
44
+ send_signed_request(
45
+ parts[:method],
46
+ "#{@endpoint}#{parts[:path]}",
47
+ parts[:body]
48
+ )
49
+ end
50
+ end
51
+
52
+ def cleanup
53
+ debug("keeping directory: #{@tmp_dir} for dubugging")
54
+ return if ENV['DEBUG']
55
+
56
+ FileUtils.rm_rf(@tmp_dir)
57
+ end
58
+
59
+ private
60
+
61
+ def major_minor_patch(version)
62
+ # Strip build number from version number. The migration scripts only include
63
+ # major.minor.patch
64
+ version.split('.')[0..2].join('.')
65
+ end
66
+
67
+ def es_mapping(bucket, prefix, app_release)
68
+ get_release(bucket, prefix, app_release)
69
+
70
+ # Read Mapping JSON into string
71
+ file = File.open("#{@full_release_path}/es/axiompro_mapping.txt", 'rb')
72
+ mapping = file.read
73
+ file.close
74
+
75
+ mapping
76
+ end
77
+
78
+ def es_migrations(bucket, prefix, app_release)
79
+ get_release(bucket, prefix, app_release)
80
+ migrations = []
81
+
82
+ Dir.glob("#{@full_release_path}/es/Migrations/*.txt").each do |f|
83
+ msg(f)
84
+ file = File.open(f, 'rb')
85
+ migrations.push(file.read)
86
+ file.close
87
+ end
88
+
89
+ migrations
90
+ end
91
+
92
+ def get_release(src_bucket, app, version)
93
+ @full_release_path = "#{@tmp_dir}/#{app}-#{version}"
94
+ release_archive = "#{@full_release_path}.zip"
95
+
96
+ return if File.exist? @full_release_path
97
+
98
+ @s3.get_object(
99
+ response_target: release_archive,
100
+ bucket: src_bucket,
101
+ key: "#{app}/#{major_minor_patch(version)}/AxiomPro.#{version}.deploy.zip"
102
+ )
103
+
104
+ unzip(release_archive, @full_release_path)
105
+ end
106
+
107
+ def unzip(file, destination)
108
+ Zip::ZipFile.open(file) do |zip_file|
109
+ zip_file.each do |f|
110
+ f_path = File.join(destination, f.name)
111
+ FileUtils.mkdir_p(File.dirname(f_path))
112
+ f.extract(f_path)
113
+ end
114
+ end
115
+ end
116
+
117
+ def send_signed_request(method, url, payload)
118
+ uri = URI.parse(url)
119
+ https = Net::HTTP.new(uri.host, uri.port)
120
+ https.use_ssl = true
121
+ signature = sigv4_signature(method, url, payload)
122
+ request = http_request(method, uri.path, signature, payload)
123
+
124
+ response = https.request(request)
125
+ msg("#{response.code} #{response.message} #{response.body}")
126
+ end
127
+
128
+ def parse_request(document)
129
+ method = document.lines[0].strip
130
+ path = document.lines[1].strip
131
+ body = document.lines[2..-1].join
132
+
133
+ { method: method, path: path, body: body }
134
+ end
135
+
136
+ def set_headers(request, signature)
137
+ request.add_field 'host', signature.headers['host']
138
+ request.add_field 'content-type', 'application/json'
139
+ request.add_field 'x-amz-content-sha256', signature.headers['x-amz-content-sha256']
140
+ request.add_field 'x-amz-date', signature.headers['x-amz-date']
141
+ request.add_field 'authorization', signature.headers['authorization']
142
+ end
143
+
144
+ def http_request(method, path, signature, payload)
145
+ case method.downcase
146
+ when 'put'
147
+ request = Net::HTTP::Put.new(path)
148
+ when 'get'
149
+ request = Net::HTTP::Get.new(path)
150
+ when 'delete'
151
+ request = Net::HTTP::Delete.new(path)
152
+ else
153
+ request = Net::HTTP::Put.new(path)
154
+ end
155
+
156
+ set_headers(request, signature)
157
+ request.body = payload
158
+
159
+ request
160
+ end
161
+
162
+ def signer
163
+ Aws::Sigv4::Signer.new(
164
+ service: @service_name,
165
+ region: @region,
166
+ access_key_id: @credentials[:access_key_id],
167
+ secret_access_key: @credentials[:secret_access_key]
168
+ )
169
+ end
170
+
171
+ def sigv4_signature(method, url, payload)
172
+ signer.sign_request(
173
+ http_method: method,
174
+ url: url,
175
+ headers: {
176
+ 'content-type' => 'application/json'
177
+ },
178
+ body: payload
179
+ )
180
+ end
181
+ end
182
+ end
183
+ end
@@ -0,0 +1,25 @@
1
+ module Idlc
2
+ module Deploy
3
+ module Keypair
4
+ class << self
5
+ def generate(outdir)
6
+ raise ArgumentError, 'Must specify output directory' if outdir.nil?
7
+
8
+ FileUtils.mkdir_p outdir unless File.directory? outdir
9
+
10
+ private_key_file = "#{outdir}/private_key.pem"
11
+ public_key_file = "#{outdir}/public_key.pem"
12
+
13
+ return if File.exist? private_key_file
14
+
15
+ rsa_key = SSHKey.generate
16
+ private_key = rsa_key.private_key
17
+ public_key = rsa_key.ssh_public_key
18
+
19
+ File.open(private_key_file, 'w') { |file| file.write(private_key) }
20
+ File.open(public_key_file, 'w') { |file| file.write(public_key) }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,172 @@
1
+ module Idlc
2
+ module Deploy
3
+ module Power
4
+ class ConnectionError < StandardError; end
5
+ class InstanceKeepAlive < StandardError; end
6
+
7
+ class << self
8
+ include Idlc::Helpers
9
+
10
+ def start_instance(instance)
11
+ msg('Starting Instance...')
12
+ instance.start(
13
+ dry_run: false
14
+ )
15
+ obj = instance.wait_until_running
16
+ msg('Started Instance: ' + get_name(obj.tags))
17
+ end
18
+
19
+ def stop_instance(instance)
20
+ raise InstanceKeepAlive if keep_alive?(instance.tags)
21
+
22
+ msg('Stopping Instance...')
23
+ instance.stop(
24
+ dry_run: false
25
+ )
26
+ obj = instance.wait_until_stopped
27
+ msg('Stopped Instance: ' + get_name(obj.tags))
28
+ end
29
+
30
+ def enable_keep_alive(instance)
31
+ instance.create_tags(
32
+ dry_run: false,
33
+ tags: [ # required
34
+ {
35
+ key: 'keep_alive',
36
+ value: 'true'
37
+ }
38
+ ]
39
+ )
40
+ end
41
+
42
+ def disable_keep_alive(instance)
43
+ instance.create_tags(
44
+ dry_run: false,
45
+ tags: [ # required
46
+ {
47
+ key: 'keep_alive',
48
+ value: 'false'
49
+ }
50
+ ]
51
+ )
52
+ end
53
+
54
+ def update_instance_type(instance, type)
55
+ unless instance.instance_type == type
56
+ name = get_name(instance.tags)
57
+ msg "Changing #{name}: #{instance.instance_type} => #{type}"
58
+
59
+ instance.modify_attribute(
60
+ dry_run: false,
61
+ attribute: 'instanceType',
62
+ value: type
63
+ )
64
+ end
65
+ end
66
+
67
+ def wait_for_tcp_connection(host, port, connection_timeout = 5, wait_timeout = 1500, sleep_time = 10)
68
+ connected = false
69
+ start_time = Time.now
70
+
71
+ until connected
72
+ begin
73
+ Net::Telnet.new(
74
+ 'Host' => host,
75
+ 'Port' => port,
76
+ 'Telnetmode' => false,
77
+ 'Timeout' => connection_timeout
78
+ )
79
+
80
+ connected = true
81
+ rescue ConnectionError, Net::OpenTimeout, Errno::ECONNREFUSED
82
+ check_timeout(start_time, wait_timeout)
83
+ debug("waiting for #{host}:#{port} ... (#{(Time.now - start_time)}s elapsed)")
84
+ sleep sleep_time
85
+ end
86
+ end
87
+
88
+ msg "recieved response from #{host}:#{port} !"
89
+ true
90
+ end
91
+
92
+ def wait_for_response(endpoint, success_text = nil, wait_timeout = 1500, sleep_time = 10)
93
+ connected = false
94
+ start_time = Time.now
95
+
96
+ until connected
97
+ begin
98
+ if success_text.nil? || success_text == ''
99
+ response = http_request("#{endpoint}/diagnostics/ping")
100
+ connected = success(response.body)
101
+ else
102
+ response = http_request(endpoint)
103
+ connected = simple_success(response.body, success_text)
104
+ end
105
+ rescue ConnectionError, Net::OpenTimeout, JSON::ParserError, Errno::ECONNREFUSED
106
+ check_timeout(start_time, wait_timeout)
107
+ sleep sleep_time
108
+ end
109
+ end
110
+
111
+ msg "recieved response from #{endpoint} !"
112
+ true
113
+ end
114
+
115
+ private
116
+
117
+ def keep_alive?(tags)
118
+ k = 'false'
119
+
120
+ tags.each do |t|
121
+ k = t.value if t.key == 'keep_alive'
122
+ end
123
+
124
+ true?(k)
125
+ end
126
+
127
+ def true?(string)
128
+ string.to_s == 'true'
129
+ end
130
+
131
+ def get_name(tags)
132
+ name = ''
133
+
134
+ tags.each do |t|
135
+ name = t.value if t.key == 'Name'
136
+ end
137
+
138
+ # Return
139
+ name
140
+ end
141
+
142
+ def http_request(endpoint)
143
+ uri = URI.parse endpoint
144
+ http = Net::HTTP.new(uri.host, uri.port)
145
+ http.use_ssl = true
146
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
147
+
148
+ request = Net::HTTP::Get.new(uri.path)
149
+ http.request(request)
150
+ end
151
+
152
+ def success(body)
153
+ pong = JSON.parse(body)['data']['pong']
154
+ raise ConnectionError unless pong == true
155
+
156
+ true
157
+ end
158
+
159
+ def simple_success(body, search_text)
160
+ raise ConnectionError if (body =~ /#{search_text}/).nil?
161
+
162
+ true
163
+ end
164
+
165
+ def check_timeout(start_time, timeout)
166
+ elapsed_time = Time.now - start_time
167
+ raise ConnectionError, 'Exceeded Timeout for Completion..' if elapsed_time.to_i >= timeout
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,35 @@
1
+ namespace :elasticsearchv2 do
2
+ task :deps do
3
+ if ENV.include? 'ES_ENDPOINT'
4
+ ES_ENDPOINT = ENV['ES_ENDPOINT']
5
+ else
6
+ ES_ENDPOINT = Idlc::Deploy::Config.get_deployment_output('es_endpoint')
7
+ end
8
+
9
+ ES = Idlc::Deploy::ElasticsearchV2.new(
10
+ {
11
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
12
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
13
+ },
14
+ ENV['AWS_REGION'],
15
+ ES_ENDPOINT
16
+ )
17
+ end
18
+
19
+ desc 'Initialize ElasticSearch'
20
+ task init: [:deps] do
21
+ ES.create_index(ENV['APP_RELEASE'], 'dev-publish', 'axp')
22
+ end
23
+
24
+ desc 'Clear ElasticSearch'
25
+ task clear: [:setup, :deps] do
26
+ ES.delete_index('axiompro')
27
+ ES.cleanup
28
+ end
29
+
30
+ desc 'Update ElasticSearch'
31
+ task update: [:deps, :init] do
32
+ ES.run_migrations(ENV['APP_RELEASE'], 'dev-publish', 'axp')
33
+ ES.cleanup
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ module Idlc
2
+ module Deploy
3
+ VERSION = '1.0.0.rc1'.freeze
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,260 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: idlc-sdk-deploy
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.rc1
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Cazell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.48.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.48.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: idlc-sdk-core
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: aws-sdk-elasticsearchservice
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: aws-sigv4
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: net-telnet
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: packer-binary
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 0.48.1
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '='
179
+ - !ruby/object:Gem::Version
180
+ version: 0.48.1
181
+ - !ruby/object:Gem::Dependency
182
+ name: sshkey
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: terraform-binary
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ description: Provides deploy libraries for idlc-sdk. This gem is part of the IDLC
210
+ SDK
211
+ email:
212
+ - nathan.cazell@imageapi.com
213
+ executables: []
214
+ extensions: []
215
+ extra_rdoc_files: []
216
+ files:
217
+ - ".gitignore"
218
+ - ".rspec"
219
+ - ".travis.yml"
220
+ - ".yardopts"
221
+ - Gemfile
222
+ - LICENSE.txt
223
+ - README.md
224
+ - Rakefile
225
+ - bin/console
226
+ - bin/setup
227
+ - idlc-sdk-deploy.gemspec
228
+ - lib/idlc-sdk-deploy.rb
229
+ - lib/idlc-sdk-deploy/config.rb
230
+ - lib/idlc-sdk-deploy/elasticsearchv2.rb
231
+ - lib/idlc-sdk-deploy/keypair.rb
232
+ - lib/idlc-sdk-deploy/power.rb
233
+ - lib/idlc-sdk-deploy/tasks/elasticsearchv2.rake
234
+ - lib/idlc-sdk-deploy/version.rb
235
+ homepage: https://github.com/nathantcz/idlc-sdk
236
+ licenses:
237
+ - MIT
238
+ metadata:
239
+ source_code_uri: https://github.com/nathantcz/idlc-sdk-deploy
240
+ post_install_message:
241
+ rdoc_options: []
242
+ require_paths:
243
+ - lib
244
+ required_ruby_version: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ required_rubygems_version: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ">"
252
+ - !ruby/object:Gem::Version
253
+ version: 1.3.1
254
+ requirements: []
255
+ rubyforge_project:
256
+ rubygems_version: 2.6.11
257
+ signing_key:
258
+ specification_version: 4
259
+ summary: IDLC SDK for AWS resources - Deploy
260
+ test_files: []