kamal 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kamal/cli/accessory.rb +2 -1
- data/lib/kamal/cli/build.rb +1 -1
- data/lib/kamal/commander/specifics.rb +1 -1
- data/lib/kamal/version.rb +1 -1
- metadata +2 -3
- data/lib/kamal/commands/app.rb.orig +0 -127
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63594154afe8efc69b08fd2a27b1efb4ff6604d1bd62f345dc8d24df7903b649
|
4
|
+
data.tar.gz: d8e8cb819aeea4212bc576e2b8a5bcd2cc6fcd67c6186ba0e04b2250999985c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9da318bbc1fe8e5dac2b09cc8c89682417653de15b72567378a6998e0992fad999a1a8bca4b32f8eb2a7147f774d59efb4850b50ea15bfcde32d8426b50303fe
|
7
|
+
data.tar.gz: ca156878b11110b0bc7092790565bfbf5b3cdf9206a2faf210c805856dab0aef9e57b883c09f86422c6c0821f6c281a7ed892ccf061101750dc8507326ba53d3
|
data/lib/kamal/cli/accessory.rb
CHANGED
@@ -107,8 +107,9 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
|
107
107
|
if name == "all"
|
108
108
|
KAMAL.accessory_names.each { |accessory_name| details(accessory_name) }
|
109
109
|
else
|
110
|
+
type = "Accessory #{name}"
|
110
111
|
with_accessory(name) do |accessory, hosts|
|
111
|
-
on(hosts) {
|
112
|
+
on(hosts) { puts_by_host host, capture_with_info(*accessory.info), type: type }
|
112
113
|
end
|
113
114
|
end
|
114
115
|
end
|
data/lib/kamal/cli/build.rb
CHANGED
@@ -30,7 +30,7 @@ class Kamal::Cli::Build < Kamal::Cli::Base
|
|
30
30
|
end
|
31
31
|
rescue SSHKit::Command::Failed => e
|
32
32
|
if e.message =~ /(no builder)|(no such file or directory)/
|
33
|
-
|
33
|
+
warn "Missing compatible builder, so creating a new one first"
|
34
34
|
|
35
35
|
if cli.create
|
36
36
|
KAMAL.with_verbosity(:debug) { execute *KAMAL.builder.push }
|
data/lib/kamal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -233,7 +233,6 @@ files:
|
|
233
233
|
- lib/kamal/commands.rb
|
234
234
|
- lib/kamal/commands/accessory.rb
|
235
235
|
- lib/kamal/commands/app.rb
|
236
|
-
- lib/kamal/commands/app.rb.orig
|
237
236
|
- lib/kamal/commands/app/assets.rb
|
238
237
|
- lib/kamal/commands/app/containers.rb
|
239
238
|
- lib/kamal/commands/app/cord.rb
|
@@ -1,127 +0,0 @@
|
|
1
|
-
class Kamal::Commands::App < Kamal::Commands::Base
|
2
|
-
include Assets, Containers, Cord, Execution, Images, Logging
|
3
|
-
|
4
|
-
ACTIVE_DOCKER_STATUSES = [ :running, :restarting ]
|
5
|
-
|
6
|
-
attr_reader :role
|
7
|
-
|
8
|
-
def initialize(config, role: nil)
|
9
|
-
super(config)
|
10
|
-
@role = role
|
11
|
-
end
|
12
|
-
|
13
|
-
def run(hostname: nil)
|
14
|
-
docker :run,
|
15
|
-
"--detach",
|
16
|
-
"--restart unless-stopped",
|
17
|
-
"--name", container_name,
|
18
|
-
*([ "--hostname", hostname ] if hostname),
|
19
|
-
"-e", "KAMAL_CONTAINER_NAME=\"#{container_name}\"",
|
20
|
-
"-e", "KAMAL_VERSION=\"#{config.version}\"",
|
21
|
-
*role.env_args,
|
22
|
-
*role.health_check_args,
|
23
|
-
*role.logging_args,
|
24
|
-
*config.volume_args,
|
25
|
-
*role.asset_volume_args,
|
26
|
-
*role.label_args,
|
27
|
-
*role.option_args,
|
28
|
-
config.absolute_image,
|
29
|
-
role.cmd
|
30
|
-
end
|
31
|
-
|
32
|
-
def start
|
33
|
-
docker :start, container_name
|
34
|
-
end
|
35
|
-
|
36
|
-
def status(version:)
|
37
|
-
pipe container_id_for_version(version), xargs(docker(:inspect, "--format", DOCKER_HEALTH_STATUS_FORMAT))
|
38
|
-
end
|
39
|
-
|
40
|
-
def stop(version: nil)
|
41
|
-
pipe \
|
42
|
-
version ? container_id_for_version(version) : current_running_container_id,
|
43
|
-
xargs(config.stop_wait_time ? docker(:stop, "-t", config.stop_wait_time) : docker(:stop))
|
44
|
-
end
|
45
|
-
|
46
|
-
def info
|
47
|
-
docker :ps, *filter_args
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
def current_running_container_id
|
52
|
-
current_running_container(format: "--quiet")
|
53
|
-
end
|
54
|
-
|
55
|
-
def container_id_for_version(version, only_running: false)
|
56
|
-
container_id_for(container_name: container_name(version), only_running: only_running)
|
57
|
-
end
|
58
|
-
|
59
|
-
<<<<<<< HEAD
|
60
|
-
def current_running_version
|
61
|
-
pipe \
|
62
|
-
current_running_container(format: "--format '{{.Names}}'"),
|
63
|
-
extract_version_from_name
|
64
|
-
=======
|
65
|
-
def current_running_version(prefix: nil)
|
66
|
-
list_versions("--latest", statuses: ACTIVE_DOCKER_STATUSES)
|
67
|
-
>>>>>>> 4dc8aca (Rename roles)
|
68
|
-
end
|
69
|
-
|
70
|
-
def list_versions(*docker_args, statuses: nil)
|
71
|
-
pipe \
|
72
|
-
docker(:ps, *filter_args(statuses: statuses), *docker_args, "--format", '"{{.Names}}"'),
|
73
|
-
extract_version_from_name
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
def make_env_directory
|
78
|
-
make_directory role.env.secrets_directory
|
79
|
-
end
|
80
|
-
|
81
|
-
def remove_env_file
|
82
|
-
[ :rm, "-f", role.env.secrets_file ]
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
private
|
87
|
-
def container_name(version = nil)
|
88
|
-
[ role.container_prefix, version || config.version ].compact.join("-")
|
89
|
-
end
|
90
|
-
|
91
|
-
def latest_image_id
|
92
|
-
docker :image, :ls, *argumentize("--filter", "reference=#{config.latest_image}"), "--format", "'{{.ID}}'"
|
93
|
-
end
|
94
|
-
|
95
|
-
def current_running_container(format:)
|
96
|
-
pipe \
|
97
|
-
shell(chain(latest_image_container(format: format), latest_container(format: format))),
|
98
|
-
[ :head, "-1" ]
|
99
|
-
end
|
100
|
-
|
101
|
-
def latest_image_container(format:)
|
102
|
-
latest_container format: format, filters: [ "ancestor=$(#{latest_image_id.join(" ")})" ]
|
103
|
-
end
|
104
|
-
|
105
|
-
def latest_container(format:, filters: nil)
|
106
|
-
docker :ps, "--latest", *format, *filter_args(statuses: ACTIVE_DOCKER_STATUSES), argumentize("--filter", filters)
|
107
|
-
end
|
108
|
-
|
109
|
-
def filter_args(statuses: nil)
|
110
|
-
argumentize "--filter", filters(statuses: statuses)
|
111
|
-
end
|
112
|
-
|
113
|
-
def extract_version_from_name
|
114
|
-
# Extract SHA from "service-role-dest-SHA"
|
115
|
-
%(while read line; do echo ${line##{role.container_prefix}-}; done)
|
116
|
-
end
|
117
|
-
|
118
|
-
def filters(statuses: nil)
|
119
|
-
[ "label=service=#{config.service}" ].tap do |filters|
|
120
|
-
filters << "label=destination=#{config.destination}" if config.destination
|
121
|
-
filters << "label=role=#{role}" if role
|
122
|
-
statuses&.each do |status|
|
123
|
-
filters << "status=#{status}"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|