neetodeploy 1.1.2 → 1.1.3
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.lock +3 -3
- data/lib/neeto_deploy/cli/{config → env}/commands.rb +8 -8
- data/lib/neeto_deploy/cli/env/constants.rb +15 -0
- data/lib/neeto_deploy/cli/{config → env}/list.rb +6 -6
- data/lib/neeto_deploy/cli/{config → env}/set.rb +10 -10
- data/lib/neeto_deploy/cli/env/unset.rb +44 -0
- data/lib/neeto_deploy/cli/logs/base.rb +6 -9
- data/lib/neeto_deploy/cli/redis/constants.rb +1 -1
- data/lib/neeto_deploy/cli/redis/get.rb +1 -1
- data/lib/neeto_deploy/cli/redis/set.rb +1 -1
- data/lib/neeto_deploy/cli.rb +3 -3
- data/lib/neeto_deploy/version.rb +1 -1
- data/neetodeploy.gemspec +1 -1
- metadata +9 -9
- data/lib/neeto_deploy/cli/config/constants.rb +0 -15
- data/lib/neeto_deploy/cli/config/unset.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852a444976eabbc736b6ab65c2e93c980fa32281f80d0b99f870ca3c7300ffbb
|
4
|
+
data.tar.gz: 5cb3f42d7f20af3186a77aef7d2c8d8bf4f0e80cebda965180dbeab17b2a7139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 651e70c339bb1d36aa29d967357e13e34e1511e6af1b60e50ca6761c988bccbb31b2093589e980cd5bad3837ec842e7da61dbba5d403cf962135e4bdfef05ed4
|
7
|
+
data.tar.gz: 2c2864829f60f732e64a59fcc406cb6f6a9cbef01866c7af2a101f2f1747526a126a042034054f7099bd53a0cfc6e2740b9970e5746e6a391bdf4f5757a844dc
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neetodeploy (1.1.
|
4
|
+
neetodeploy (1.1.3)
|
5
5
|
dotenv (~> 2.8.1)
|
6
6
|
httparty (~> 0.21.0)
|
7
7
|
launchy (~> 2.5.0)
|
8
8
|
terminal-table (~> 3.0.2)
|
9
|
-
thor (~> 1.
|
9
|
+
thor (~> 1.3.0)
|
10
10
|
websocket-client-simple
|
11
11
|
|
12
12
|
GEM
|
@@ -27,7 +27,7 @@ GEM
|
|
27
27
|
public_suffix (5.0.1)
|
28
28
|
terminal-table (3.0.2)
|
29
29
|
unicode-display_width (>= 1.1.1, < 3)
|
30
|
-
thor (1.
|
30
|
+
thor (1.3.0)
|
31
31
|
unicode-display_width (2.4.2)
|
32
32
|
websocket (1.2.9)
|
33
33
|
websocket-client-simple (0.6.1)
|
@@ -8,24 +8,24 @@ require_relative "./unset"
|
|
8
8
|
|
9
9
|
module NeetoDeploy
|
10
10
|
class CLI
|
11
|
-
module
|
11
|
+
module Env
|
12
12
|
class Commands < Thor
|
13
|
-
desc "list", "List all
|
13
|
+
desc "list", "List all environment variable"
|
14
14
|
option :app, type: :string, aliases: "-a", required: true, desc: "App slug" # TODO make this a common static function
|
15
15
|
def list
|
16
16
|
List.new(options:).run
|
17
17
|
end
|
18
18
|
|
19
|
-
desc "set
|
19
|
+
desc "set ENVIRONMENT_VARIABLES", "Set one or more environment variables"
|
20
20
|
option :app, type: :string, aliases: "-a", required: true, desc: "App slug" # TODO make this a common static function
|
21
|
-
def set(*
|
22
|
-
Set.new(
|
21
|
+
def set(*environment_variables)
|
22
|
+
Set.new(environment_variables, options:).run
|
23
23
|
end
|
24
24
|
|
25
|
-
desc "unset
|
25
|
+
desc "unset ENVIRONMENT_VARIABLES", "Unset one or more environment variables"
|
26
26
|
option :app, type: :string, aliases: "-a", required: true, desc: "App slug" # TODO make this a common static function
|
27
|
-
def unset(*
|
28
|
-
Unset.new(
|
27
|
+
def unset(*environment_variables)
|
28
|
+
Unset.new(environment_variables, options:).run
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NeetoDeploy
|
4
|
+
class CLI
|
5
|
+
module Env
|
6
|
+
module Constants
|
7
|
+
NEETO_DEPLOY_CLI_API_ENVIRONMENT_VARIABLES_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/environment_variables".freeze
|
8
|
+
|
9
|
+
def environment_variables_url
|
10
|
+
NEETO_DEPLOY_CLI_API_ENVIRONMENT_VARIABLES_URL
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -8,7 +8,7 @@ require_relative "./constants"
|
|
8
8
|
|
9
9
|
module NeetoDeploy
|
10
10
|
class CLI
|
11
|
-
module
|
11
|
+
module Env
|
12
12
|
class List < CLI::Base
|
13
13
|
include Constants
|
14
14
|
include Session
|
@@ -22,14 +22,14 @@ module NeetoDeploy
|
|
22
22
|
|
23
23
|
def run
|
24
24
|
response = send_get_request(
|
25
|
-
|
25
|
+
environment_variables_url, {
|
26
26
|
app_slug:
|
27
27
|
}
|
28
28
|
)
|
29
29
|
|
30
30
|
ui.error(response) and return unless response.success?
|
31
31
|
|
32
|
-
table = Terminal::Table.new(headings: table_columns, rows: table_rows(response["
|
32
|
+
table = Terminal::Table.new(headings: table_columns, rows: table_rows(response["environment_variables"]))
|
33
33
|
ui.success(table)
|
34
34
|
end
|
35
35
|
|
@@ -39,9 +39,9 @@ module NeetoDeploy
|
|
39
39
|
["Key", "Value"]
|
40
40
|
end
|
41
41
|
|
42
|
-
def table_rows(
|
43
|
-
|
44
|
-
[
|
42
|
+
def table_rows(environment_variables)
|
43
|
+
environment_variables.map do |environment_variable|
|
44
|
+
[environment_variable["key"], environment_variable["value"].gsub("\\n", "\n")]
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -8,18 +8,18 @@ require_relative "./constants"
|
|
8
8
|
|
9
9
|
module NeetoDeploy
|
10
10
|
class CLI
|
11
|
-
module
|
11
|
+
module Env
|
12
12
|
class Set < CLI::Base
|
13
13
|
include Constants
|
14
14
|
include Session
|
15
15
|
|
16
|
-
attr_reader :app_slug, :
|
16
|
+
attr_reader :app_slug, :environment_variables
|
17
17
|
|
18
|
-
def initialize(
|
18
|
+
def initialize(environment_variables_string_array, options:)
|
19
19
|
super()
|
20
20
|
@app_slug = options[:app]
|
21
|
-
@
|
22
|
-
key, value =
|
21
|
+
@environment_variables = environment_variables_string_array.map do |environment_variable|
|
22
|
+
key, value = environment_variable.split("=")
|
23
23
|
{ key:, value: }
|
24
24
|
end
|
25
25
|
end
|
@@ -27,18 +27,18 @@ module NeetoDeploy
|
|
27
27
|
def run
|
28
28
|
table = Terminal::Table.new(
|
29
29
|
headings: table_columns,
|
30
|
-
rows:
|
31
|
-
[
|
30
|
+
rows: environment_variables.map { |environment_variable|
|
31
|
+
[environment_variable[:key], environment_variable[:value]]
|
32
32
|
}
|
33
33
|
)
|
34
34
|
ui.info(table)
|
35
35
|
|
36
|
-
ui.info("Setting
|
36
|
+
ui.info("Setting environment variables and restarting app...")
|
37
37
|
|
38
38
|
response = send_post_request(
|
39
|
-
|
39
|
+
environment_variables_url, {
|
40
40
|
app_slug:,
|
41
|
-
|
41
|
+
environment_variables:
|
42
42
|
}
|
43
43
|
)
|
44
44
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "terminal-table"
|
4
|
+
require "thor"
|
5
|
+
|
6
|
+
require_relative "../session"
|
7
|
+
require_relative "./constants"
|
8
|
+
|
9
|
+
module NeetoDeploy
|
10
|
+
class CLI
|
11
|
+
module Env
|
12
|
+
class Unset < CLI::Base
|
13
|
+
include Constants
|
14
|
+
include Session
|
15
|
+
|
16
|
+
attr_reader :app_slug, :environment_variables_string_array, :environment_variables
|
17
|
+
|
18
|
+
def initialize(environment_variables_string_array, options:)
|
19
|
+
super()
|
20
|
+
@app_slug = options[:app]
|
21
|
+
@environment_variables_string_array = environment_variables_string_array
|
22
|
+
@environment_variables = environment_variables_string_array.map do |environment_variable_key|
|
23
|
+
{ key: environment_variable_key }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
ui.info("Unsetting environment variable keys #{environment_variables_string_array} and restarting app...")
|
29
|
+
|
30
|
+
response = send_delete_request(
|
31
|
+
environment_variables_url, {
|
32
|
+
app_slug:,
|
33
|
+
environment_variables:
|
34
|
+
}
|
35
|
+
)
|
36
|
+
|
37
|
+
ui.error(response) and return unless response.success?
|
38
|
+
|
39
|
+
ui.success("Done")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -9,19 +9,18 @@ module NeetoDeploy
|
|
9
9
|
attr_reader :app_name, :process_type
|
10
10
|
|
11
11
|
def initialize(app_name, process_type = nil)
|
12
|
-
@app_name
|
12
|
+
@app_name = app_name
|
13
13
|
@process_type = process_type
|
14
14
|
end
|
15
15
|
|
16
16
|
def process!
|
17
|
-
ws = WebSocket::Client::Simple.connect "wss://
|
17
|
+
ws = WebSocket::Client::Simple.connect "wss://loki-gateway.neetodeployapp.com/loki/api/v1/tail?query={container=~\".*#{app_name}.*\"}&start=#{(Time.now - 300).to_i}"
|
18
18
|
|
19
19
|
ws.on :message do |msg|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
STDOUT.flush
|
20
|
+
begin
|
21
|
+
data = JSON.parse(msg.data)
|
22
|
+
puts data["streams"].map { |stream| stream["values"][0][1] }
|
23
|
+
rescue JSON::ParserError => e
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
@@ -35,8 +34,6 @@ module NeetoDeploy
|
|
35
34
|
|
36
35
|
ws.on :error do |e|
|
37
36
|
p e
|
38
|
-
puts "MyserverBackend>> Close entered. Last error:#{$!.class}:#{$!.to_s};Module:#{$0};"
|
39
|
-
$@.each { |backtrace| puts backtrace }
|
40
37
|
exit 1
|
41
38
|
end
|
42
39
|
|
@@ -7,7 +7,7 @@ module NeetoDeploy
|
|
7
7
|
NEETO_DEPLOY_CLI_API_ADDONS_REDIS_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/addons/redis".freeze
|
8
8
|
AVAILABLE_REDIS_CONFIGS_TO_EDIT = ["maxmemory-policy"]
|
9
9
|
|
10
|
-
def
|
10
|
+
def redis_addon_url
|
11
11
|
NEETO_DEPLOY_CLI_API_ADDONS_REDIS_URL
|
12
12
|
end
|
13
13
|
|
data/lib/neeto_deploy/cli.rb
CHANGED
@@ -10,7 +10,7 @@ module NeetoDeploy
|
|
10
10
|
require_relative "cli/login/base"
|
11
11
|
require_relative "cli/exec/base"
|
12
12
|
require_relative "cli/logs/base"
|
13
|
-
require_relative "cli/
|
13
|
+
require_relative "cli/env/commands"
|
14
14
|
require_relative "cli/redis/commands"
|
15
15
|
|
16
16
|
def self.start(*)
|
@@ -22,8 +22,8 @@ module NeetoDeploy
|
|
22
22
|
CLI::Login::Base.new.process!
|
23
23
|
end
|
24
24
|
|
25
|
-
desc "
|
26
|
-
subcommand "
|
25
|
+
desc "env", "Manage environment variable"
|
26
|
+
subcommand "env", Env::Commands
|
27
27
|
|
28
28
|
desc "exec", "Exec into deployment"
|
29
29
|
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
data/lib/neeto_deploy/version.rb
CHANGED
data/neetodeploy.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency "httparty", "~> 0.21.0" # for http requests
|
35
35
|
spec.add_dependency "launchy", "~> 2.5.0" # for opening in browser
|
36
36
|
spec.add_dependency "terminal-table", "~> 3.0.2" # for building cli table
|
37
|
-
spec.add_dependency "thor", "~> 1.
|
37
|
+
spec.add_dependency "thor", "~> 1.3.0" # for cli
|
38
38
|
spec.add_dependency "websocket-client-simple"
|
39
39
|
|
40
40
|
# To add the files from submodules
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subin Siby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.3.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.3.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: websocket-client-simple
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,11 +109,11 @@ files:
|
|
109
109
|
- lib/neeto_deploy.rb
|
110
110
|
- lib/neeto_deploy/cli.rb
|
111
111
|
- lib/neeto_deploy/cli/base.rb
|
112
|
-
- lib/neeto_deploy/cli/
|
113
|
-
- lib/neeto_deploy/cli/
|
114
|
-
- lib/neeto_deploy/cli/
|
115
|
-
- lib/neeto_deploy/cli/
|
116
|
-
- lib/neeto_deploy/cli/
|
112
|
+
- lib/neeto_deploy/cli/env/commands.rb
|
113
|
+
- lib/neeto_deploy/cli/env/constants.rb
|
114
|
+
- lib/neeto_deploy/cli/env/list.rb
|
115
|
+
- lib/neeto_deploy/cli/env/set.rb
|
116
|
+
- lib/neeto_deploy/cli/env/unset.rb
|
117
117
|
- lib/neeto_deploy/cli/exec/base.rb
|
118
118
|
- lib/neeto_deploy/cli/exec/constants.rb
|
119
119
|
- lib/neeto_deploy/cli/login/base.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NeetoDeploy
|
4
|
-
class CLI
|
5
|
-
module Config
|
6
|
-
module Constants
|
7
|
-
NEETO_DEPLOY_CLI_API_CONFIG_VARS_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/config_vars".freeze
|
8
|
-
|
9
|
-
def config_vars_url
|
10
|
-
NEETO_DEPLOY_CLI_API_CONFIG_VARS_URL
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "terminal-table"
|
4
|
-
require "thor"
|
5
|
-
|
6
|
-
require_relative "../session"
|
7
|
-
require_relative "./constants"
|
8
|
-
|
9
|
-
module NeetoDeploy
|
10
|
-
class CLI
|
11
|
-
module Config
|
12
|
-
class Unset < CLI::Base
|
13
|
-
include Constants
|
14
|
-
include Session
|
15
|
-
|
16
|
-
attr_reader :app_slug, :config_vars_string_array, :config_vars
|
17
|
-
|
18
|
-
def initialize(config_vars_string_array, options:)
|
19
|
-
super()
|
20
|
-
@app_slug = options[:app]
|
21
|
-
@config_vars_string_array = config_vars_string_array
|
22
|
-
@config_vars = config_vars_string_array.map do |config_var_key|
|
23
|
-
{ key: config_var_key }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def run
|
28
|
-
ui.info("Unsetting config var keys #{config_vars_string_array} and restarting app...")
|
29
|
-
|
30
|
-
response = send_delete_request(
|
31
|
-
config_vars_url, {
|
32
|
-
app_slug:,
|
33
|
-
config_vars:
|
34
|
-
}
|
35
|
-
)
|
36
|
-
|
37
|
-
ui.error(response) and return unless response.success?
|
38
|
-
|
39
|
-
ui.success("Done")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|