neetodeploy 1.1.14 → 1.1.16
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/Gemfile +4 -0
- data/Gemfile.lock +24 -1
- data/lib/neeto_deploy/cli/logs/base.rb +59 -36
- data/lib/neeto_deploy/cli/logs/constants.rb +2 -2
- data/lib/neeto_deploy/cli.rb +4 -0
- data/lib/neeto_deploy/version.rb +1 -1
- data/neetodeploy.gemspec +3 -0
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cec28c12e2d1a584c36b57acda22d17159c87707c1b19aff6135d38efe6e3e80
|
4
|
+
data.tar.gz: b29754747bea899d5c845b12015202db84c221cb42b72ba8aa5f00d43ecb7256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92c3d43cd11358105b2e095664c26b28b3cf490baf0add50ea834b049005315287c77bd920ee5f014c6d0c07ed032c82d1b3b7e0f7118714064ee7137d5170a
|
7
|
+
data.tar.gz: 1ff3d2d97733734157e57b137427e410170f689263b6b3b87ba16fb468781d4bbe491cb8caf80e2dbb9fe815a39dfa24b352729ae0a4661cfe7a0b2fd4367cd6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neetodeploy (1.1.
|
4
|
+
neetodeploy (1.1.16)
|
5
|
+
aws-sdk-cloudwatchlogs
|
6
|
+
aws-sdk-cognitoidentity
|
5
7
|
colorize
|
6
8
|
dotenv (~> 2.8.1)
|
7
9
|
httparty (~> 0.21.0)
|
8
10
|
launchy (~> 2.5.0)
|
11
|
+
rexml
|
9
12
|
terminal-table (~> 3.0.2)
|
10
13
|
thor (~> 1.3.0)
|
11
14
|
tty-spinner
|
@@ -16,6 +19,21 @@ GEM
|
|
16
19
|
specs:
|
17
20
|
addressable (2.8.1)
|
18
21
|
public_suffix (>= 2.0.2, < 6.0)
|
22
|
+
aws-eventstream (1.2.0)
|
23
|
+
aws-partitions (1.743.0)
|
24
|
+
aws-sdk-cloudwatchlogs (1.59.0)
|
25
|
+
aws-sdk-core (~> 3, >= 3.165.0)
|
26
|
+
aws-sigv4 (~> 1.1)
|
27
|
+
aws-sdk-cognitoidentity (1.41.0)
|
28
|
+
aws-sdk-core (~> 3, >= 3.165.0)
|
29
|
+
aws-sigv4 (~> 1.1)
|
30
|
+
aws-sdk-core (3.171.0)
|
31
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
32
|
+
aws-partitions (~> 1, >= 1.651.0)
|
33
|
+
aws-sigv4 (~> 1.5)
|
34
|
+
jmespath (~> 1, >= 1.6.1)
|
35
|
+
aws-sigv4 (1.5.2)
|
36
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
19
37
|
byebug (11.1.3)
|
20
38
|
colorize (1.1.0)
|
21
39
|
dotenv (2.8.1)
|
@@ -23,11 +41,13 @@ GEM
|
|
23
41
|
httparty (0.21.0)
|
24
42
|
mini_mime (>= 1.0.0)
|
25
43
|
multi_xml (>= 0.5.2)
|
44
|
+
jmespath (1.6.2)
|
26
45
|
launchy (2.5.2)
|
27
46
|
addressable (~> 2.8)
|
28
47
|
mini_mime (1.1.2)
|
29
48
|
multi_xml (0.6.0)
|
30
49
|
public_suffix (5.0.1)
|
50
|
+
rexml (3.4.1)
|
31
51
|
terminal-table (3.0.2)
|
32
52
|
unicode-display_width (>= 1.1.1, < 3)
|
33
53
|
thor (1.3.0)
|
@@ -53,8 +73,11 @@ PLATFORMS
|
|
53
73
|
x86_64-linux
|
54
74
|
|
55
75
|
DEPENDENCIES
|
76
|
+
aws-sdk-cloudwatchlogs
|
77
|
+
aws-sdk-cognitoidentity
|
56
78
|
byebug
|
57
79
|
neetodeploy!
|
80
|
+
rexml
|
58
81
|
websocket-eventmachine-client
|
59
82
|
|
60
83
|
BUNDLED WITH
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
require "thor"
|
4
4
|
require "colorize"
|
5
|
-
require "websocket-eventmachine-client"
|
6
5
|
|
6
|
+
require "aws-sdk-cloudwatchlogs"
|
7
|
+
require "aws-sdk-cognitoidentity"
|
7
8
|
require_relative "../session"
|
8
9
|
require_relative "./constants"
|
9
10
|
|
@@ -20,56 +21,78 @@ module NeetoDeploy
|
|
20
21
|
super()
|
21
22
|
@app_slug = app_slug
|
22
23
|
@process_type = process_type
|
24
|
+
@log_client = nil
|
23
25
|
end
|
24
26
|
|
25
27
|
def process!
|
26
|
-
|
28
|
+
start_spinner
|
29
|
+
response = authenticate_user
|
30
|
+
return unless response.success?
|
31
|
+
|
32
|
+
log_params = JSON[response.body]
|
33
|
+
@log_client = cloud_watch_client(log_params)
|
34
|
+
start_log_streaming(log_params)
|
27
35
|
end
|
28
36
|
|
29
37
|
private
|
30
38
|
|
31
|
-
def
|
32
|
-
|
39
|
+
def authenticate_user
|
40
|
+
response = send_post_request(authenticate_live_stream_url, { app_slug:, process_type: })
|
41
|
+
@spinner.stop && ui.error(response) unless response.success?
|
42
|
+
response
|
43
|
+
end
|
44
|
+
|
45
|
+
def cloud_watch_client(log_params)
|
46
|
+
cognito = Aws::CognitoIdentity::Client.new(region: log_params["region"])
|
47
|
+
identity_id = cognito.get_id(identity_pool_id: log_params["identity_pool_id"]).identity_id
|
48
|
+
credentials = cognito.get_credentials_for_identity(identity_id:).credentials
|
49
|
+
|
50
|
+
Aws::CloudWatchLogs::Client.new(
|
51
|
+
region: log_params["region"],
|
52
|
+
access_key_id: credentials.access_key_id,
|
53
|
+
secret_access_key: credentials.secret_key,
|
54
|
+
session_token: credentials.session_token
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
def start_spinner
|
59
|
+
@spinner = TTY::Spinner.new("Starting live stream session [:spinner]", format: :classic)
|
60
|
+
@spinner.auto_spin
|
33
61
|
end
|
34
62
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
channel: "Cli::LogChannel", app_slug:, pubsub_token:, process_type:,
|
46
|
-
session_token:
|
47
|
-
}.to_json
|
63
|
+
def start_log_streaming(log_params)
|
64
|
+
next_token = nil
|
65
|
+
@spinner.stop
|
66
|
+
loop do
|
67
|
+
begin
|
68
|
+
params = {
|
69
|
+
log_group_name: log_params["log_group_name"],
|
70
|
+
log_stream_name: log_params["log_stream_name"],
|
71
|
+
start_from_head: !next_token.nil?,
|
72
|
+
limit: next_token.nil? ? 100 : 1000
|
48
73
|
}
|
49
|
-
ws_connection.send(payload.to_json)
|
50
|
-
end
|
51
74
|
|
52
|
-
|
53
|
-
|
54
|
-
if parsed_message["message"] && parsed_message["type"] != "ping"
|
55
|
-
logs = JSON[parsed_message["message"]]["streams"].flat_map do |stream|
|
56
|
-
stream["values"].map do |array|
|
57
|
-
"#{Time.at(array[0].to_i / 1e9).to_s.light_magenta} #{array[1]}"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
STDOUT.puts logs
|
61
|
-
end
|
75
|
+
params[:next_token] = next_token unless next_token.nil?
|
76
|
+
response = @log_client.get_log_events(params)
|
62
77
|
|
63
|
-
|
64
|
-
puts
|
65
|
-
ws_connection.close
|
66
|
-
exit
|
78
|
+
response.events.each do |event|
|
79
|
+
puts "#{Time.zone.at(event.timestamp / 1000)} #{event.message}"
|
67
80
|
end
|
68
|
-
end
|
69
81
|
|
70
|
-
|
71
|
-
|
82
|
+
if next_token == response.next_forward_token
|
83
|
+
sleep 3
|
84
|
+
else
|
85
|
+
next_token = response.next_forward_token
|
86
|
+
end
|
87
|
+
rescue Aws::CloudWatchLogs::Errors::ExpiredTokenException,
|
88
|
+
Aws::CloudWatchLogs::Errors::UnrecognizedClientException => e
|
89
|
+
warn "Stream time limit has been reached"
|
90
|
+
exit 1
|
91
|
+
rescue => e
|
92
|
+
warn "Connection lost. Reconnecting..."
|
93
|
+
sleep 5
|
72
94
|
end
|
95
|
+
sleep 2
|
73
96
|
end
|
74
97
|
end
|
75
98
|
end
|
@@ -4,9 +4,9 @@ module NeetoDeploy
|
|
4
4
|
class CLI
|
5
5
|
module Logs
|
6
6
|
module Constants
|
7
|
-
NEETO_DEPLOY_CLI_API_ENVIRONMENT_VARIABLES_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/
|
7
|
+
NEETO_DEPLOY_CLI_API_ENVIRONMENT_VARIABLES_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/logs".freeze
|
8
8
|
|
9
|
-
def
|
9
|
+
def authenticate_live_stream_url
|
10
10
|
NEETO_DEPLOY_CLI_API_ENVIRONMENT_VARIABLES_URL
|
11
11
|
end
|
12
12
|
end
|
data/lib/neeto_deploy/cli.rb
CHANGED
@@ -57,5 +57,9 @@ module NeetoDeploy
|
|
57
57
|
|
58
58
|
desc "certificates", "Manage certificates"
|
59
59
|
subcommand "certificates", Certificates::Commands
|
60
|
+
|
61
|
+
desc "version, --version, -v", "Print the version of the gem"
|
62
|
+
map %w[--version -v] => :version
|
63
|
+
def version = puts(NeetoDeploy::VERSION)
|
60
64
|
end
|
61
65
|
end
|
data/lib/neeto_deploy/version.rb
CHANGED
data/neetodeploy.gemspec
CHANGED
@@ -38,6 +38,9 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_dependency "websocket-eventmachine-client"
|
39
39
|
spec.add_dependency "colorize"
|
40
40
|
spec.add_dependency "tty-spinner"
|
41
|
+
spec.add_dependency "aws-sdk-cloudwatchlogs"
|
42
|
+
spec.add_dependency "aws-sdk-cognitoidentity"
|
43
|
+
spec.add_dependency "rexml"
|
41
44
|
|
42
45
|
# To add the files from submodules
|
43
46
|
`git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neetodeploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subin Siby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -122,6 +122,48 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: aws-sdk-cloudwatchlogs
|
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: aws-sdk-cognitoidentity
|
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: rexml
|
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'
|
125
167
|
description: Manage neetoDeploy apps with CLI
|
126
168
|
email:
|
127
169
|
- subin.siby@bigbinary.com
|