kuby-core 0.18.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -1
- data/bin/kuby +2 -0
- data/lib/kuby/docker/layer_stack.rb +9 -0
- data/lib/kuby/docker/spec.rb +5 -0
- data/lib/kuby/docker/webserver_phase.rb +11 -1
- data/lib/kuby/plugins/rails_app/generators/kuby.rb +9 -1
- data/lib/kuby/plugins/rails_app/plugin.rb +30 -26
- data/lib/kuby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3e98a72e5798436209eb36042b9cb6e59ea7491d772c3b04ea04ea12b81b612
|
4
|
+
data.tar.gz: 1a8b6a6e8704c885d3326e4a8e4e2aaf77fff5f67d9a9c4d8bb3cac546798fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f78515bf3e52d54299f678e3f55a6a11e4b5ad0272aff8051b447bc0904787df10f382fea3ecb470d6c46f67b0fb935817f4bd3816d292a4e5f55f37e8594a
|
7
|
+
data.tar.gz: 200a1df0299181a7334e4deaa737f69b6d3f30cbc5583c71be73b7ae088cb7f71e3bdf4b3418b6f1173ed3161bde00387410ecbe2b85d8f4c10bca6fa8a5ad64
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Unreleased
|
2
|
+
|
3
|
+
## 0.20.0
|
4
|
+
* Modify the Rails generator to add the `activerecord-cockroachdb-adapter` to your bundle.
|
5
|
+
* Add the `LayerStack#replace` and corresponding `Docker::Spec#replace` methods for replacing phases. This can be a lot easier than using `#insert` and `#delete`, which can mess with the relative order of the phases and cause surprising results.
|
6
|
+
* Don't run init containers for creating and migrating the database if database management is turned off.
|
7
|
+
|
8
|
+
## 0.19.0
|
9
|
+
* Add support for configuring the number of web workers for puma (#124, @zhalltyemill)
|
10
|
+
|
1
11
|
## 0.18.0
|
2
12
|
* Add the ability to specify your app's root directory.
|
3
13
|
- Call `app_root <path>` inside the `docker` section of your Kuby config file.
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ group :development, :test do
|
|
7
7
|
gem 'rake'
|
8
8
|
|
9
9
|
gem 'curdle', '~> 1.2'
|
10
|
-
gem 'parlour',
|
10
|
+
gem 'parlour', '~> 8.0'
|
11
11
|
gem 'tapioca', '~> 0.7'
|
12
12
|
gem 'sorbet-runtime', '= 0.5.9897'
|
13
13
|
gem 'sorbet-static', '= 0.5.9897'
|
data/bin/kuby
CHANGED
@@ -94,6 +94,15 @@ module Kuby
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
+
# T::Sig::WithoutRuntime.sig { params(name: Symbol, layer: Layer).void }
|
98
|
+
def replace(name, layer)
|
99
|
+
unless layers.include?(name)
|
100
|
+
raise ArgumentError, "Could not find existing layer '#{name}'"
|
101
|
+
end
|
102
|
+
|
103
|
+
layers[name] = layer
|
104
|
+
end
|
105
|
+
|
97
106
|
# T::Sig::WithoutRuntime.sig { params(name: Symbol).void }
|
98
107
|
def delete(name)
|
99
108
|
stack.delete(name)
|
data/lib/kuby/docker/spec.rb
CHANGED
@@ -145,6 +145,11 @@ module Kuby
|
|
145
145
|
layer_stack.insert(name, layer, options, &block)
|
146
146
|
end
|
147
147
|
|
148
|
+
# T::Sig::WithoutRuntime.sig { params(name: Symbol, layer: Layer).void }
|
149
|
+
def replace(name, layer)
|
150
|
+
layer_stack.replace(name, layer)
|
151
|
+
end
|
152
|
+
|
148
153
|
# T::Sig::WithoutRuntime.sig { params(name: Symbol).void }
|
149
154
|
def delete(name)
|
150
155
|
layer_stack.delete(name)
|
@@ -28,7 +28,7 @@ module Kuby
|
|
28
28
|
def apply_to(dockerfile)
|
29
29
|
dockerfile.cmd(
|
30
30
|
'puma',
|
31
|
-
'--workers',
|
31
|
+
'--workers', phase.workers.to_s,
|
32
32
|
'--bind', 'tcp://0.0.0.0',
|
33
33
|
'--port', phase.port.to_s,
|
34
34
|
'--pidfile', './server.pid',
|
@@ -40,11 +40,15 @@ module Kuby
|
|
40
40
|
end
|
41
41
|
|
42
42
|
DEFAULT_PORT = 8080
|
43
|
+
DEFAULT_WORKERS = 4
|
43
44
|
WEBSERVER_MAP = { puma: Puma }.freeze
|
44
45
|
|
45
46
|
# T::Sig::WithoutRuntime.sig { params(port: Integer).returns(Integer) }
|
46
47
|
attr_writer :port
|
47
48
|
|
49
|
+
# T::Sig::WithoutRuntime.sig { params(workers: Integer).returns(Integer) }
|
50
|
+
attr_writer :workers
|
51
|
+
|
48
52
|
# T::Sig::WithoutRuntime.sig { returns(T.nilable(Symbol)) }
|
49
53
|
attr_reader :webserver
|
50
54
|
|
@@ -56,6 +60,7 @@ module Kuby
|
|
56
60
|
super
|
57
61
|
|
58
62
|
# @port = T.let(@port, T.nilable(Integer))
|
63
|
+
# @workers = T.let(@workers, T.nilable(Integer))
|
59
64
|
# @webserver = T.let(@webserver, T.nilable(Symbol))
|
60
65
|
end
|
61
66
|
|
@@ -73,6 +78,11 @@ module Kuby
|
|
73
78
|
@port || DEFAULT_PORT
|
74
79
|
end
|
75
80
|
|
81
|
+
# T::Sig::WithoutRuntime.sig { returns(Integer) }
|
82
|
+
def workers
|
83
|
+
@workers || DEFAULT_WORKERS
|
84
|
+
end
|
85
|
+
|
76
86
|
private
|
77
87
|
|
78
88
|
# T::Sig::WithoutRuntime.sig { returns(T.nilable(Symbol)) }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: ignore
|
2
2
|
|
3
3
|
require 'rails/generators'
|
4
4
|
require 'rails/generators/base'
|
@@ -109,6 +109,14 @@ class KubyGenerator < Rails::Generators::Base
|
|
109
109
|
)
|
110
110
|
end
|
111
111
|
|
112
|
+
def add_cockroach_adapter
|
113
|
+
if Rails::VERSION::STRING > '5.2'
|
114
|
+
gem 'activerecord-cockroachdb-adapter', version: '~> 6.0'
|
115
|
+
else
|
116
|
+
gem 'activerecord-cockroachdb-adapter', version: '~> 5.2'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
112
120
|
private
|
113
121
|
|
114
122
|
def app_name
|
@@ -106,12 +106,14 @@ module Kuby
|
|
106
106
|
image image_with_tag
|
107
107
|
end
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
if spec.manage_database?
|
110
|
+
init_container(:create_db) do
|
111
|
+
image image_with_tag
|
112
|
+
end
|
112
113
|
|
113
|
-
|
114
|
-
|
114
|
+
init_container(:migrate_db) do
|
115
|
+
image image_with_tag
|
116
|
+
end
|
115
117
|
end
|
116
118
|
end
|
117
119
|
end
|
@@ -308,36 +310,38 @@ module Kuby
|
|
308
310
|
end
|
309
311
|
end
|
310
312
|
|
311
|
-
|
312
|
-
|
313
|
-
|
313
|
+
if kube_spec.manage_database?
|
314
|
+
init_container(:create_db) do
|
315
|
+
name "#{kube_spec.selector_app}-create-db"
|
316
|
+
command %w(bundle exec rake kuby:rails_app:db:bootstrap)
|
314
317
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
+
env_from do
|
319
|
+
config_map_ref do
|
320
|
+
name kube_spec.config_map.metadata.name
|
321
|
+
end
|
318
322
|
end
|
319
|
-
end
|
320
323
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
+
env_from do
|
325
|
+
secret_ref do
|
326
|
+
name kube_spec.app_secrets.metadata.name
|
327
|
+
end
|
324
328
|
end
|
325
329
|
end
|
326
|
-
end
|
327
330
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
+
init_container(:migrate_db) do
|
332
|
+
name "#{kube_spec.selector_app}-migrate-db"
|
333
|
+
command %w(bundle exec rake kuby:rails_app:db:migrate)
|
331
334
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
+
env_from do
|
336
|
+
config_map_ref do
|
337
|
+
name kube_spec.config_map.metadata.name
|
338
|
+
end
|
335
339
|
end
|
336
|
-
end
|
337
340
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
+
env_from do
|
342
|
+
secret_ref do
|
343
|
+
name kube_spec.app_secrets.metadata.name
|
344
|
+
end
|
341
345
|
end
|
342
346
|
end
|
343
347
|
end
|
data/lib/kuby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|