neetodeploy 1.0.8 → 1.0.10

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: 4ea4f99fbeaf0fbd93641b5efb3d492d16417095156ead2075b38f9554aed01e
4
- data.tar.gz: 0d209c71f40f53589929a71d741025fc44bafd4f4c2ad13bc80a5d4265e1d77b
3
+ metadata.gz: 71f7bffb15831fca9de9c9b0bb4d15f0ea492bb6bfe3c9c944d77de63b636abd
4
+ data.tar.gz: 12ec41e153c3d7b4cbc79e399c24d9e749019230f903d6ed46111b46a4ab1613
5
5
  SHA512:
6
- metadata.gz: 31defc5670116331de581587d1e235a08026f5b58833eca0bff8a0eb7d6750303cd9dc6571fd057e04191433b6d21bee3dc3db92d044f36722a015161e2e393c
7
- data.tar.gz: 3bcdcda2d127a42aded214d4e8fac649762b6e26e599c09fb35d564615410185646bd1ded577bcd2104523ed040cd9d7f90c7f46d1d07efaded2c6a4a596a0d0
6
+ metadata.gz: 5d959e2b4ce7c50fe65420dc22c5520c30a99337ca2f8ebe948f00c875e141c1e227de9aa47d4062c4037f81b8867f8d4167dcc1566413d14a22a36f0124ef3d
7
+ data.tar.gz: 45b8e4294612f2d80330aa67c57b1c2e9c778d8ea2c59fa20b1a9a957a9bebde0dfad43cb165c8d3c48f1ad87bf381cfb7848847b019f57633f249e84eb45e23
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)
data/exe/neetodeploy CHANGED
@@ -2,28 +2,21 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "dotenv"
5
- require "bundler/setup"
6
5
 
7
6
  MIN_RUBY_VERSION = File.read(File.expand_path("../.ruby-version", __dir__)).strip
8
7
 
9
8
  raise "neetodeploy requires Ruby version of #{MIN_RUBY_VERSION} or higher" if RUBY_VERSION < MIN_RUBY_VERSION
10
9
 
11
- Dotenv.load(
12
- File.expand_path("../.env.development", __dir__)
13
- )
10
+ Dotenv.load(File.expand_path("../.env.development", __dir__))
14
11
 
15
- base_path = File.expand_path("../lib", __dir__)
16
-
17
- if File.exist?(base_path)
12
+ if ENV["DEV_ENVIRONMENT"]
18
13
  require_relative "../lib/neeto_deploy"
19
14
  else
20
15
  require "neeto_deploy"
21
16
  end
22
17
 
23
- args = ARGV
24
-
25
18
  begin
26
- NeetoDeploy::CLI.start(args, debug: true)
19
+ NeetoDeploy::CLI.start(ARGV, debug: true)
27
20
  rescue Exception => e
28
21
  NeetoDeploy::ExceptionHandler.new(e).process
29
22
  end
@@ -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.8"
4
+ VERSION = "1.0.10"
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.8
4
+ version: 1.0.10
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-05-30 00:00:00.000000000 Z
11
+ date: 2023-08-25 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