neetodeploy 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c89f6daf95ba95dadcfcbfdf897ff3b9642003da42240d53a566549ab7c80039
4
- data.tar.gz: 890eb532d959f1807b315d8fde953bbbe0590bca1b13abfd3f743a77d238b768
3
+ metadata.gz: 852a444976eabbc736b6ab65c2e93c980fa32281f80d0b99f870ca3c7300ffbb
4
+ data.tar.gz: 5cb3f42d7f20af3186a77aef7d2c8d8bf4f0e80cebda965180dbeab17b2a7139
5
5
  SHA512:
6
- metadata.gz: c492b22e65f9e9f4eeccee4f0720346e94a42885efda1086bad9644414a216aea06dec6881b6764ed011867bb76a1132065c6fd77772e70d001c82e0950de4ac
7
- data.tar.gz: ef3ca43ae3235150ca96ebbd5685ec744774ececa07bc8cf9c35f1267f641200de666f2afae80a28f291afcd214cec21979a158186de519c13ed141fdf405491
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.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.2.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.2.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 Config
11
+ module Env
12
12
  class Commands < Thor
13
- desc "list", "List all config vars"
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 CONFIG_VARS", "Set one or more config vars"
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(*config_vars)
22
- Set.new(config_vars, options:).run
21
+ def set(*environment_variables)
22
+ Set.new(environment_variables, options:).run
23
23
  end
24
24
 
25
- desc "unset CONFIG_VARS", "Unset one or more config vars"
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(*config_vars)
28
- Unset.new(config_vars, options:).run
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 Config
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
- config_vars_url, {
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["config_vars"]))
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(config_vars)
43
- config_vars.map do |config_var|
44
- [config_var["key"], config_var["value"].gsub("\\n", "\n")]
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 Config
11
+ module Env
12
12
  class Set < CLI::Base
13
13
  include Constants
14
14
  include Session
15
15
 
16
- attr_reader :app_slug, :config_vars
16
+ attr_reader :app_slug, :environment_variables
17
17
 
18
- def initialize(config_vars_string_array, options:)
18
+ def initialize(environment_variables_string_array, options:)
19
19
  super()
20
20
  @app_slug = options[:app]
21
- @config_vars = config_vars_string_array.map do |config_var|
22
- key, value = config_var.split("=")
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: config_vars.map { |config_var|
31
- [config_var[:key], config_var[:value]]
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 config vars and restarting app...")
36
+ ui.info("Setting environment variables and restarting app...")
37
37
 
38
38
  response = send_post_request(
39
- config_vars_url, {
39
+ environment_variables_url, {
40
40
  app_slug:,
41
- config_vars:
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 = 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://neeto-deploy-lc.neetodeployapp.com/cli_logs?deployment_name=#{app_name}&&process_type=#{process_type}"
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
- message = msg.data
21
- cmd = message[0]
22
- if cmd == "1"
23
- STDOUT.write message.delete_prefix("1")
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 config_vars_url
10
+ def redis_addon_url
11
11
  NEETO_DEPLOY_CLI_API_ADDONS_REDIS_URL
12
12
  end
13
13
 
@@ -21,7 +21,7 @@ module NeetoDeploy
21
21
 
22
22
  def run
23
23
  response = send_patch_request(
24
- config_vars_url, {
24
+ redis_addon_url, {
25
25
  addon_name:,
26
26
  command: "CONFIG get #{key}"
27
27
  }
@@ -29,7 +29,7 @@ module NeetoDeploy
29
29
  end
30
30
 
31
31
  response = send_patch_request(
32
- config_vars_url, {
32
+ redis_addon_url, {
33
33
  addon_name:,
34
34
  command: "CONFIG set #{key} #{value}"
35
35
  }
@@ -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/config/commands"
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 "config", "Manage config vars"
26
- subcommand "config", Config::Commands
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"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NeetoDeploy
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.3"
5
5
  CLI_API_VERSION = "v1"
6
6
  end
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.2.1" # for cli
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.2
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: 2023-10-21 00:00:00.000000000 Z
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.2.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.2.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/config/commands.rb
113
- - lib/neeto_deploy/cli/config/constants.rb
114
- - lib/neeto_deploy/cli/config/list.rb
115
- - lib/neeto_deploy/cli/config/set.rb
116
- - lib/neeto_deploy/cli/config/unset.rb
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