neetodeploy 1.3.0 → 1.4.0
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 +1 -1
- data/lib/neeto_deploy/cli/activity/commands.rb +20 -0
- data/lib/neeto_deploy/cli/activity/list.rb +53 -0
- data/lib/neeto_deploy/cli/addon/commands.rb +7 -0
- data/lib/neeto_deploy/cli/addon/constants.rb +4 -0
- data/lib/neeto_deploy/cli/addon/list.rb +49 -0
- data/lib/neeto_deploy/cli/buildpacks/commands.rb +18 -0
- data/lib/neeto_deploy/cli/buildpacks/list.rb +40 -0
- data/lib/neeto_deploy/cli/deploy/base.rb +30 -0
- data/lib/neeto_deploy/cli/maintenance/base.rb +60 -0
- data/lib/neeto_deploy/cli/maintenance/commands.rb +30 -0
- data/lib/neeto_deploy/cli/processes/commands.rb +40 -0
- data/lib/neeto_deploy/cli/processes/constants.rb +17 -0
- data/lib/neeto_deploy/cli/processes/list.rb +49 -0
- data/lib/neeto_deploy/cli/processes/scale.rb +34 -0
- data/lib/neeto_deploy/cli/processes/set_resources.rb +38 -0
- data/lib/neeto_deploy/cli/restart/base.rb +30 -0
- data/lib/neeto_deploy/cli.rb +30 -0
- data/lib/neeto_deploy/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ab15f066189c5b30250ff4b140cdc5e41abe8bd8dc74ec0e452aebf5a783782
|
|
4
|
+
data.tar.gz: 55c8b9dfe06de17f9977a0909e134ec29d392f4a4027a8123a140d1d41d5c31d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2e8239f4bf6997a1e4effbbc9d2c35ba35d9799b8435ec13b6027ffb5fb4374610f2b8e96e3827f9ce1ec228b548674fb4058124f30f9c28ab9077bebf97a1c
|
|
7
|
+
data.tar.gz: 1a84ce52eb7148fda8a95099d98e73865fb5625c9a0de97122ea89e4d330ae8be3bdbbecdca39954359de4de8146f2a02d25244223624b6d5acbc2df4161609e
|
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
require_relative "./list"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Activity
|
|
9
|
+
class Commands < Thor
|
|
10
|
+
desc "list", "List activity for an app"
|
|
11
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
12
|
+
option :type, type: :string, aliases: "-t", desc: "Filter by type: deployment, process, app"
|
|
13
|
+
option :page, type: :numeric, aliases: "-p", default: 1, desc: "Page number"
|
|
14
|
+
def list
|
|
15
|
+
List.new(options:).run
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "terminal-table"
|
|
4
|
+
require_relative "../session"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Activity
|
|
9
|
+
class List < CLI::Base
|
|
10
|
+
include Session
|
|
11
|
+
|
|
12
|
+
attr_reader :app_slug, :type, :page
|
|
13
|
+
|
|
14
|
+
def initialize(options:)
|
|
15
|
+
super()
|
|
16
|
+
@app_slug = options[:app]
|
|
17
|
+
@type = options[:type]
|
|
18
|
+
@page = options[:page] || 1
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
ui.execute_with_loading("Fetching activity...") do
|
|
23
|
+
body = { app_slug: }
|
|
24
|
+
body[:type] = type if type
|
|
25
|
+
body[:page] = page
|
|
26
|
+
@response = send_get_request("#{NEETO_DEPLOY_CLI_API_BASE_URL}/activities", body)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
30
|
+
|
|
31
|
+
parsed = JSON.parse(@response.body)
|
|
32
|
+
activities = parsed["activities"]
|
|
33
|
+
|
|
34
|
+
if activities.nil? || activities.empty?
|
|
35
|
+
ui.info("No activity found for #{app_slug}.")
|
|
36
|
+
return
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
rows = activities.map do |a|
|
|
40
|
+
performer = a["performer"] || "system"
|
|
41
|
+
metadata = a["metadata"]&.map { |k, v| "#{k}: #{v}" }&.join(", ") || ""
|
|
42
|
+
metadata = "#{metadata[0..97]}..." if metadata.length > 100
|
|
43
|
+
[a["key"], a["performed_at"], performer, metadata]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
table = Terminal::Table.new(headings: ["Event", "Time", "By", "Details"], rows: rows)
|
|
47
|
+
ui.info(table)
|
|
48
|
+
ui.info("Page #{parsed["current_page"]} of #{parsed["total_pages"]}")
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "thor"
|
|
4
|
+
require_relative "./list"
|
|
4
5
|
require_relative "./info"
|
|
5
6
|
require_relative "./scheduled_exports_settings"
|
|
6
7
|
|
|
@@ -8,6 +9,12 @@ module NeetoDeploy
|
|
|
8
9
|
class CLI
|
|
9
10
|
module Addon
|
|
10
11
|
class Commands < Thor
|
|
12
|
+
desc "list", "List all addons for an app"
|
|
13
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
14
|
+
def list
|
|
15
|
+
List.new(options:).run
|
|
16
|
+
end
|
|
17
|
+
|
|
11
18
|
desc "info", "Get addon informations"
|
|
12
19
|
option :addon, type: :string, aliases: "-n", required: true, desc: "Addon name"
|
|
13
20
|
def info
|
|
@@ -6,6 +6,10 @@ module NeetoDeploy
|
|
|
6
6
|
module Constants
|
|
7
7
|
NEETO_DEPLOY_CLI_API_ADDON_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/addons".freeze
|
|
8
8
|
|
|
9
|
+
def addons_url
|
|
10
|
+
NEETO_DEPLOY_CLI_API_ADDON_URL
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
def addon_url(addon_name)
|
|
10
14
|
"#{NEETO_DEPLOY_CLI_API_BASE_URL}/addons/#{addon_name}"
|
|
11
15
|
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "terminal-table"
|
|
4
|
+
require_relative "../session"
|
|
5
|
+
require_relative "./constants"
|
|
6
|
+
|
|
7
|
+
module NeetoDeploy
|
|
8
|
+
class CLI
|
|
9
|
+
module Addon
|
|
10
|
+
class List < CLI::Base
|
|
11
|
+
include Session
|
|
12
|
+
include Constants
|
|
13
|
+
|
|
14
|
+
attr_reader :app_slug
|
|
15
|
+
|
|
16
|
+
def initialize(options:)
|
|
17
|
+
super()
|
|
18
|
+
@app_slug = options[:app]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
ui.execute_with_loading("Fetching addons...") do
|
|
23
|
+
@response = send_get_request(addons_url, { app_slug: })
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
27
|
+
|
|
28
|
+
addons = JSON.parse(@response.body)["addons"]
|
|
29
|
+
|
|
30
|
+
if addons.nil? || addons.empty?
|
|
31
|
+
ui.info("No addons found for #{app_slug}.")
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
rows = addons.map do |addon|
|
|
36
|
+
attached_as = Array(addon["attached_as"]).join(", ")
|
|
37
|
+
[addon["name"], addon["kind"], "#{addon["cpu"]} mvCPU", "#{addon["memory"]} MB", addon["status"], attached_as]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
table = Terminal::Table.new(
|
|
41
|
+
headings: ["Name", "Kind", "CPU", "Memory", "Status", "Attached As"],
|
|
42
|
+
rows: rows
|
|
43
|
+
)
|
|
44
|
+
ui.info(table)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
require_relative "./list"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Buildpacks
|
|
9
|
+
class Commands < Thor
|
|
10
|
+
desc "list", "List buildpacks for an app"
|
|
11
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
12
|
+
def list
|
|
13
|
+
List.new(options:).run
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "terminal-table"
|
|
4
|
+
require_relative "../session"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Buildpacks
|
|
9
|
+
class List < CLI::Base
|
|
10
|
+
include Session
|
|
11
|
+
|
|
12
|
+
attr_reader :app_slug
|
|
13
|
+
|
|
14
|
+
def initialize(options:)
|
|
15
|
+
super()
|
|
16
|
+
@app_slug = options[:app]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def run
|
|
20
|
+
ui.execute_with_loading("Fetching buildpacks...") do
|
|
21
|
+
@response = send_get_request("#{NEETO_DEPLOY_CLI_API_BASE_URL}/buildpacks", { app_slug: })
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
25
|
+
|
|
26
|
+
buildpacks = JSON.parse(@response.body)["buildpacks"]
|
|
27
|
+
|
|
28
|
+
if buildpacks.nil? || buildpacks.empty?
|
|
29
|
+
ui.info("No buildpacks found for #{app_slug}.")
|
|
30
|
+
return
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
rows = buildpacks.map { |b| [b["position"], b["url"]] }
|
|
34
|
+
table = Terminal::Table.new(headings: ["Position", "Buildpack"], rows: rows)
|
|
35
|
+
ui.info(table)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../session"
|
|
4
|
+
|
|
5
|
+
module NeetoDeploy
|
|
6
|
+
class CLI
|
|
7
|
+
module Deploy
|
|
8
|
+
class Base < CLI::Base
|
|
9
|
+
include Session
|
|
10
|
+
|
|
11
|
+
attr_reader :app_slug
|
|
12
|
+
|
|
13
|
+
def initialize(app_slug)
|
|
14
|
+
super()
|
|
15
|
+
@app_slug = app_slug
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def process!
|
|
19
|
+
ui.execute_with_loading("Triggering deployment for #{app_slug}...") do
|
|
20
|
+
@response = send_post_request("#{NEETO_DEPLOY_CLI_API_BASE_URL}/deployments", { app_slug: })
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
24
|
+
|
|
25
|
+
ui.success(JSON.parse(@response.body)["message"])
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../session"
|
|
4
|
+
|
|
5
|
+
module NeetoDeploy
|
|
6
|
+
class CLI
|
|
7
|
+
module Maintenance
|
|
8
|
+
class Base < CLI::Base
|
|
9
|
+
include Session
|
|
10
|
+
|
|
11
|
+
attr_reader :app_slug
|
|
12
|
+
|
|
13
|
+
def initialize(app_slug)
|
|
14
|
+
super()
|
|
15
|
+
@app_slug = app_slug
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def url
|
|
19
|
+
"#{NEETO_DEPLOY_CLI_API_BASE_URL}/maintenance_mode"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def show
|
|
23
|
+
ui.execute_with_loading("Fetching maintenance mode status...") do
|
|
24
|
+
@response = send_get_request(url, { app_slug: })
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
28
|
+
|
|
29
|
+
mm = JSON.parse(@response.body)["maintenance_mode"]
|
|
30
|
+
status = mm["enabled"] ? "enabled".colorize(:red) : "disabled".colorize(:green)
|
|
31
|
+
ui.info("Maintenance mode: #{status}")
|
|
32
|
+
ui.info("Type: #{mm["mode_type"]}") if mm["mode_type"]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def enable
|
|
36
|
+
toggle(true)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def disable
|
|
40
|
+
toggle(false)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def toggle(enabled)
|
|
46
|
+
action = enabled ? "Enabling" : "Disabling"
|
|
47
|
+
ui.execute_with_loading("#{action} maintenance mode for #{app_slug}...") do
|
|
48
|
+
@response = send_patch_request(url, { app_slug:, enabled: })
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
52
|
+
|
|
53
|
+
mm = JSON.parse(@response.body)["maintenance_mode"]
|
|
54
|
+
status = mm["enabled"] ? "enabled".colorize(:red) : "disabled".colorize(:green)
|
|
55
|
+
ui.success("Maintenance mode #{status} for #{app_slug}")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
require_relative "./base"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Maintenance
|
|
9
|
+
class Commands < Thor
|
|
10
|
+
desc "show", "Show maintenance mode status for an app"
|
|
11
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
12
|
+
def show
|
|
13
|
+
Base.new(options[:app]).show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc "enable", "Enable maintenance mode for an app"
|
|
17
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
18
|
+
def enable
|
|
19
|
+
Base.new(options[:app]).enable
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "disable", "Disable maintenance mode for an app"
|
|
23
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
24
|
+
def disable
|
|
25
|
+
Base.new(options[:app]).disable
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
require_relative "./constants"
|
|
5
|
+
require_relative "./list"
|
|
6
|
+
require_relative "./scale"
|
|
7
|
+
require_relative "./set_resources"
|
|
8
|
+
|
|
9
|
+
module NeetoDeploy
|
|
10
|
+
class CLI
|
|
11
|
+
module Processes
|
|
12
|
+
class Commands < Thor
|
|
13
|
+
desc "list", "List all processes for an app"
|
|
14
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
15
|
+
def list
|
|
16
|
+
List.new(options:).run
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
desc "scale", "Scale dyno count for a process"
|
|
20
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
21
|
+
option :process_type, type: :string, aliases: "-p", required: true, desc: "Process type"
|
|
22
|
+
option :dyno_count, type: :numeric, aliases: "-d", required: true, desc: "Number of dynos"
|
|
23
|
+
def scale
|
|
24
|
+
Scale.new(options:).run
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc "set-resources", "Update CPU/RAM for a process"
|
|
28
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
29
|
+
option :process_type, type: :string, aliases: "-p", required: true, desc: "Process type"
|
|
30
|
+
option :cpu, type: :numeric, aliases: "-c", desc: "CPU in mvCPU (e.g. 600)"
|
|
31
|
+
option :memory, type: :numeric, aliases: "-m", desc: "Memory in MB (e.g. 2000)"
|
|
32
|
+
def set_resources
|
|
33
|
+
ui = CLI::UI.new
|
|
34
|
+
ui.error("Specify at least one of --cpu or --memory") and return if options[:cpu].nil? && options[:memory].nil?
|
|
35
|
+
SetResources.new(options:).run
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NeetoDeploy
|
|
4
|
+
class CLI
|
|
5
|
+
module Processes
|
|
6
|
+
module Constants
|
|
7
|
+
def processes_url
|
|
8
|
+
"#{NEETO_DEPLOY_CLI_API_BASE_URL}/processes"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def process_url(process_type)
|
|
12
|
+
"#{NEETO_DEPLOY_CLI_API_BASE_URL}/processes/#{process_type}"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "terminal-table"
|
|
4
|
+
require_relative "../session"
|
|
5
|
+
require_relative "./constants"
|
|
6
|
+
|
|
7
|
+
module NeetoDeploy
|
|
8
|
+
class CLI
|
|
9
|
+
module Processes
|
|
10
|
+
class List < CLI::Base
|
|
11
|
+
include Session
|
|
12
|
+
include Constants
|
|
13
|
+
|
|
14
|
+
attr_reader :app_slug
|
|
15
|
+
|
|
16
|
+
def initialize(options:)
|
|
17
|
+
super()
|
|
18
|
+
@app_slug = options[:app]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
ui.execute_with_loading("Fetching processes...") do
|
|
23
|
+
@response = send_get_request(processes_url, { app_slug: })
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
27
|
+
|
|
28
|
+
processes = JSON.parse(@response.body)["processes"]
|
|
29
|
+
|
|
30
|
+
if processes.nil? || processes.empty?
|
|
31
|
+
ui.info("No processes found for #{app_slug}.")
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
rows = processes.map do |p|
|
|
36
|
+
autoscaling = p["autoscaling_enabled"] ? "Yes (#{p["autoscaling_type"]})" : "No"
|
|
37
|
+
[p["process_type"], p["dyno_count"], "#{p["cpu"]} mvCPU", "#{p["memory"]} MB", autoscaling, p["command"]]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
table = Terminal::Table.new(
|
|
41
|
+
headings: ["Process", "Dynos", "CPU", "Memory", "Autoscaling", "Command"],
|
|
42
|
+
rows: rows
|
|
43
|
+
)
|
|
44
|
+
ui.info(table)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../session"
|
|
4
|
+
require_relative "./constants"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Processes
|
|
9
|
+
class Scale < CLI::Base
|
|
10
|
+
include Session
|
|
11
|
+
include Constants
|
|
12
|
+
|
|
13
|
+
attr_reader :app_slug, :process_type, :dyno_count
|
|
14
|
+
|
|
15
|
+
def initialize(options:)
|
|
16
|
+
super()
|
|
17
|
+
@app_slug = options[:app]
|
|
18
|
+
@process_type = options[:process_type]
|
|
19
|
+
@dyno_count = options[:dyno_count]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def run
|
|
23
|
+
ui.execute_with_loading("Scaling #{process_type}...") do
|
|
24
|
+
@response = send_patch_request(process_url(process_type), { app_slug:, dyno_count: })
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
28
|
+
|
|
29
|
+
ui.success(JSON.parse(@response.body)["message"])
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../session"
|
|
4
|
+
require_relative "./constants"
|
|
5
|
+
|
|
6
|
+
module NeetoDeploy
|
|
7
|
+
class CLI
|
|
8
|
+
module Processes
|
|
9
|
+
class SetResources < CLI::Base
|
|
10
|
+
include Session
|
|
11
|
+
include Constants
|
|
12
|
+
|
|
13
|
+
attr_reader :app_slug, :process_type, :cpu, :memory
|
|
14
|
+
|
|
15
|
+
def initialize(options:)
|
|
16
|
+
super()
|
|
17
|
+
@app_slug = options[:app]
|
|
18
|
+
@process_type = options[:process_type]
|
|
19
|
+
@cpu = options[:cpu]
|
|
20
|
+
@memory = options[:memory]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def run
|
|
24
|
+
ui.execute_with_loading("Updating resources for #{process_type}...") do
|
|
25
|
+
@response = send_patch_request(
|
|
26
|
+
"#{process_url(process_type)}/set_resources",
|
|
27
|
+
{ app_slug:, cpu:, memory: }.compact
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
ui.error(@response["error"] || @response.message) and return unless @response.success?
|
|
32
|
+
|
|
33
|
+
ui.success(JSON.parse(@response.body)["message"])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../session"
|
|
4
|
+
|
|
5
|
+
module NeetoDeploy
|
|
6
|
+
class CLI
|
|
7
|
+
module Restart
|
|
8
|
+
class Base < CLI::Base
|
|
9
|
+
include Session
|
|
10
|
+
|
|
11
|
+
attr_reader :app_slug
|
|
12
|
+
|
|
13
|
+
def initialize(app_slug)
|
|
14
|
+
super()
|
|
15
|
+
@app_slug = app_slug
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def process!
|
|
19
|
+
ui.execute_with_loading("Restarting #{app_slug}...") do
|
|
20
|
+
@response = send_post_request("#{NEETO_DEPLOY_CLI_API_BASE_URL}/restart", { app_slug: })
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
return ui.error(@response["error"] || @response.message) unless @response.success?
|
|
24
|
+
|
|
25
|
+
ui.success(JSON.parse(@response.body)["message"])
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/neeto_deploy/cli.rb
CHANGED
|
@@ -18,6 +18,12 @@ module NeetoDeploy
|
|
|
18
18
|
require_relative "cli/addon/commands"
|
|
19
19
|
require_relative "cli/autoscaling_config/commands"
|
|
20
20
|
require_relative "cli/certificates/commands"
|
|
21
|
+
require_relative "cli/processes/commands"
|
|
22
|
+
require_relative "cli/restart/base"
|
|
23
|
+
require_relative "cli/deploy/base"
|
|
24
|
+
require_relative "cli/activity/commands"
|
|
25
|
+
require_relative "cli/maintenance/commands"
|
|
26
|
+
require_relative "cli/buildpacks/commands"
|
|
21
27
|
|
|
22
28
|
# Define exit behavior for Thor 1.5.0+
|
|
23
29
|
# Set to false to maintain current behavior (exit with status 0)
|
|
@@ -72,6 +78,30 @@ module NeetoDeploy
|
|
|
72
78
|
desc "certificates", "Manage certificates"
|
|
73
79
|
subcommand "certificates", Certificates::Commands
|
|
74
80
|
|
|
81
|
+
desc "processes", "Manage processes and dynos"
|
|
82
|
+
subcommand "processes", Processes::Commands
|
|
83
|
+
|
|
84
|
+
desc "restart", "Restart an app"
|
|
85
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
86
|
+
def restart
|
|
87
|
+
CLI::Restart::Base.new(options[:app]).process!
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
desc "deploy", "Trigger a deployment"
|
|
91
|
+
option :app, type: :string, aliases: "-a", required: true, desc: "App slug"
|
|
92
|
+
def deploy
|
|
93
|
+
CLI::Deploy::Base.new(options[:app]).process!
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
desc "activity", "View app activity"
|
|
97
|
+
subcommand "activity", Activity::Commands
|
|
98
|
+
|
|
99
|
+
desc "maintenance", "Manage maintenance mode"
|
|
100
|
+
subcommand "maintenance", Maintenance::Commands
|
|
101
|
+
|
|
102
|
+
desc "buildpacks", "Manage buildpacks"
|
|
103
|
+
subcommand "buildpacks", Buildpacks::Commands
|
|
104
|
+
|
|
75
105
|
desc "version, --version, -v", "Print the version of the gem"
|
|
76
106
|
map %w[--version -v] => :version
|
|
77
107
|
def version = puts(NeetoDeploy::VERSION)
|
data/lib/neeto_deploy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: neetodeploy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Subin Siby
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: dotenv
|
|
@@ -224,9 +223,12 @@ files:
|
|
|
224
223
|
- exe/neetodeploy
|
|
225
224
|
- lib/neeto_deploy.rb
|
|
226
225
|
- lib/neeto_deploy/cli.rb
|
|
226
|
+
- lib/neeto_deploy/cli/activity/commands.rb
|
|
227
|
+
- lib/neeto_deploy/cli/activity/list.rb
|
|
227
228
|
- lib/neeto_deploy/cli/addon/commands.rb
|
|
228
229
|
- lib/neeto_deploy/cli/addon/constants.rb
|
|
229
230
|
- lib/neeto_deploy/cli/addon/info.rb
|
|
231
|
+
- lib/neeto_deploy/cli/addon/list.rb
|
|
230
232
|
- lib/neeto_deploy/cli/addon/scheduled_exports_settings.rb
|
|
231
233
|
- lib/neeto_deploy/cli/apps/base.rb
|
|
232
234
|
- lib/neeto_deploy/cli/apps/constants.rb
|
|
@@ -234,9 +236,12 @@ files:
|
|
|
234
236
|
- lib/neeto_deploy/cli/autoscaling_config/constants.rb
|
|
235
237
|
- lib/neeto_deploy/cli/autoscaling_config/list.rb
|
|
236
238
|
- lib/neeto_deploy/cli/base.rb
|
|
239
|
+
- lib/neeto_deploy/cli/buildpacks/commands.rb
|
|
240
|
+
- lib/neeto_deploy/cli/buildpacks/list.rb
|
|
237
241
|
- lib/neeto_deploy/cli/certificates/commands.rb
|
|
238
242
|
- lib/neeto_deploy/cli/certificates/constants.rb
|
|
239
243
|
- lib/neeto_deploy/cli/certificates/list.rb
|
|
244
|
+
- lib/neeto_deploy/cli/deploy/base.rb
|
|
240
245
|
- lib/neeto_deploy/cli/dyno_console_manager.rb
|
|
241
246
|
- lib/neeto_deploy/cli/env/commands.rb
|
|
242
247
|
- lib/neeto_deploy/cli/env/constants.rb
|
|
@@ -249,15 +254,23 @@ files:
|
|
|
249
254
|
- lib/neeto_deploy/cli/login/constants.rb
|
|
250
255
|
- lib/neeto_deploy/cli/logs/base.rb
|
|
251
256
|
- lib/neeto_deploy/cli/logs/constants.rb
|
|
257
|
+
- lib/neeto_deploy/cli/maintenance/base.rb
|
|
258
|
+
- lib/neeto_deploy/cli/maintenance/commands.rb
|
|
252
259
|
- lib/neeto_deploy/cli/pg/commands.rb
|
|
253
260
|
- lib/neeto_deploy/cli/pg/console.rb
|
|
254
261
|
- lib/neeto_deploy/cli/pg/constants.rb
|
|
262
|
+
- lib/neeto_deploy/cli/processes/commands.rb
|
|
263
|
+
- lib/neeto_deploy/cli/processes/constants.rb
|
|
264
|
+
- lib/neeto_deploy/cli/processes/list.rb
|
|
265
|
+
- lib/neeto_deploy/cli/processes/scale.rb
|
|
266
|
+
- lib/neeto_deploy/cli/processes/set_resources.rb
|
|
255
267
|
- lib/neeto_deploy/cli/redis/commands.rb
|
|
256
268
|
- lib/neeto_deploy/cli/redis/console.rb
|
|
257
269
|
- lib/neeto_deploy/cli/redis/constants.rb
|
|
258
270
|
- lib/neeto_deploy/cli/redis/get.rb
|
|
259
271
|
- lib/neeto_deploy/cli/redis/reset_stats.rb
|
|
260
272
|
- lib/neeto_deploy/cli/redis/set.rb
|
|
273
|
+
- lib/neeto_deploy/cli/restart/base.rb
|
|
261
274
|
- lib/neeto_deploy/cli/session.rb
|
|
262
275
|
- lib/neeto_deploy/cli/ui.rb
|
|
263
276
|
- lib/neeto_deploy/exception_handler.rb
|
|
@@ -270,7 +283,6 @@ metadata:
|
|
|
270
283
|
homepage_uri: https://github.com/neetohq/neeto-deploy-cli
|
|
271
284
|
source_code_uri: https://github.com/neetohq/neeto-deploy-cli
|
|
272
285
|
changelog_uri: https://github.com/neetohq/neeto-deploy-cli/blob/main/CHANGELOG.md
|
|
273
|
-
post_install_message:
|
|
274
286
|
rdoc_options: []
|
|
275
287
|
require_paths:
|
|
276
288
|
- lib
|
|
@@ -285,8 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
285
297
|
- !ruby/object:Gem::Version
|
|
286
298
|
version: '0'
|
|
287
299
|
requirements: []
|
|
288
|
-
rubygems_version:
|
|
289
|
-
signing_key:
|
|
300
|
+
rubygems_version: 4.0.3
|
|
290
301
|
specification_version: 4
|
|
291
302
|
summary: CLI for neetoDeploy
|
|
292
303
|
test_files: []
|