kamal 1.8.3 → 2.7.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.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/kamal/cli/accessory.rb +92 -38
  4. data/lib/kamal/cli/alias/command.rb +10 -0
  5. data/lib/kamal/cli/app/{prepare_assets.rb → assets.rb} +1 -1
  6. data/lib/kamal/cli/app/boot.rb +23 -16
  7. data/lib/kamal/cli/app/error_pages.rb +33 -0
  8. data/lib/kamal/cli/app/ssl_certificates.rb +28 -0
  9. data/lib/kamal/cli/app.rb +132 -30
  10. data/lib/kamal/cli/base.rb +57 -53
  11. data/lib/kamal/cli/build.rb +81 -38
  12. data/lib/kamal/cli/healthcheck/barrier.rb +2 -0
  13. data/lib/kamal/cli/healthcheck/poller.rb +18 -39
  14. data/lib/kamal/cli/lock.rb +2 -3
  15. data/lib/kamal/cli/main.rb +60 -59
  16. data/lib/kamal/cli/proxy.rb +290 -0
  17. data/lib/kamal/cli/prune.rb +0 -1
  18. data/lib/kamal/cli/registry.rb +2 -0
  19. data/lib/kamal/cli/secrets.rb +49 -0
  20. data/lib/kamal/cli/server.rb +6 -5
  21. data/lib/kamal/cli/templates/deploy.yml +53 -53
  22. data/lib/kamal/cli/templates/sample_hooks/docker-setup.sample +2 -12
  23. data/lib/kamal/cli/templates/sample_hooks/post-app-boot.sample +3 -0
  24. data/lib/kamal/cli/templates/sample_hooks/post-deploy.sample +1 -1
  25. data/lib/kamal/cli/templates/sample_hooks/post-proxy-reboot.sample +3 -0
  26. data/lib/kamal/cli/templates/sample_hooks/pre-app-boot.sample +3 -0
  27. data/lib/kamal/cli/templates/sample_hooks/pre-build.sample +1 -1
  28. data/lib/kamal/cli/templates/sample_hooks/pre-connect.sample +1 -1
  29. data/lib/kamal/cli/templates/sample_hooks/pre-deploy.sample +19 -6
  30. data/lib/kamal/cli/templates/sample_hooks/pre-proxy-reboot.sample +3 -0
  31. data/lib/kamal/cli/templates/secrets +17 -0
  32. data/lib/kamal/cli.rb +2 -0
  33. data/lib/kamal/commander/specifics.rb +19 -6
  34. data/lib/kamal/commander.rb +39 -32
  35. data/lib/kamal/commands/accessory/proxy.rb +16 -0
  36. data/lib/kamal/commands/accessory.rb +19 -19
  37. data/lib/kamal/commands/app/assets.rb +10 -10
  38. data/lib/kamal/commands/app/containers.rb +2 -2
  39. data/lib/kamal/commands/app/error_pages.rb +9 -0
  40. data/lib/kamal/commands/app/execution.rb +7 -4
  41. data/lib/kamal/commands/app/images.rb +1 -1
  42. data/lib/kamal/commands/app/logging.rb +16 -6
  43. data/lib/kamal/commands/app/proxy.rb +32 -0
  44. data/lib/kamal/commands/app.rb +25 -24
  45. data/lib/kamal/commands/auditor.rb +12 -3
  46. data/lib/kamal/commands/base.rb +54 -8
  47. data/lib/kamal/commands/builder/base.rb +46 -16
  48. data/lib/kamal/commands/builder/clone.rb +16 -14
  49. data/lib/kamal/commands/builder/cloud.rb +22 -0
  50. data/lib/kamal/commands/builder/hybrid.rb +21 -0
  51. data/lib/kamal/commands/builder/local.rb +14 -0
  52. data/lib/kamal/commands/builder/pack.rb +46 -0
  53. data/lib/kamal/commands/builder/remote.rb +63 -0
  54. data/lib/kamal/commands/builder.rb +21 -45
  55. data/lib/kamal/commands/docker.rb +4 -0
  56. data/lib/kamal/commands/hook.rb +8 -2
  57. data/lib/kamal/commands/lock.rb +2 -6
  58. data/lib/kamal/commands/proxy.rb +127 -0
  59. data/lib/kamal/commands/prune.rb +1 -9
  60. data/lib/kamal/commands/registry.rb +9 -7
  61. data/lib/kamal/commands/server.rb +11 -1
  62. data/lib/kamal/configuration/accessory.rb +89 -12
  63. data/lib/kamal/configuration/alias.rb +15 -0
  64. data/lib/kamal/configuration/builder.rb +73 -15
  65. data/lib/kamal/configuration/docs/accessory.yml +53 -15
  66. data/lib/kamal/configuration/docs/alias.yml +26 -0
  67. data/lib/kamal/configuration/docs/boot.yml +3 -3
  68. data/lib/kamal/configuration/docs/builder.yml +63 -38
  69. data/lib/kamal/configuration/docs/configuration.yml +62 -46
  70. data/lib/kamal/configuration/docs/env.yml +61 -17
  71. data/lib/kamal/configuration/docs/logging.yml +3 -3
  72. data/lib/kamal/configuration/docs/proxy.yml +168 -0
  73. data/lib/kamal/configuration/docs/registry.yml +20 -13
  74. data/lib/kamal/configuration/docs/role.yml +14 -13
  75. data/lib/kamal/configuration/docs/servers.yml +2 -2
  76. data/lib/kamal/configuration/docs/ssh.yml +23 -19
  77. data/lib/kamal/configuration/docs/sshkit.yml +4 -4
  78. data/lib/kamal/configuration/env/tag.rb +4 -3
  79. data/lib/kamal/configuration/env.rb +19 -17
  80. data/lib/kamal/configuration/proxy/boot.rb +129 -0
  81. data/lib/kamal/configuration/proxy.rb +124 -0
  82. data/lib/kamal/configuration/registry.rb +7 -6
  83. data/lib/kamal/configuration/role.rb +69 -98
  84. data/lib/kamal/configuration/servers.rb +8 -1
  85. data/lib/kamal/configuration/validator/accessory.rb +6 -2
  86. data/lib/kamal/configuration/validator/alias.rb +15 -0
  87. data/lib/kamal/configuration/validator/builder.rb +6 -0
  88. data/lib/kamal/configuration/validator/proxy.rb +25 -0
  89. data/lib/kamal/configuration/validator/role.rb +3 -1
  90. data/lib/kamal/configuration/validator/servers.rb +1 -1
  91. data/lib/kamal/configuration/validator.rb +62 -24
  92. data/lib/kamal/configuration.rb +96 -50
  93. data/lib/kamal/docker.rb +30 -0
  94. data/lib/kamal/env_file.rb +7 -1
  95. data/lib/kamal/git.rb +10 -0
  96. data/lib/kamal/secrets/adapters/aws_secrets_manager.rb +51 -0
  97. data/lib/kamal/secrets/adapters/base.rb +33 -0
  98. data/lib/kamal/secrets/adapters/bitwarden.rb +81 -0
  99. data/lib/kamal/secrets/adapters/bitwarden_secrets_manager.rb +66 -0
  100. data/lib/kamal/secrets/adapters/doppler.rb +57 -0
  101. data/lib/kamal/secrets/adapters/enpass.rb +71 -0
  102. data/lib/kamal/secrets/adapters/gcp_secret_manager.rb +112 -0
  103. data/lib/kamal/secrets/adapters/last_pass.rb +40 -0
  104. data/lib/kamal/secrets/adapters/one_password.rb +104 -0
  105. data/lib/kamal/secrets/adapters/passbolt.rb +130 -0
  106. data/lib/kamal/secrets/adapters/test.rb +14 -0
  107. data/lib/kamal/secrets/adapters.rb +16 -0
  108. data/lib/kamal/secrets/dotenv/inline_command_substitution.rb +33 -0
  109. data/lib/kamal/secrets.rb +42 -0
  110. data/lib/kamal/sshkit_with_ext.rb +1 -0
  111. data/lib/kamal/utils.rb +30 -0
  112. data/lib/kamal/version.rb +1 -1
  113. data/lib/kamal.rb +3 -1
  114. metadata +63 -36
  115. data/lib/kamal/cli/env.rb +0 -54
  116. data/lib/kamal/cli/templates/sample_hooks/post-traefik-reboot.sample +0 -3
  117. data/lib/kamal/cli/templates/sample_hooks/pre-traefik-reboot.sample +0 -3
  118. data/lib/kamal/cli/templates/template.env +0 -2
  119. data/lib/kamal/cli/traefik.rb +0 -122
  120. data/lib/kamal/commands/app/cord.rb +0 -22
  121. data/lib/kamal/commands/builder/multiarch/remote.rb +0 -65
  122. data/lib/kamal/commands/builder/multiarch.rb +0 -41
  123. data/lib/kamal/commands/builder/native/cached.rb +0 -25
  124. data/lib/kamal/commands/builder/native/remote.rb +0 -67
  125. data/lib/kamal/commands/builder/native.rb +0 -20
  126. data/lib/kamal/commands/traefik.rb +0 -85
  127. data/lib/kamal/configuration/docs/healthcheck.yml +0 -59
  128. data/lib/kamal/configuration/docs/traefik.yml +0 -62
  129. data/lib/kamal/configuration/healthcheck.rb +0 -63
  130. data/lib/kamal/configuration/traefik.rb +0 -60
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -50,70 +49,76 @@ dependencies:
50
49
  requirements:
51
50
  - - "~>"
52
51
  - !ruby/object:Gem::Version
53
- version: '7.0'
52
+ version: '7.3'
54
53
  type: :runtime
55
54
  prerelease: false
56
55
  version_requirements: !ruby/object:Gem::Requirement
57
56
  requirements:
58
57
  - - "~>"
59
58
  - !ruby/object:Gem::Version
60
- version: '7.0'
59
+ version: '7.3'
61
60
  - !ruby/object:Gem::Dependency
62
61
  name: thor
63
62
  requirement: !ruby/object:Gem::Requirement
64
63
  requirements:
65
64
  - - "~>"
66
65
  - !ruby/object:Gem::Version
67
- version: '1.2'
66
+ version: '1.3'
68
67
  type: :runtime
69
68
  prerelease: false
70
69
  version_requirements: !ruby/object:Gem::Requirement
71
70
  requirements:
72
71
  - - "~>"
73
72
  - !ruby/object:Gem::Version
74
- version: '1.2'
73
+ version: '1.3'
75
74
  - !ruby/object:Gem::Dependency
76
75
  name: dotenv
77
76
  requirement: !ruby/object:Gem::Requirement
78
77
  requirements:
79
78
  - - "~>"
80
79
  - !ruby/object:Gem::Version
81
- version: '2.8'
80
+ version: '3.1'
82
81
  type: :runtime
83
82
  prerelease: false
84
83
  version_requirements: !ruby/object:Gem::Requirement
85
84
  requirements:
86
85
  - - "~>"
87
86
  - !ruby/object:Gem::Version
88
- version: '2.8'
87
+ version: '3.1'
89
88
  - !ruby/object:Gem::Dependency
90
89
  name: zeitwerk
91
90
  requirement: !ruby/object:Gem::Requirement
92
91
  requirements:
93
- - - "~>"
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 2.6.18
95
+ - - "<"
94
96
  - !ruby/object:Gem::Version
95
- version: '2.5'
97
+ version: '3.0'
96
98
  type: :runtime
97
99
  prerelease: false
98
100
  version_requirements: !ruby/object:Gem::Requirement
99
101
  requirements:
100
- - - "~>"
102
+ - - ">="
101
103
  - !ruby/object:Gem::Version
102
- version: '2.5'
104
+ version: 2.6.18
105
+ - - "<"
106
+ - !ruby/object:Gem::Version
107
+ version: '3.0'
103
108
  - !ruby/object:Gem::Dependency
104
109
  name: ed25519
105
110
  requirement: !ruby/object:Gem::Requirement
106
111
  requirements:
107
112
  - - "~>"
108
113
  - !ruby/object:Gem::Version
109
- version: '1.2'
114
+ version: '1.4'
110
115
  type: :runtime
111
116
  prerelease: false
112
117
  version_requirements: !ruby/object:Gem::Requirement
113
118
  requirements:
114
119
  - - "~>"
115
120
  - !ruby/object:Gem::Version
116
- version: '1.2'
121
+ version: '1.4'
117
122
  - !ruby/object:Gem::Dependency
118
123
  name: bcrypt_pbkdf
119
124
  requirement: !ruby/object:Gem::Requirement
@@ -198,7 +203,6 @@ dependencies:
198
203
  - - ">="
199
204
  - !ruby/object:Gem::Version
200
205
  version: '0'
201
- description:
202
206
  email: dhh@hey.com
203
207
  executables:
204
208
  - kamal
@@ -211,98 +215,123 @@ files:
211
215
  - lib/kamal.rb
212
216
  - lib/kamal/cli.rb
213
217
  - lib/kamal/cli/accessory.rb
218
+ - lib/kamal/cli/alias/command.rb
214
219
  - lib/kamal/cli/app.rb
220
+ - lib/kamal/cli/app/assets.rb
215
221
  - lib/kamal/cli/app/boot.rb
216
- - lib/kamal/cli/app/prepare_assets.rb
222
+ - lib/kamal/cli/app/error_pages.rb
223
+ - lib/kamal/cli/app/ssl_certificates.rb
217
224
  - lib/kamal/cli/base.rb
218
225
  - lib/kamal/cli/build.rb
219
226
  - lib/kamal/cli/build/clone.rb
220
- - lib/kamal/cli/env.rb
221
227
  - lib/kamal/cli/healthcheck/barrier.rb
222
228
  - lib/kamal/cli/healthcheck/error.rb
223
229
  - lib/kamal/cli/healthcheck/poller.rb
224
230
  - lib/kamal/cli/lock.rb
225
231
  - lib/kamal/cli/main.rb
232
+ - lib/kamal/cli/proxy.rb
226
233
  - lib/kamal/cli/prune.rb
227
234
  - lib/kamal/cli/registry.rb
235
+ - lib/kamal/cli/secrets.rb
228
236
  - lib/kamal/cli/server.rb
229
237
  - lib/kamal/cli/templates/deploy.yml
230
238
  - lib/kamal/cli/templates/sample_hooks/docker-setup.sample
239
+ - lib/kamal/cli/templates/sample_hooks/post-app-boot.sample
231
240
  - lib/kamal/cli/templates/sample_hooks/post-deploy.sample
232
- - lib/kamal/cli/templates/sample_hooks/post-traefik-reboot.sample
241
+ - lib/kamal/cli/templates/sample_hooks/post-proxy-reboot.sample
242
+ - lib/kamal/cli/templates/sample_hooks/pre-app-boot.sample
233
243
  - lib/kamal/cli/templates/sample_hooks/pre-build.sample
234
244
  - lib/kamal/cli/templates/sample_hooks/pre-connect.sample
235
245
  - lib/kamal/cli/templates/sample_hooks/pre-deploy.sample
236
- - lib/kamal/cli/templates/sample_hooks/pre-traefik-reboot.sample
237
- - lib/kamal/cli/templates/template.env
238
- - lib/kamal/cli/traefik.rb
246
+ - lib/kamal/cli/templates/sample_hooks/pre-proxy-reboot.sample
247
+ - lib/kamal/cli/templates/secrets
239
248
  - lib/kamal/commander.rb
240
249
  - lib/kamal/commander/specifics.rb
241
250
  - lib/kamal/commands.rb
242
251
  - lib/kamal/commands/accessory.rb
252
+ - lib/kamal/commands/accessory/proxy.rb
243
253
  - lib/kamal/commands/app.rb
244
254
  - lib/kamal/commands/app/assets.rb
245
255
  - lib/kamal/commands/app/containers.rb
246
- - lib/kamal/commands/app/cord.rb
256
+ - lib/kamal/commands/app/error_pages.rb
247
257
  - lib/kamal/commands/app/execution.rb
248
258
  - lib/kamal/commands/app/images.rb
249
259
  - lib/kamal/commands/app/logging.rb
260
+ - lib/kamal/commands/app/proxy.rb
250
261
  - lib/kamal/commands/auditor.rb
251
262
  - lib/kamal/commands/base.rb
252
263
  - lib/kamal/commands/builder.rb
253
264
  - lib/kamal/commands/builder/base.rb
254
265
  - lib/kamal/commands/builder/clone.rb
255
- - lib/kamal/commands/builder/multiarch.rb
256
- - lib/kamal/commands/builder/multiarch/remote.rb
257
- - lib/kamal/commands/builder/native.rb
258
- - lib/kamal/commands/builder/native/cached.rb
259
- - lib/kamal/commands/builder/native/remote.rb
266
+ - lib/kamal/commands/builder/cloud.rb
267
+ - lib/kamal/commands/builder/hybrid.rb
268
+ - lib/kamal/commands/builder/local.rb
269
+ - lib/kamal/commands/builder/pack.rb
270
+ - lib/kamal/commands/builder/remote.rb
260
271
  - lib/kamal/commands/docker.rb
261
272
  - lib/kamal/commands/hook.rb
262
273
  - lib/kamal/commands/lock.rb
274
+ - lib/kamal/commands/proxy.rb
263
275
  - lib/kamal/commands/prune.rb
264
276
  - lib/kamal/commands/registry.rb
265
277
  - lib/kamal/commands/server.rb
266
- - lib/kamal/commands/traefik.rb
267
278
  - lib/kamal/configuration.rb
268
279
  - lib/kamal/configuration/accessory.rb
280
+ - lib/kamal/configuration/alias.rb
269
281
  - lib/kamal/configuration/boot.rb
270
282
  - lib/kamal/configuration/builder.rb
271
283
  - lib/kamal/configuration/docs/accessory.yml
284
+ - lib/kamal/configuration/docs/alias.yml
272
285
  - lib/kamal/configuration/docs/boot.yml
273
286
  - lib/kamal/configuration/docs/builder.yml
274
287
  - lib/kamal/configuration/docs/configuration.yml
275
288
  - lib/kamal/configuration/docs/env.yml
276
- - lib/kamal/configuration/docs/healthcheck.yml
277
289
  - lib/kamal/configuration/docs/logging.yml
290
+ - lib/kamal/configuration/docs/proxy.yml
278
291
  - lib/kamal/configuration/docs/registry.yml
279
292
  - lib/kamal/configuration/docs/role.yml
280
293
  - lib/kamal/configuration/docs/servers.yml
281
294
  - lib/kamal/configuration/docs/ssh.yml
282
295
  - lib/kamal/configuration/docs/sshkit.yml
283
- - lib/kamal/configuration/docs/traefik.yml
284
296
  - lib/kamal/configuration/env.rb
285
297
  - lib/kamal/configuration/env/tag.rb
286
- - lib/kamal/configuration/healthcheck.rb
287
298
  - lib/kamal/configuration/logging.rb
299
+ - lib/kamal/configuration/proxy.rb
300
+ - lib/kamal/configuration/proxy/boot.rb
288
301
  - lib/kamal/configuration/registry.rb
289
302
  - lib/kamal/configuration/role.rb
290
303
  - lib/kamal/configuration/servers.rb
291
304
  - lib/kamal/configuration/ssh.rb
292
305
  - lib/kamal/configuration/sshkit.rb
293
- - lib/kamal/configuration/traefik.rb
294
306
  - lib/kamal/configuration/validation.rb
295
307
  - lib/kamal/configuration/validator.rb
296
308
  - lib/kamal/configuration/validator/accessory.rb
309
+ - lib/kamal/configuration/validator/alias.rb
297
310
  - lib/kamal/configuration/validator/builder.rb
298
311
  - lib/kamal/configuration/validator/configuration.rb
299
312
  - lib/kamal/configuration/validator/env.rb
313
+ - lib/kamal/configuration/validator/proxy.rb
300
314
  - lib/kamal/configuration/validator/registry.rb
301
315
  - lib/kamal/configuration/validator/role.rb
302
316
  - lib/kamal/configuration/validator/servers.rb
303
317
  - lib/kamal/configuration/volume.rb
318
+ - lib/kamal/docker.rb
304
319
  - lib/kamal/env_file.rb
305
320
  - lib/kamal/git.rb
321
+ - lib/kamal/secrets.rb
322
+ - lib/kamal/secrets/adapters.rb
323
+ - lib/kamal/secrets/adapters/aws_secrets_manager.rb
324
+ - lib/kamal/secrets/adapters/base.rb
325
+ - lib/kamal/secrets/adapters/bitwarden.rb
326
+ - lib/kamal/secrets/adapters/bitwarden_secrets_manager.rb
327
+ - lib/kamal/secrets/adapters/doppler.rb
328
+ - lib/kamal/secrets/adapters/enpass.rb
329
+ - lib/kamal/secrets/adapters/gcp_secret_manager.rb
330
+ - lib/kamal/secrets/adapters/last_pass.rb
331
+ - lib/kamal/secrets/adapters/one_password.rb
332
+ - lib/kamal/secrets/adapters/passbolt.rb
333
+ - lib/kamal/secrets/adapters/test.rb
334
+ - lib/kamal/secrets/dotenv/inline_command_substitution.rb
306
335
  - lib/kamal/sshkit_with_ext.rb
307
336
  - lib/kamal/tags.rb
308
337
  - lib/kamal/utils.rb
@@ -312,7 +341,6 @@ homepage: https://github.com/basecamp/kamal
312
341
  licenses:
313
342
  - MIT
314
343
  metadata: {}
315
- post_install_message:
316
344
  rdoc_options: []
317
345
  require_paths:
318
346
  - lib
@@ -327,8 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
355
  - !ruby/object:Gem::Version
328
356
  version: '0'
329
357
  requirements: []
330
- rubygems_version: 3.5.11
331
- signing_key:
358
+ rubygems_version: 3.6.7
332
359
  specification_version: 4
333
360
  summary: Deploy web apps in containers to servers running Docker with zero downtime.
334
361
  test_files: []
data/lib/kamal/cli/env.rb DELETED
@@ -1,54 +0,0 @@
1
- require "tempfile"
2
-
3
- class Kamal::Cli::Env < Kamal::Cli::Base
4
- desc "push", "Push the env file to the remote hosts"
5
- def push
6
- with_lock do
7
- on(KAMAL.hosts) do
8
- execute *KAMAL.auditor.record("Pushed env files"), verbosity: :debug
9
-
10
- KAMAL.roles_on(host).each do |role|
11
- execute *KAMAL.app(role: role, host: host).make_env_directory
12
- upload! role.env(host).secrets_io, role.env(host).secrets_file, mode: 400
13
- end
14
- end
15
-
16
- on(KAMAL.traefik_hosts) do
17
- execute *KAMAL.traefik.make_env_directory
18
- upload! KAMAL.traefik.env.secrets_io, KAMAL.traefik.env.secrets_file, mode: 400
19
- end
20
-
21
- on(KAMAL.accessory_hosts) do
22
- KAMAL.accessories_on(host).each do |accessory|
23
- accessory_config = KAMAL.config.accessory(accessory)
24
- execute *KAMAL.accessory(accessory).make_env_directory
25
- upload! accessory_config.env.secrets_io, accessory_config.env.secrets_file, mode: 400
26
- end
27
- end
28
- end
29
- end
30
-
31
- desc "delete", "Delete the env file from the remote hosts"
32
- def delete
33
- with_lock do
34
- on(KAMAL.hosts) do
35
- execute *KAMAL.auditor.record("Deleted env files"), verbosity: :debug
36
-
37
- KAMAL.roles_on(host).each do |role|
38
- execute *KAMAL.app(role: role, host: host).remove_env_file
39
- end
40
- end
41
-
42
- on(KAMAL.traefik_hosts) do
43
- execute *KAMAL.traefik.remove_env_file
44
- end
45
-
46
- on(KAMAL.accessory_hosts) do
47
- KAMAL.accessories_on(host).each do |accessory|
48
- accessory_config = KAMAL.config.accessory(accessory)
49
- execute *KAMAL.accessory(accessory).remove_env_file
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Rebooted Traefik on $KAMAL_HOSTS"
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Rebooting Traefik on $KAMAL_HOSTS..."
@@ -1,2 +0,0 @@
1
- KAMAL_REGISTRY_PASSWORD=change-this
2
- RAILS_MASTER_KEY=another-env
@@ -1,122 +0,0 @@
1
- class Kamal::Cli::Traefik < Kamal::Cli::Base
2
- desc "boot", "Boot Traefik on servers"
3
- def boot
4
- with_lock do
5
- on(KAMAL.traefik_hosts) do
6
- execute *KAMAL.registry.login
7
- execute *KAMAL.traefik.start_or_run
8
- end
9
- end
10
- end
11
-
12
- desc "reboot", "Reboot Traefik on servers (stop container, remove container, start new container)"
13
- option :rolling, type: :boolean, default: false, desc: "Reboot traefik on hosts in sequence, rather than in parallel"
14
- option :confirmed, aliases: "-y", type: :boolean, default: false, desc: "Proceed without confirmation question"
15
- def reboot
16
- confirming "This will cause a brief outage on each host. Are you sure?" do
17
- with_lock do
18
- host_groups = options[:rolling] ? KAMAL.traefik_hosts : [ KAMAL.traefik_hosts ]
19
- host_groups.each do |hosts|
20
- host_list = Array(hosts).join(",")
21
- run_hook "pre-traefik-reboot", hosts: host_list
22
- on(hosts) do
23
- execute *KAMAL.auditor.record("Rebooted traefik"), verbosity: :debug
24
- execute *KAMAL.registry.login
25
- execute *KAMAL.traefik.stop, raise_on_non_zero_exit: false
26
- execute *KAMAL.traefik.remove_container
27
- execute *KAMAL.traefik.run
28
- end
29
- run_hook "post-traefik-reboot", hosts: host_list
30
- end
31
- end
32
- end
33
- end
34
-
35
- desc "start", "Start existing Traefik container on servers"
36
- def start
37
- with_lock do
38
- on(KAMAL.traefik_hosts) do
39
- execute *KAMAL.auditor.record("Started traefik"), verbosity: :debug
40
- execute *KAMAL.traefik.start
41
- end
42
- end
43
- end
44
-
45
- desc "stop", "Stop existing Traefik container on servers"
46
- def stop
47
- with_lock do
48
- on(KAMAL.traefik_hosts) do
49
- execute *KAMAL.auditor.record("Stopped traefik"), verbosity: :debug
50
- execute *KAMAL.traefik.stop, raise_on_non_zero_exit: false
51
- end
52
- end
53
- end
54
-
55
- desc "restart", "Restart existing Traefik container on servers"
56
- def restart
57
- with_lock do
58
- stop
59
- start
60
- end
61
- end
62
-
63
- desc "details", "Show details about Traefik container from servers"
64
- def details
65
- on(KAMAL.traefik_hosts) { |host| puts_by_host host, capture_with_info(*KAMAL.traefik.info), type: "Traefik" }
66
- end
67
-
68
- desc "logs", "Show log lines from Traefik on servers"
69
- option :since, aliases: "-s", desc: "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)"
70
- option :lines, type: :numeric, aliases: "-n", desc: "Number of log lines to pull from each server"
71
- option :grep, aliases: "-g", desc: "Show lines with grep match only (use this to fetch specific requests by id)"
72
- option :grep_options, aliases: "-o", desc: "Additional options supplied to grep"
73
- option :follow, aliases: "-f", desc: "Follow logs on primary server (or specific host set by --hosts)"
74
- def logs
75
- grep = options[:grep]
76
- grep_options = options[:grep_options]
77
-
78
- if options[:follow]
79
- run_locally do
80
- info "Following logs on #{KAMAL.primary_host}..."
81
- info KAMAL.traefik.follow_logs(host: KAMAL.primary_host, grep: grep, grep_options: grep_options)
82
- exec KAMAL.traefik.follow_logs(host: KAMAL.primary_host, grep: grep, grep_options: grep_options)
83
- end
84
- else
85
- since = options[:since]
86
- lines = options[:lines].presence || ((since || grep) ? nil : 100) # Default to 100 lines if since or grep isn't set
87
-
88
- on(KAMAL.traefik_hosts) do |host|
89
- puts_by_host host, capture(*KAMAL.traefik.logs(since: since, lines: lines, grep: grep, grep_options: grep_options)), type: "Traefik"
90
- end
91
- end
92
- end
93
-
94
- desc "remove", "Remove Traefik container and image from servers"
95
- def remove
96
- with_lock do
97
- stop
98
- remove_container
99
- remove_image
100
- end
101
- end
102
-
103
- desc "remove_container", "Remove Traefik container from servers", hide: true
104
- def remove_container
105
- with_lock do
106
- on(KAMAL.traefik_hosts) do
107
- execute *KAMAL.auditor.record("Removed traefik container"), verbosity: :debug
108
- execute *KAMAL.traefik.remove_container
109
- end
110
- end
111
- end
112
-
113
- desc "remove_image", "Remove Traefik image from servers", hide: true
114
- def remove_image
115
- with_lock do
116
- on(KAMAL.traefik_hosts) do
117
- execute *KAMAL.auditor.record("Removed traefik image"), verbosity: :debug
118
- execute *KAMAL.traefik.remove_image
119
- end
120
- end
121
- end
122
- end
@@ -1,22 +0,0 @@
1
- module Kamal::Commands::App::Cord
2
- def cord(version:)
3
- pipe \
4
- docker(:inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\\n\" .Source .Destination}}{{ end }}'", container_name(version)),
5
- [ :awk, "'$2 == \"#{role.cord_volume.container_path}\" {print $1}'" ]
6
- end
7
-
8
- def tie_cord(cord)
9
- create_empty_file(cord)
10
- end
11
-
12
- def cut_cord(cord)
13
- remove_directory(cord)
14
- end
15
-
16
- private
17
- def create_empty_file(file)
18
- chain \
19
- make_directory_for(file),
20
- [ :touch, file ]
21
- end
22
- end
@@ -1,65 +0,0 @@
1
- class Kamal::Commands::Builder::Multiarch::Remote < Kamal::Commands::Builder::Multiarch
2
- def create
3
- combine \
4
- create_contexts,
5
- create_local_buildx,
6
- append_remote_buildx
7
- end
8
-
9
- def remove
10
- combine \
11
- remove_contexts,
12
- super
13
- end
14
-
15
- def context_hosts
16
- chain \
17
- context_host(builder_name_with_arch(local_arch)),
18
- context_host(builder_name_with_arch(remote_arch))
19
- end
20
-
21
- def config_context_hosts
22
- [ local_host, remote_host ].compact
23
- end
24
-
25
- private
26
- def builder_name
27
- super + "-remote"
28
- end
29
-
30
- def builder_name_with_arch(arch)
31
- "#{builder_name}-#{arch}"
32
- end
33
-
34
- def create_local_buildx
35
- docker :buildx, :create, "--name", builder_name, builder_name_with_arch(local_arch), "--platform", "linux/#{local_arch}"
36
- end
37
-
38
- def append_remote_buildx
39
- docker :buildx, :create, "--append", "--name", builder_name, builder_name_with_arch(remote_arch), "--platform", "linux/#{remote_arch}"
40
- end
41
-
42
- def create_contexts
43
- combine \
44
- create_context(local_arch, local_host),
45
- create_context(remote_arch, remote_host)
46
- end
47
-
48
- def create_context(arch, host)
49
- docker :context, :create, builder_name_with_arch(arch), "--description", "'#{builder_name} #{arch} native host'", "--docker", "'host=#{host}'"
50
- end
51
-
52
- def remove_contexts
53
- combine \
54
- remove_context(local_arch),
55
- remove_context(remote_arch)
56
- end
57
-
58
- def remove_context(arch)
59
- docker :context, :rm, builder_name_with_arch(arch)
60
- end
61
-
62
- def platform_names
63
- "linux/#{local_arch},linux/#{remote_arch}"
64
- end
65
- end
@@ -1,41 +0,0 @@
1
- class Kamal::Commands::Builder::Multiarch < Kamal::Commands::Builder::Base
2
- def create
3
- docker :buildx, :create, "--use", "--name", builder_name
4
- end
5
-
6
- def remove
7
- docker :buildx, :rm, builder_name
8
- end
9
-
10
- def info
11
- combine \
12
- docker(:context, :ls),
13
- docker(:buildx, :ls)
14
- end
15
-
16
- def push
17
- docker :buildx, :build,
18
- "--push",
19
- "--platform", platform_names,
20
- "--builder", builder_name,
21
- *build_options,
22
- build_context
23
- end
24
-
25
- def context_hosts
26
- docker :buildx, :inspect, builder_name, "> /dev/null"
27
- end
28
-
29
- private
30
- def builder_name
31
- "kamal-#{config.service}-multiarch"
32
- end
33
-
34
- def platform_names
35
- if local_arch
36
- "linux/#{local_arch}"
37
- else
38
- "linux/amd64,linux/arm64"
39
- end
40
- end
41
- end
@@ -1,25 +0,0 @@
1
- class Kamal::Commands::Builder::Native::Cached < Kamal::Commands::Builder::Native
2
- def create
3
- docker :buildx, :create, "--name", builder_name, "--use", "--driver=docker-container"
4
- end
5
-
6
- def remove
7
- docker :buildx, :rm, builder_name
8
- end
9
-
10
- def push
11
- docker :buildx, :build,
12
- "--push",
13
- *build_options,
14
- build_context
15
- end
16
-
17
- def context_hosts
18
- docker :buildx, :inspect, builder_name, "> /dev/null"
19
- end
20
-
21
- private
22
- def builder_name
23
- "kamal-#{config.service}-native-cached"
24
- end
25
- end
@@ -1,67 +0,0 @@
1
- class Kamal::Commands::Builder::Native::Remote < Kamal::Commands::Builder::Native
2
- def create
3
- chain \
4
- create_context,
5
- create_buildx
6
- end
7
-
8
- def remove
9
- chain \
10
- remove_context,
11
- remove_buildx
12
- end
13
-
14
- def info
15
- chain \
16
- docker(:context, :ls),
17
- docker(:buildx, :ls)
18
- end
19
-
20
- def push
21
- docker :buildx, :build,
22
- "--push",
23
- "--platform", platform,
24
- "--builder", builder_name,
25
- *build_options,
26
- build_context
27
- end
28
-
29
- def context_hosts
30
- context_host(builder_name_with_arch)
31
- end
32
-
33
- def config_context_hosts
34
- [ remote_host ]
35
- end
36
-
37
-
38
- private
39
- def builder_name
40
- "kamal-#{config.service}-native-remote"
41
- end
42
-
43
- def builder_name_with_arch
44
- "#{builder_name}-#{remote_arch}"
45
- end
46
-
47
- def platform
48
- "linux/#{remote_arch}"
49
- end
50
-
51
- def create_context
52
- docker :context, :create,
53
- builder_name_with_arch, "--description", "'#{builder_name} #{remote_arch} native host'", "--docker", "'host=#{remote_host}'"
54
- end
55
-
56
- def remove_context
57
- docker :context, :rm, builder_name_with_arch
58
- end
59
-
60
- def create_buildx
61
- docker :buildx, :create, "--name", builder_name, builder_name_with_arch, "--platform", platform
62
- end
63
-
64
- def remove_buildx
65
- docker :buildx, :rm, builder_name
66
- end
67
- end