neetodeploy 1.0.9 → 1.1.0

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: 276d258156c0ee7ad4bc734309338fcc556ae8436091d0a11d0b6ff6e3df1e62
4
- data.tar.gz: ea6e841532dba9be78480550fca53f4f3130c4da5b50e2cacc808e55d00e9817
3
+ metadata.gz: 8c161224698854e2f75b4befe191e37a59f6aad8149ec7a52d0c531fe73f1cd4
4
+ data.tar.gz: a169636696ce3d36927d12bfa139f0e25fe4cc6377aa7ff16e20d94d078abbe5
5
5
  SHA512:
6
- metadata.gz: c910a456114f52e635d6ebd825f36d248d64a15f2e0237da297654a0e40d66c8b4074b3f984dc3b8b1b21ca412e69876c0e6d1bb65470fcbf15cc57196583a3c
7
- data.tar.gz: b653ba2d0c4f2737bf94834ff9ffadf03700474c1e63bbdebc2f4e1780df67891e65692bc2c4deafcbbe88dac15dc1b4b3af7ea4b6c16e4a717470b8c70a8c2e
6
+ metadata.gz: ce56591c787b745570c5ea9bd8810cc88b9688ea1430523908a66fe81e97e358a9479b8810ef11fe36c74ca23de188e356db2fc58ef97e51db2db9f5e9b3af99
7
+ data.tar.gz: 298de13cd65cfe66bf600857721fc7254d9752ab73acb89525697d983d520be238ff21c08b05f657e388743399199d26ee788908bd5dccd7326b1bd33c89395e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetodeploy (1.0.7)
4
+ neetodeploy (1.0.10)
5
5
  dotenv (~> 2.8.1)
6
6
  httparty (~> 0.21.0)
7
7
  launchy (~> 2.5.0)
@@ -5,7 +5,7 @@ require_relative "../version"
5
5
 
6
6
  module NeetoDeploy
7
7
  class CLI
8
- NEETO_DEPLOY_HOST = ENV["NEETO_DEPLOY_HOST"] || "https://app.neetodeploy.net"
8
+ NEETO_DEPLOY_HOST = ENV["NEETO_DEPLOY_HOST"] || "https://app.neetodeploy.com"
9
9
  NEETO_DEPLOY_CLI_API_BASE_URL = "#{NEETO_DEPLOY_HOST}/api/cli/#{CLI_API_VERSION}"
10
10
 
11
11
  CLI_CONFIG_DIR = "~/.config/neetodeploy".freeze
@@ -34,7 +34,7 @@ module NeetoDeploy
34
34
 
35
35
  console_token = response.parsed_response["console_token"]
36
36
 
37
- ws = WebSocket::Client::Simple.connect "wss://neeto-deploy-lc.neetoreviewapp.net/cli_console?deployment_name=#{app_name}&console_token=#{console_token}"
37
+ ws = WebSocket::Client::Simple.connect "wss://neeto-deploy-lc.neetodeployapp.com/cli_console?deployment_name=#{app_name}&console_token=#{console_token}"
38
38
 
39
39
  prompt = ''
40
40
 
@@ -14,7 +14,7 @@ module NeetoDeploy
14
14
  end
15
15
 
16
16
  def process!
17
- ws = WebSocket::Client::Simple.connect "wss://neeto-deploy-lc.neetoreviewapp.net/cli_logs?deployment_name=#{app_name}&&process_type=#{process_type}"
17
+ ws = WebSocket::Client::Simple.connect "wss://neeto-deploy-lc.neetodeployapp.com/cli_logs?deployment_name=#{app_name}&&process_type=#{process_type}"
18
18
 
19
19
  ws.on :message do |msg|
20
20
  message = msg.data
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require_relative "./set"
5
+
6
+ module NeetoDeploy
7
+ class CLI
8
+ module Redis
9
+ class Commands < Thor
10
+ desc "set", "Set redis config"
11
+ option :addon_name, type: :string, aliases: "-n", required: true, desc: "Addon name"
12
+ option :key, type: :string, aliases: "-k", required: true, desc: "CONFIG name"
13
+ option :value, type: :string, aliases: "-v", required: true, desc: "New value for the CONFIG"
14
+
15
+ def set
16
+ Set.new(options).run
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoDeploy
4
+ class CLI
5
+ module Redis
6
+ module Constants
7
+ NEETO_DEPLOY_CLI_API_ADDONS_REDIS_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/addons/redis".freeze
8
+ AVAILABLE_REDIS_CONFIGS_TO_EDIT = ["maxmemory-policy"]
9
+
10
+ def config_vars_url
11
+ NEETO_DEPLOY_CLI_API_ADDONS_REDIS_URL
12
+ end
13
+
14
+ def available_configs_to_edit
15
+ AVAILABLE_REDIS_CONFIGS_TO_EDIT
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require "byebug"
5
+
6
+ require_relative "../session"
7
+ require_relative "./constants"
8
+
9
+ module NeetoDeploy
10
+ class CLI
11
+ module Redis
12
+ class Set < CLI::Base
13
+ include Constants
14
+ include Session
15
+
16
+ attr_reader :addon_name, :key, :value
17
+
18
+ def initialize(options)
19
+ super()
20
+ @addon_name = options[:addon_name]
21
+ @key = options[:key]
22
+ @value = options[:value]
23
+ end
24
+
25
+ def run
26
+ unless valid_config?
27
+ ui.error("Could not set cofig \"#{key}\". Please refer manageable redis configs: #{AVAILABLE_REDIS_CONFIGS_TO_EDIT}")
28
+ return
29
+ end
30
+
31
+ response = send_patch_request(
32
+ config_vars_url, {
33
+ addon_name:,
34
+ command: "CONFIG set #{key} #{value}"
35
+ }
36
+ )
37
+
38
+ ui.error(response) and return unless response.success?
39
+
40
+ ui.success("Done")
41
+ end
42
+
43
+ private
44
+
45
+ def valid_config?
46
+ AVAILABLE_REDIS_CONFIGS_TO_EDIT.include?(key)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -20,6 +20,10 @@ module NeetoDeploy
20
20
  HTTParty.post(url, { body: common_body.merge(body), format: :json })
21
21
  end
22
22
 
23
+ def send_patch_request(url, body)
24
+ HTTParty.patch(url, { body: common_body.merge(body), format: :json })
25
+ end
26
+
23
27
  def send_delete_request(url, body)
24
28
  HTTParty.delete(url, { body: common_body.merge(body), format: :json })
25
29
  end
@@ -11,6 +11,7 @@ module NeetoDeploy
11
11
  require_relative "cli/exec/base"
12
12
  require_relative "cli/logs/base"
13
13
  require_relative "cli/config/commands"
14
+ require_relative "cli/redis/commands"
14
15
 
15
16
  def self.start(*)
16
17
  super
@@ -36,5 +37,8 @@ module NeetoDeploy
36
37
  def logs
37
38
  CLI::Logs::Base.new(options[:app], options[:process_type]).process!
38
39
  end
40
+
41
+ desc "redis", "Manage redis addons"
42
+ subcommand "redis", Redis::Commands
39
43
  end
40
44
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NeetoDeploy
4
- VERSION = "1.0.9"
4
+ VERSION = "1.1.0"
5
5
  CLI_API_VERSION = "v1"
6
6
  end
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.0.9
4
+ version: 1.1.0
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-06-30 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -119,6 +119,9 @@ files:
119
119
  - lib/neeto_deploy/cli/login/base.rb
120
120
  - lib/neeto_deploy/cli/login/constants.rb
121
121
  - lib/neeto_deploy/cli/logs/base.rb
122
+ - lib/neeto_deploy/cli/redis/commands.rb
123
+ - lib/neeto_deploy/cli/redis/constants.rb
124
+ - lib/neeto_deploy/cli/redis/set.rb
122
125
  - lib/neeto_deploy/cli/session.rb
123
126
  - lib/neeto_deploy/cli/ui.rb
124
127
  - lib/neeto_deploy/exception_handler.rb