bamboolab_kaboom 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kaboom/helpers/config.rb +6 -3
- data/lib/kaboom/helpers/database_helper.rb +2 -2
- data/lib/kaboom.rb +24 -3
- metadata +70 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2d3d12227b3ca6043eff485522e59c28c87b8524aa3dc3ba899133ba781f158
|
4
|
+
data.tar.gz: cd4ed8f699457ce8bbb5c60e0f8829b19c2904a21b4fb0b9da7e25150a03790a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5bd9dae6cb9627f6810aac2671a7c13f093cbeccbf56b8dc3fdc7482322e3442f992a60cf4b6658fc192ee4f017d139504caa56c3c11bc96d4f90b70180ffc5
|
7
|
+
data.tar.gz: ef4bc7349dabdbcea264541be897b0bc07b836cdd784281665bbbac3e968b7914b042dc5fcc01647631b6c6bf37e6628919ecd4fd969c0c8e399f10d2f88e005
|
@@ -31,7 +31,7 @@ module Kaboom
|
|
31
31
|
end
|
32
32
|
|
33
33
|
if Bundler::Dsl.evaluate('Gemfile', nil, {})&.ruby_version&.versions&.first != RUBY_VERSION
|
34
|
-
|
34
|
+
say "Warning: Ruby version specified in the project's Gemfile is not the same as the currently running Ruby version.", :yellow
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -44,8 +44,11 @@ module Kaboom
|
|
44
44
|
say_and_exit "Environment file #{env_file} not found, run 'kamal envify -d destination'", :red
|
45
45
|
end
|
46
46
|
|
47
|
-
destination_clear_envs = YAML.load_file("config/deploy.#{destination}.yml")
|
48
|
-
|
47
|
+
destination_clear_envs = YAML.load_file("config/deploy.#{destination}.yml")&.dig('env', 'clear') || {}
|
48
|
+
clear_envs = YAML.load_file("config/deploy.yml")&.dig('env', 'clear') || {}
|
49
|
+
merged_clear_envs = clear_envs.merge(destination_clear_envs)
|
50
|
+
|
51
|
+
ENV.update(merged_clear_envs.transform_values(&:to_s))
|
49
52
|
end
|
50
53
|
|
51
54
|
def load_credentials(destination)
|
@@ -23,10 +23,10 @@ module Kaboom
|
|
23
23
|
%Q{psql #{local_connection_string} -c "DROP DATABASE IF EXISTS #{config[:name]}" >/dev/null 2>&1},
|
24
24
|
%Q{psql #{local_connection_string} -c "CREATE DATABASE #{config[:name]};" >/dev/null 2>&1},
|
25
25
|
%Q{psql #{local_connection_string.gsub('template1', config[:name])} < #{backup_file} >/dev/null 2>&1},
|
26
|
-
%Q{
|
26
|
+
%Q{psql #{local_connection_string.gsub('template1', config[:name])} -c "UPDATE ar_internal_metadata SET value = 'development' WHERE key = 'environment';" >/dev/null 2>&1},
|
27
27
|
%Q{psql #{local_connection_string} -c "ALTER DATABASE #{config[:name]} OWNER TO #{config[:username]};" >/dev/null 2>&1},
|
28
28
|
]
|
29
|
-
|
29
|
+
|
30
30
|
commands.all? { |cmd| system(cmd) }
|
31
31
|
end
|
32
32
|
end
|
data/lib/kaboom.rb
CHANGED
@@ -42,12 +42,25 @@ module Kaboom
|
|
42
42
|
|
43
43
|
desc 'ssh DESTINATION', 'Run a bash SSH for deployed apps, defaults to staging'
|
44
44
|
method_option :role, aliases: '-r', type: :string, desc: 'Role to run the SSH at (web, sidekiq, cron...)', default: 'web'
|
45
|
-
|
45
|
+
method_option :server, aliases: '-s', type: :boolean, desc: 'Connect to underlying server running the app'
|
46
|
+
def ssh(destination = nil)
|
47
|
+
if options[:server] && options[:role] != 'web'
|
48
|
+
say "Warning: server option is supplied, role option will be ignored", :yellow
|
49
|
+
end
|
50
|
+
|
51
|
+
destination ||= 'staging' # Use default if destination is nil
|
46
52
|
validate_repository!
|
47
53
|
validate_destination(destination)
|
48
|
-
|
54
|
+
|
49
55
|
confirm_production_action('SSH') if destination == 'production'
|
50
|
-
|
56
|
+
|
57
|
+
if options[:server]
|
58
|
+
server_user, server_host = get_server_user_and_host(destination)
|
59
|
+
say "Running SSH on #{server_host} as #{server_user} (#{destination})...", :green
|
60
|
+
exec("ssh #{server_user}@#{server_host}")
|
61
|
+
else
|
62
|
+
run_command("bash", destination)
|
63
|
+
end
|
51
64
|
end
|
52
65
|
|
53
66
|
private
|
@@ -57,5 +70,13 @@ module Kaboom
|
|
57
70
|
exec("kamal app exec -i --reuse -q '#{command}' -d #{destination} --roles=#{options[:role]}")
|
58
71
|
end
|
59
72
|
|
73
|
+
def get_server_user_and_host(destination)
|
74
|
+
config = YAML.load_file("config/deploy.#{destination}.yml")
|
75
|
+
server = config.dig('servers', 'web', 'hosts')[0]
|
76
|
+
user = config.dig('ssh', 'user') || 'root'
|
77
|
+
|
78
|
+
say_and_exit "Error: Invalid destination file (config/deploy.#{destination}.yml)" , :red unless server
|
79
|
+
return user, server
|
80
|
+
end
|
60
81
|
end
|
61
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bamboolab_kaboom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Luka Bak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -28,132 +28,158 @@ dependencies:
|
|
28
28
|
name: dotenv
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: kamal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.4.0
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.0'
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
55
|
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
57
|
+
version: 1.4.0
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: tty-prompt
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
67
|
+
version: '0.2'
|
62
68
|
type: :runtime
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
74
|
+
version: '0.2'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
76
|
+
name: yaml
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- - "
|
79
|
+
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
81
|
+
version: '0.3'
|
76
82
|
type: :runtime
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- - "
|
86
|
+
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
88
|
+
version: '0.3'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: erb
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- - "
|
93
|
+
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
95
|
+
version: '4'
|
90
96
|
type: :runtime
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- - "
|
100
|
+
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
102
|
+
version: '4'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
104
|
+
name: google-cloud-storage
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
|
-
- - "
|
107
|
+
- - "~>"
|
102
108
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
109
|
+
version: '1.5'
|
104
110
|
type: :runtime
|
105
111
|
prerelease: false
|
106
112
|
version_requirements: !ruby/object:Gem::Requirement
|
107
113
|
requirements:
|
108
|
-
- - "
|
114
|
+
- - "~>"
|
109
115
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
116
|
+
version: '1.5'
|
111
117
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
118
|
+
name: tty-progressbar
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
114
120
|
requirements:
|
115
|
-
- - "
|
121
|
+
- - "~>"
|
116
122
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
123
|
+
version: '0.18'
|
118
124
|
type: :runtime
|
119
125
|
prerelease: false
|
120
126
|
version_requirements: !ruby/object:Gem::Requirement
|
121
127
|
requirements:
|
122
|
-
- - "
|
128
|
+
- - "~>"
|
123
129
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
130
|
+
version: '0.18'
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
132
|
+
name: activesupport
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
128
134
|
requirements:
|
129
135
|
- - ">="
|
130
136
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
137
|
+
version: '6.0'
|
138
|
+
- - "<"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '8.0'
|
132
141
|
type: :runtime
|
133
142
|
prerelease: false
|
134
143
|
version_requirements: !ruby/object:Gem::Requirement
|
135
144
|
requirements:
|
136
145
|
- - ">="
|
137
146
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
147
|
+
version: '6.0'
|
148
|
+
- - "<"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '8.0'
|
139
151
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
152
|
+
name: pry
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0.14'
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0.14'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: ruby-lsp
|
141
167
|
requirement: !ruby/object:Gem::Requirement
|
142
168
|
requirements:
|
143
169
|
- - ">="
|
144
170
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
146
|
-
type: :
|
171
|
+
version: 0.17.3
|
172
|
+
type: :development
|
147
173
|
prerelease: false
|
148
174
|
version_requirements: !ruby/object:Gem::Requirement
|
149
175
|
requirements:
|
150
176
|
- - ">="
|
151
177
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
178
|
+
version: 0.17.3
|
153
179
|
description: Kaboom is a CLI tool to handle app maintenence, SSH connections, database
|
154
180
|
and assets backups for apps deployed by Kamal.
|
155
181
|
email:
|
156
|
-
-
|
182
|
+
- bakluka@gmail.com
|
157
183
|
executables:
|
158
184
|
- kaboom
|
159
185
|
extensions: []
|
@@ -166,7 +192,7 @@ files:
|
|
166
192
|
- lib/kaboom/helpers/database_helper.rb
|
167
193
|
- lib/kaboom/helpers/utils.rb
|
168
194
|
- lib/kaboom/version.rb
|
169
|
-
homepage:
|
195
|
+
homepage: https://bamboolab.eu
|
170
196
|
licenses:
|
171
197
|
- MIT
|
172
198
|
metadata: {}
|
@@ -185,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
211
|
- !ruby/object:Gem::Version
|
186
212
|
version: '0'
|
187
213
|
requirements: []
|
188
|
-
rubygems_version: 3.5.
|
214
|
+
rubygems_version: 3.5.3
|
189
215
|
signing_key:
|
190
216
|
specification_version: 4
|
191
217
|
summary: A CLI for managing Rails apps deployed by Kamal.
|