kamal 2.0.0.beta1 → 2.0.0.rc1
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 +5 -3
- data/lib/kamal/cli/app.rb +5 -3
- data/lib/kamal/cli/base.rb +13 -2
- data/lib/kamal/cli/build.rb +20 -18
- data/lib/kamal/cli/main.rb +3 -3
- data/lib/kamal/cli/proxy.rb +5 -14
- data/lib/kamal/commands/accessory.rb +4 -4
- data/lib/kamal/commands/app/execution.rb +1 -0
- data/lib/kamal/commands/app/logging.rb +4 -4
- data/lib/kamal/commands/hook.rb +7 -4
- data/lib/kamal/commands/proxy.rb +5 -10
- data/lib/kamal/configuration/docs/builder.yml +1 -5
- data/lib/kamal/configuration/docs/configuration.yml +6 -2
- data/lib/kamal/configuration/docs/env.yml +16 -3
- data/lib/kamal/configuration/docs/proxy.yml +2 -2
- data/lib/kamal/configuration/docs/role.yml +6 -2
- data/lib/kamal/configuration.rb +1 -11
- data/lib/kamal/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: 80950d18ef8b135b87bca865f31422e8b367137a7561381b1566e07384a75b0b
|
4
|
+
data.tar.gz: 0d86e69df81fabde4b6c0b0be0de1ca6f64f5cd94f3242d0f4702428aef9fbfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b1ae9daecd6fe5342d830c10be8e54b26d668703f8c731b6f920f38a7183dcb27bc8a97630d4f4bdc1891c56b1f8a669c79ba85f2400053313df4a5a994d1eb
|
7
|
+
data.tar.gz: 61716c7a9e7fc1e3928a0ce30539accc3f9531f09d0835c37248cceb48fc19b90ba4c9d5f3e615335d505552988c92277e7e4e4447b8beb25991e2c8cead5a2e
|
data/lib/kamal/cli/accessory.rb
CHANGED
@@ -147,23 +147,25 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
|
147
147
|
option :grep, aliases: "-g", desc: "Show lines with grep match only (use this to fetch specific requests by id)"
|
148
148
|
option :grep_options, aliases: "-o", desc: "Additional options supplied to grep"
|
149
149
|
option :follow, aliases: "-f", desc: "Follow logs on primary server (or specific host set by --hosts)"
|
150
|
+
option :skip_timestamps, aliases: "-T", desc: "Skip appending timestamps to logging output"
|
150
151
|
def logs(name)
|
151
152
|
with_accessory(name) do |accessory, hosts|
|
152
153
|
grep = options[:grep]
|
153
154
|
grep_options = options[:grep_options]
|
155
|
+
timestamps = !options[:skip_timestamps]
|
154
156
|
|
155
157
|
if options[:follow]
|
156
158
|
run_locally do
|
157
159
|
info "Following logs on #{hosts}..."
|
158
|
-
info accessory.follow_logs(grep: grep, grep_options: grep_options)
|
159
|
-
exec accessory.follow_logs(grep: grep, grep_options: grep_options)
|
160
|
+
info accessory.follow_logs(timestamps: timestamps, grep: grep, grep_options: grep_options)
|
161
|
+
exec accessory.follow_logs(timestamps: timestamps, grep: grep, grep_options: grep_options)
|
160
162
|
end
|
161
163
|
else
|
162
164
|
since = options[:since]
|
163
165
|
lines = options[:lines].presence || ((since || grep) ? nil : 100) # Default to 100 lines if since or grep isn't set
|
164
166
|
|
165
167
|
on(hosts) do
|
166
|
-
puts capture_with_info(*accessory.logs(since: since, lines: lines, grep: grep, grep_options: grep_options))
|
168
|
+
puts capture_with_info(*accessory.logs(timestamps: timestamps, since: since, lines: lines, grep: grep, grep_options: grep_options))
|
167
169
|
end
|
168
170
|
end
|
169
171
|
end
|
data/lib/kamal/cli/app.rb
CHANGED
@@ -188,12 +188,14 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
188
188
|
option :grep, aliases: "-g", desc: "Show lines with grep match only (use this to fetch specific requests by id)"
|
189
189
|
option :grep_options, aliases: "-o", desc: "Additional options supplied to grep"
|
190
190
|
option :follow, aliases: "-f", desc: "Follow log on primary server (or specific host set by --hosts)"
|
191
|
+
option :skip_timestamps, aliases: "-T", desc: "Skip appending timestamps to logging output"
|
191
192
|
def logs
|
192
193
|
# FIXME: Catch when app containers aren't running
|
193
194
|
|
194
195
|
grep = options[:grep]
|
195
196
|
grep_options = options[:grep_options]
|
196
197
|
since = options[:since]
|
198
|
+
timestamps = !options[:skip_timestamps]
|
197
199
|
|
198
200
|
if options[:follow]
|
199
201
|
lines = options[:lines].presence || ((since || grep) ? nil : 10) # Default to 10 lines if since or grep isn't set
|
@@ -205,8 +207,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
205
207
|
role = KAMAL.roles_on(KAMAL.primary_host).first
|
206
208
|
|
207
209
|
app = KAMAL.app(role: role, host: host)
|
208
|
-
info app.follow_logs(host: KAMAL.primary_host, lines: lines, grep: grep, grep_options: grep_options)
|
209
|
-
exec app.follow_logs(host: KAMAL.primary_host, lines: lines, grep: grep, grep_options: grep_options)
|
210
|
+
info app.follow_logs(host: KAMAL.primary_host, timestamps: timestamps, lines: lines, grep: grep, grep_options: grep_options)
|
211
|
+
exec app.follow_logs(host: KAMAL.primary_host, timestamps: timestamps, lines: lines, grep: grep, grep_options: grep_options)
|
210
212
|
end
|
211
213
|
else
|
212
214
|
lines = options[:lines].presence || ((since || grep) ? nil : 100) # Default to 100 lines if since or grep isn't set
|
@@ -216,7 +218,7 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
216
218
|
|
217
219
|
roles.each do |role|
|
218
220
|
begin
|
219
|
-
puts_by_host host, capture_with_info(*KAMAL.app(role: role, host: host).logs(since: since, lines: lines, grep: grep, grep_options: grep_options))
|
221
|
+
puts_by_host host, capture_with_info(*KAMAL.app(role: role, host: host).logs(timestamps: timestamps, since: since, lines: lines, grep: grep, grep_options: grep_options))
|
220
222
|
rescue SSHKit::Command::Failed
|
221
223
|
puts_by_host host, "Nothing found"
|
222
224
|
end
|
data/lib/kamal/cli/base.rb
CHANGED
@@ -135,8 +135,10 @@ module Kamal::Cli
|
|
135
135
|
details = { hosts: KAMAL.hosts.join(","), command: command, subcommand: subcommand }
|
136
136
|
|
137
137
|
say "Running the #{hook} hook...", :magenta
|
138
|
-
|
139
|
-
|
138
|
+
with_env KAMAL.hook.env(**details, **extra_details) do
|
139
|
+
run_locally do
|
140
|
+
execute *KAMAL.hook.run(hook)
|
141
|
+
end
|
140
142
|
rescue SSHKit::Command::Failed => e
|
141
143
|
raise HookError.new("Hook `#{hook}` failed:\n#{e.message}")
|
142
144
|
end
|
@@ -183,5 +185,14 @@ module Kamal::Cli
|
|
183
185
|
execute(*KAMAL.server.ensure_run_directory)
|
184
186
|
end
|
185
187
|
end
|
188
|
+
|
189
|
+
def with_env(env)
|
190
|
+
current_env = ENV.to_h.dup
|
191
|
+
ENV.update(env)
|
192
|
+
yield
|
193
|
+
ensure
|
194
|
+
ENV.clear
|
195
|
+
ENV.update(current_env)
|
196
|
+
end
|
186
197
|
end
|
187
198
|
end
|
data/lib/kamal/cli/build.rb
CHANGED
@@ -30,28 +30,30 @@ class Kamal::Cli::Build < Kamal::Cli::Base
|
|
30
30
|
say "Building with uncommitted changes:\n #{uncommitted_changes}", :yellow
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
with_env(KAMAL.config.builder.secrets) do
|
34
|
+
run_locally do
|
35
|
+
begin
|
36
|
+
execute *KAMAL.builder.inspect_builder
|
37
|
+
rescue SSHKit::Command::Failed => e
|
38
|
+
if e.message =~ /(context not found|no builder|no compatible builder|does not exist)/
|
39
|
+
warn "Missing compatible builder, so creating a new one first"
|
40
|
+
begin
|
41
|
+
cli.remove
|
42
|
+
rescue SSHKit::Command::Failed
|
43
|
+
raise unless e.message =~ /(context not found|no builder|does not exist)/
|
44
|
+
end
|
45
|
+
cli.create
|
46
|
+
else
|
47
|
+
raise
|
43
48
|
end
|
44
|
-
cli.create
|
45
|
-
else
|
46
|
-
raise
|
47
49
|
end
|
48
|
-
end
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
# Get the command here to ensure the Dir.chdir doesn't interfere with it
|
52
|
+
push = KAMAL.builder.push
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
KAMAL.with_verbosity(:debug) do
|
55
|
+
Dir.chdir(KAMAL.config.builder.build_directory) { execute *push }
|
56
|
+
end
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
data/lib/kamal/cli/main.rb
CHANGED
@@ -48,7 +48,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
run_hook "post-deploy", secrets: true, runtime: runtime.round
|
51
|
+
run_hook "post-deploy", secrets: true, runtime: runtime.round.to_s
|
52
52
|
end
|
53
53
|
|
54
54
|
desc "redeploy", "Deploy app to servers without bootstrapping servers, starting kamal-proxy, pruning, and registry login"
|
@@ -75,7 +75,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
run_hook "post-deploy", secrets: true, runtime: runtime.round
|
78
|
+
run_hook "post-deploy", secrets: true, runtime: runtime.round.to_s
|
79
79
|
end
|
80
80
|
|
81
81
|
desc "rollback [VERSION]", "Rollback app to VERSION"
|
@@ -99,7 +99,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
run_hook "post-deploy", secrets: true, runtime: runtime.round if rolled_back
|
102
|
+
run_hook "post-deploy", secrets: true, runtime: runtime.round.to_s if rolled_back
|
103
103
|
end
|
104
104
|
|
105
105
|
desc "details", "Show details about all containers"
|
data/lib/kamal/cli/proxy.rb
CHANGED
@@ -140,21 +140,23 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
140
140
|
option :lines, type: :numeric, aliases: "-n", desc: "Number of log lines to pull from each server"
|
141
141
|
option :grep, aliases: "-g", desc: "Show lines with grep match only (use this to fetch specific requests by id)"
|
142
142
|
option :follow, aliases: "-f", desc: "Follow logs on primary server (or specific host set by --hosts)"
|
143
|
+
option :skip_timestamps, aliases: "-T", desc: "Skip appending timestamps to logging output"
|
143
144
|
def logs
|
144
145
|
grep = options[:grep]
|
146
|
+
timestamps = !options[:skip_timestamps]
|
145
147
|
|
146
148
|
if options[:follow]
|
147
149
|
run_locally do
|
148
150
|
info "Following logs on #{KAMAL.primary_host}..."
|
149
|
-
info KAMAL.proxy.follow_logs(host: KAMAL.primary_host, grep: grep)
|
150
|
-
exec KAMAL.proxy.follow_logs(host: KAMAL.primary_host, grep: grep)
|
151
|
+
info KAMAL.proxy.follow_logs(host: KAMAL.primary_host, timestamps: timestamps, grep: grep)
|
152
|
+
exec KAMAL.proxy.follow_logs(host: KAMAL.primary_host, timestamps: timestamps, grep: grep)
|
151
153
|
end
|
152
154
|
else
|
153
155
|
since = options[:since]
|
154
156
|
lines = options[:lines].presence || ((since || grep) ? nil : 100) # Default to 100 lines if since or grep isn't set
|
155
157
|
|
156
158
|
on(KAMAL.proxy_hosts) do |host|
|
157
|
-
puts_by_host host, capture(*KAMAL.proxy.logs(since: since, lines: lines, grep: grep)), type: "Proxy"
|
159
|
+
puts_by_host host, capture(*KAMAL.proxy.logs(timestamps: timestamps, since: since, lines: lines, grep: grep)), type: "Proxy"
|
158
160
|
end
|
159
161
|
end
|
160
162
|
end
|
@@ -167,7 +169,6 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
167
169
|
stop
|
168
170
|
remove_container
|
169
171
|
remove_image
|
170
|
-
remove_host_directory
|
171
172
|
end
|
172
173
|
end
|
173
174
|
end
|
@@ -192,16 +193,6 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
195
|
-
desc "remove_host_directory", "Remove proxy directory from servers", hide: true
|
196
|
-
def remove_host_directory
|
197
|
-
with_lock do
|
198
|
-
on(KAMAL.proxy_hosts) do
|
199
|
-
execute *KAMAL.auditor.record("Removed #{KAMAL.config.proxy_directory}"), verbosity: :debug
|
200
|
-
execute *KAMAL.proxy.remove_host_directory, raise_on_non_zero_exit: false
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
196
|
private
|
206
197
|
def removal_allowed?(force)
|
207
198
|
on(KAMAL.proxy_hosts) do |host|
|
@@ -39,16 +39,16 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
|
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
-
def logs(since: nil, lines: nil, grep: nil, grep_options: nil)
|
42
|
+
def logs(timestamps: true, since: nil, lines: nil, grep: nil, grep_options: nil)
|
43
43
|
pipe \
|
44
|
-
docker(:logs, service_name, (" --since #{since}" if since), (" --tail #{lines}" if lines), "--timestamps", "2>&1"),
|
44
|
+
docker(:logs, service_name, (" --since #{since}" if since), (" --tail #{lines}" if lines), ("--timestamps" if timestamps), "2>&1"),
|
45
45
|
("grep '#{grep}'#{" #{grep_options}" if grep_options}" if grep)
|
46
46
|
end
|
47
47
|
|
48
|
-
def follow_logs(grep: nil, grep_options: nil)
|
48
|
+
def follow_logs(timestamps: true, grep: nil, grep_options: nil)
|
49
49
|
run_over_ssh \
|
50
50
|
pipe \
|
51
|
-
docker(:logs, service_name, "--timestamps", "--tail", "10", "--follow", "2>&1"),
|
51
|
+
docker(:logs, service_name, ("--timestamps" if timestamps), "--tail", "10", "--follow", "2>&1"),
|
52
52
|
(%(grep "#{grep}"#{" #{grep_options}" if grep_options}) if grep)
|
53
53
|
end
|
54
54
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Kamal::Commands::App::Logging
|
2
|
-
def logs(version: nil, since: nil, lines: nil, grep: nil, grep_options: nil)
|
2
|
+
def logs(version: nil, timestamps: true, since: nil, lines: nil, grep: nil, grep_options: nil)
|
3
3
|
pipe \
|
4
4
|
version ? container_id_for_version(version) : current_running_container_id,
|
5
|
-
"xargs docker logs#{" --since #{since}" if since}#{" --tail #{lines}" if lines} 2>&1",
|
5
|
+
"xargs docker logs#{" --timestamps" if timestamps}#{" --since #{since}" if since}#{" --tail #{lines}" if lines} 2>&1",
|
6
6
|
("grep '#{grep}'#{" #{grep_options}" if grep_options}" if grep)
|
7
7
|
end
|
8
8
|
|
9
|
-
def follow_logs(host:, lines: nil, grep: nil, grep_options: nil)
|
9
|
+
def follow_logs(host:, timestamps: true, lines: nil, grep: nil, grep_options: nil)
|
10
10
|
run_over_ssh \
|
11
11
|
pipe(
|
12
12
|
current_running_container_id,
|
13
|
-
"xargs docker logs --timestamps#{" --tail #{lines}" if lines} --follow 2>&1",
|
13
|
+
"xargs docker logs#{" --timestamps" if timestamps}#{" --tail #{lines}" if lines} --follow 2>&1",
|
14
14
|
(%(grep "#{grep}"#{" #{grep_options}" if grep_options}) if grep)
|
15
15
|
),
|
16
16
|
host: host
|
data/lib/kamal/commands/hook.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
class Kamal::Commands::Hook < Kamal::Commands::Base
|
2
|
-
def run(hook
|
3
|
-
|
4
|
-
|
2
|
+
def run(hook)
|
3
|
+
[ hook_file(hook) ]
|
4
|
+
end
|
5
5
|
|
6
|
-
|
6
|
+
def env(secrets: false, **details)
|
7
|
+
tags(**details).env.tap do |env|
|
8
|
+
env.merge!(config.secrets.to_h) if secrets
|
9
|
+
end
|
7
10
|
end
|
8
11
|
|
9
12
|
def hook_exists?(hook)
|
data/lib/kamal/commands/proxy.rb
CHANGED
@@ -8,8 +8,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
8
8
|
"--detach",
|
9
9
|
"--restart", "unless-stopped",
|
10
10
|
*config.proxy_publish_args,
|
11
|
-
"--volume", "
|
12
|
-
*config.proxy_config_volume.docker_args,
|
11
|
+
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy",
|
13
12
|
*config.logging_args,
|
14
13
|
config.proxy_image
|
15
14
|
end
|
@@ -36,15 +35,15 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
36
35
|
[ :cut, "-d:", "-f2" ]
|
37
36
|
end
|
38
37
|
|
39
|
-
def logs(since: nil, lines: nil, grep: nil, grep_options: nil)
|
38
|
+
def logs(timestamps: true, since: nil, lines: nil, grep: nil, grep_options: nil)
|
40
39
|
pipe \
|
41
|
-
docker(:logs, container_name, ("
|
40
|
+
docker(:logs, container_name, ("--since #{since}" if since), ("--tail #{lines}" if lines), ("--timestamps" if timestamps), "2>&1"),
|
42
41
|
("grep '#{grep}'#{" #{grep_options}" if grep_options}" if grep)
|
43
42
|
end
|
44
43
|
|
45
|
-
def follow_logs(host:, grep: nil, grep_options: nil)
|
44
|
+
def follow_logs(host:, timestamps: true, grep: nil, grep_options: nil)
|
46
45
|
run_over_ssh pipe(
|
47
|
-
docker(:logs, container_name, "--timestamps", "--tail", "10", "--follow", "2>&1"),
|
46
|
+
docker(:logs, container_name, ("--timestamps" if timestamps), "--tail", "10", "--follow", "2>&1"),
|
48
47
|
(%(grep "#{grep}"#{" #{grep_options}" if grep_options}) if grep)
|
49
48
|
).join(" "), host: host
|
50
49
|
end
|
@@ -57,10 +56,6 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
57
56
|
docker :image, :prune, "--all", "--force", "--filter", "label=org.opencontainers.image.title=kamal-proxy"
|
58
57
|
end
|
59
58
|
|
60
|
-
def remove_host_directory
|
61
|
-
remove_directory config.proxy_directory
|
62
|
-
end
|
63
|
-
|
64
59
|
def cleanup_traefik
|
65
60
|
chain \
|
66
61
|
docker(:container, :stop, "traefik"),
|
@@ -2,10 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# The builder configuration controls how the application is built with `docker build`
|
4
4
|
#
|
5
|
-
# If no configuration is specified, Kamal will:
|
6
|
-
# 1. Create a buildx context called `kamal-local-docker-container`, using the docker-container driver
|
7
|
-
# 2. Use `docker build` to build a multiarch image for linux/amd64,linux/arm64 with that context
|
8
|
-
#
|
9
5
|
# See https://kamal-deploy.org/docs/configuration/builder-examples/ for more information
|
10
6
|
|
11
7
|
# Builder options
|
@@ -78,7 +74,7 @@ builder:
|
|
78
74
|
|
79
75
|
# Build secrets
|
80
76
|
#
|
81
|
-
# Values are read from
|
77
|
+
# Values are read from .kamal/secrets.
|
82
78
|
#
|
83
79
|
secrets:
|
84
80
|
- SECRET1
|
@@ -36,6 +36,8 @@ image: my-image
|
|
36
36
|
labels:
|
37
37
|
my-label: my-value
|
38
38
|
|
39
|
+
# Volumes
|
40
|
+
#
|
39
41
|
# Additional volumes to mount into the container
|
40
42
|
volumes:
|
41
43
|
- /path/on/host:/path/in/container:ro
|
@@ -58,7 +60,7 @@ servers:
|
|
58
60
|
env:
|
59
61
|
...
|
60
62
|
|
61
|
-
# Asset
|
63
|
+
# Asset Path
|
62
64
|
#
|
63
65
|
# Used for asset bridging across deployments, default to `nil`
|
64
66
|
#
|
@@ -74,6 +76,8 @@ env:
|
|
74
76
|
# To configure this, set the path to the assets:
|
75
77
|
asset_path: /path/to/assets
|
76
78
|
|
79
|
+
# Hooks path
|
80
|
+
#
|
77
81
|
# Path to hooks, defaults to `.kamal/hooks`
|
78
82
|
# See https://kamal-deploy.org/docs/hooks for more information
|
79
83
|
hooks_path: /user_home/kamal/hooks
|
@@ -83,7 +87,7 @@ hooks_path: /user_home/kamal/hooks
|
|
83
87
|
# Whether deployments require a destination to be specified, defaults to `false`
|
84
88
|
require_destination: true
|
85
89
|
|
86
|
-
#
|
90
|
+
# Primary role
|
87
91
|
#
|
88
92
|
# This defaults to `web`, but if you have no web role, you can change this
|
89
93
|
primary_role: workers
|
@@ -12,11 +12,16 @@ env:
|
|
12
12
|
DATABASE_HOST: mysql-db1
|
13
13
|
DATABASE_PORT: 3306
|
14
14
|
|
15
|
-
#
|
15
|
+
# Secrets
|
16
16
|
#
|
17
|
-
# Kamal uses dotenv to automatically load environment variables set in the
|
17
|
+
# Kamal uses dotenv to automatically load environment variables set in the `.kamal/secrets` file.
|
18
18
|
#
|
19
|
-
#
|
19
|
+
# If you are using destinations, secrets will instead be read from `.kamal/secrets-<DESTINATION>` if
|
20
|
+
# it exists.
|
21
|
+
#
|
22
|
+
# Common secrets across all destinations can be set in `.kamal/secrets-common`.
|
23
|
+
#
|
24
|
+
# This file can be used to set variables like `KAMAL_REGISTRY_PASSWORD` or database passwords.
|
20
25
|
# You can use variable or command substitution in the secrets file.
|
21
26
|
#
|
22
27
|
# ```
|
@@ -24,6 +29,14 @@ env:
|
|
24
29
|
# RAILS_MASTER_KEY=$(cat config/master.key)
|
25
30
|
# ```
|
26
31
|
#
|
32
|
+
# You can also use [secret helpers](../commands/secrets) for some common password managers.
|
33
|
+
# ```
|
34
|
+
# SECRETS=$(kamal secrets fetch ...)
|
35
|
+
#
|
36
|
+
# REGISTRY_PASSWORD=$(kamal secrets extract REGISTRY_PASSWORD $SECRETS)
|
37
|
+
# DB_PASSWORD=$(kamal secrets extract DB_PASSWORD $SECRETS)
|
38
|
+
# ```
|
39
|
+
#
|
27
40
|
# If you store secrets directly in .kamal/secrets, ensure that it is not checked into version control.
|
28
41
|
#
|
29
42
|
# To pass the secrets you should list them under the `secret` key. When you do this the
|
@@ -47,7 +47,7 @@ proxy:
|
|
47
47
|
# Response timeout
|
48
48
|
#
|
49
49
|
# How long to wait for requests to complete before timing out, defaults to 30 seconds
|
50
|
-
response_timeout:
|
50
|
+
response_timeout: 10
|
51
51
|
|
52
52
|
# Healthcheck
|
53
53
|
#
|
@@ -91,7 +91,7 @@ proxy:
|
|
91
91
|
|
92
92
|
# Forward headers
|
93
93
|
#
|
94
|
-
# Whether to forward the X-Forwarded-For and X-Forwarded-Proto headers
|
94
|
+
# Whether to forward the X-Forwarded-For and X-Forwarded-Proto headers.
|
95
95
|
#
|
96
96
|
# If you are behind a trusted proxy, you can set this to true to forward the headers.
|
97
97
|
#
|
@@ -26,8 +26,12 @@ servers:
|
|
26
26
|
#
|
27
27
|
# When there are other options to set, the list of hosts goes under the `hosts` key
|
28
28
|
#
|
29
|
-
# By default only the primary role uses a proxy
|
30
|
-
#
|
29
|
+
# By default only the primary role uses a proxy.
|
30
|
+
#
|
31
|
+
# For other roles, you can set it to `proxy: true` enable it and inherit the root proxy
|
32
|
+
# configuration or provide a map of options to override the root configuration.
|
33
|
+
#
|
34
|
+
# For the primary role, you can set `proxy: false` to disable the proxy.
|
31
35
|
#
|
32
36
|
# You can also set a custom cmd to run in the container, and overwrite other settings
|
33
37
|
# from the root configuration.
|
data/lib/kamal/configuration.rb
CHANGED
@@ -14,7 +14,7 @@ class Kamal::Configuration
|
|
14
14
|
|
15
15
|
include Validation
|
16
16
|
|
17
|
-
PROXY_MINIMUM_VERSION = "v0.
|
17
|
+
PROXY_MINIMUM_VERSION = "v0.4.0"
|
18
18
|
PROXY_HTTP_PORT = 80
|
19
19
|
PROXY_HTTPS_PORT = 443
|
20
20
|
|
@@ -216,10 +216,6 @@ class Kamal::Configuration
|
|
216
216
|
File.join apps_directory, [ service, destination ].compact.join("-")
|
217
217
|
end
|
218
218
|
|
219
|
-
def proxy_directory
|
220
|
-
File.join run_directory, "proxy"
|
221
|
-
end
|
222
|
-
|
223
219
|
def env_directory
|
224
220
|
File.join app_directory, "env"
|
225
221
|
end
|
@@ -262,12 +258,6 @@ class Kamal::Configuration
|
|
262
258
|
"kamal-proxy"
|
263
259
|
end
|
264
260
|
|
265
|
-
def proxy_config_volume
|
266
|
-
Kamal::Configuration::Volume.new \
|
267
|
-
host_path: File.join(proxy_directory, "config"),
|
268
|
-
container_path: "/home/kamal-proxy/.config/kamal-proxy"
|
269
|
-
end
|
270
|
-
|
271
261
|
|
272
262
|
def to_h
|
273
263
|
{
|
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: 2.0.0.
|
4
|
+
version: 2.0.0.rc1
|
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-09-
|
11
|
+
date: 2024-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|