dash 2.12.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 (142) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +13 -0
  4. data/bin/dash +18 -0
  5. data/bin/kamal +18 -0
  6. data/lib/kamal/cli/accessory.rb +342 -0
  7. data/lib/kamal/cli/alias/command.rb +10 -0
  8. data/lib/kamal/cli/app/assets.rb +24 -0
  9. data/lib/kamal/cli/app/boot.rb +126 -0
  10. data/lib/kamal/cli/app/error_pages.rb +33 -0
  11. data/lib/kamal/cli/app/ssl_certificates.rb +28 -0
  12. data/lib/kamal/cli/app.rb +368 -0
  13. data/lib/kamal/cli/base.rb +324 -0
  14. data/lib/kamal/cli/build/clone.rb +59 -0
  15. data/lib/kamal/cli/build/port_forwarding.rb +66 -0
  16. data/lib/kamal/cli/build.rb +242 -0
  17. data/lib/kamal/cli/healthcheck/barrier.rb +33 -0
  18. data/lib/kamal/cli/healthcheck/error.rb +2 -0
  19. data/lib/kamal/cli/healthcheck/poller.rb +42 -0
  20. data/lib/kamal/cli/lock.rb +34 -0
  21. data/lib/kamal/cli/main.rb +299 -0
  22. data/lib/kamal/cli/proxy.rb +419 -0
  23. data/lib/kamal/cli/prune.rb +34 -0
  24. data/lib/kamal/cli/registry.rb +49 -0
  25. data/lib/kamal/cli/secrets.rb +50 -0
  26. data/lib/kamal/cli/server.rb +70 -0
  27. data/lib/kamal/cli/templates/deploy.yml +102 -0
  28. data/lib/kamal/cli/templates/sample_hooks/docker-setup.sample +3 -0
  29. data/lib/kamal/cli/templates/sample_hooks/post-app-boot.sample +3 -0
  30. data/lib/kamal/cli/templates/sample_hooks/post-deploy.sample +14 -0
  31. data/lib/kamal/cli/templates/sample_hooks/post-proxy-reboot.sample +3 -0
  32. data/lib/kamal/cli/templates/sample_hooks/pre-app-boot.sample +3 -0
  33. data/lib/kamal/cli/templates/sample_hooks/pre-build.sample +51 -0
  34. data/lib/kamal/cli/templates/sample_hooks/pre-connect.sample +47 -0
  35. data/lib/kamal/cli/templates/sample_hooks/pre-deploy.sample +122 -0
  36. data/lib/kamal/cli/templates/sample_hooks/pre-proxy-reboot.sample +3 -0
  37. data/lib/kamal/cli/templates/secrets +22 -0
  38. data/lib/kamal/cli.rb +9 -0
  39. data/lib/kamal/commander/specifics.rb +62 -0
  40. data/lib/kamal/commander.rb +230 -0
  41. data/lib/kamal/commands/accessory/proxy.rb +16 -0
  42. data/lib/kamal/commands/accessory.rb +118 -0
  43. data/lib/kamal/commands/app/assets.rb +51 -0
  44. data/lib/kamal/commands/app/containers.rb +31 -0
  45. data/lib/kamal/commands/app/error_pages.rb +9 -0
  46. data/lib/kamal/commands/app/execution.rb +38 -0
  47. data/lib/kamal/commands/app/images.rb +13 -0
  48. data/lib/kamal/commands/app/logging.rb +28 -0
  49. data/lib/kamal/commands/app/proxy.rb +32 -0
  50. data/lib/kamal/commands/app.rb +125 -0
  51. data/lib/kamal/commands/auditor.rb +39 -0
  52. data/lib/kamal/commands/base.rb +147 -0
  53. data/lib/kamal/commands/builder/base.rb +143 -0
  54. data/lib/kamal/commands/builder/clone.rb +32 -0
  55. data/lib/kamal/commands/builder/cloud.rb +22 -0
  56. data/lib/kamal/commands/builder/hybrid.rb +21 -0
  57. data/lib/kamal/commands/builder/local.rb +20 -0
  58. data/lib/kamal/commands/builder/pack.rb +46 -0
  59. data/lib/kamal/commands/builder/remote.rb +75 -0
  60. data/lib/kamal/commands/builder.rb +54 -0
  61. data/lib/kamal/commands/docker.rb +50 -0
  62. data/lib/kamal/commands/hook.rb +20 -0
  63. data/lib/kamal/commands/loadbalancer.rb +130 -0
  64. data/lib/kamal/commands/lock.rb +70 -0
  65. data/lib/kamal/commands/proxy.rb +150 -0
  66. data/lib/kamal/commands/prune.rb +38 -0
  67. data/lib/kamal/commands/registry.rb +38 -0
  68. data/lib/kamal/commands/server.rb +15 -0
  69. data/lib/kamal/commands.rb +2 -0
  70. data/lib/kamal/configuration/accessory.rb +280 -0
  71. data/lib/kamal/configuration/alias.rb +15 -0
  72. data/lib/kamal/configuration/boot.rb +29 -0
  73. data/lib/kamal/configuration/builder.rb +218 -0
  74. data/lib/kamal/configuration/docs/accessory.yml +160 -0
  75. data/lib/kamal/configuration/docs/alias.yml +29 -0
  76. data/lib/kamal/configuration/docs/boot.yml +21 -0
  77. data/lib/kamal/configuration/docs/builder.yml +132 -0
  78. data/lib/kamal/configuration/docs/configuration.yml +228 -0
  79. data/lib/kamal/configuration/docs/env.yml +118 -0
  80. data/lib/kamal/configuration/docs/logging.yml +21 -0
  81. data/lib/kamal/configuration/docs/output.yml +25 -0
  82. data/lib/kamal/configuration/docs/proxy.yml +207 -0
  83. data/lib/kamal/configuration/docs/registry.yml +64 -0
  84. data/lib/kamal/configuration/docs/role.yml +54 -0
  85. data/lib/kamal/configuration/docs/servers.yml +27 -0
  86. data/lib/kamal/configuration/docs/ssh.yml +81 -0
  87. data/lib/kamal/configuration/docs/sshkit.yml +31 -0
  88. data/lib/kamal/configuration/env/tag.rb +13 -0
  89. data/lib/kamal/configuration/env.rb +42 -0
  90. data/lib/kamal/configuration/loadbalancer.rb +34 -0
  91. data/lib/kamal/configuration/logging.rb +33 -0
  92. data/lib/kamal/configuration/output.rb +34 -0
  93. data/lib/kamal/configuration/proxy/boot.rb +124 -0
  94. data/lib/kamal/configuration/proxy/run.rb +152 -0
  95. data/lib/kamal/configuration/proxy.rb +156 -0
  96. data/lib/kamal/configuration/registry.rb +40 -0
  97. data/lib/kamal/configuration/role.rb +247 -0
  98. data/lib/kamal/configuration/servers.rb +25 -0
  99. data/lib/kamal/configuration/ssh.rb +76 -0
  100. data/lib/kamal/configuration/sshkit.rb +26 -0
  101. data/lib/kamal/configuration/validation.rb +27 -0
  102. data/lib/kamal/configuration/validator/accessory.rb +13 -0
  103. data/lib/kamal/configuration/validator/alias.rb +15 -0
  104. data/lib/kamal/configuration/validator/builder.rb +15 -0
  105. data/lib/kamal/configuration/validator/configuration.rb +6 -0
  106. data/lib/kamal/configuration/validator/env.rb +54 -0
  107. data/lib/kamal/configuration/validator/proxy.rb +47 -0
  108. data/lib/kamal/configuration/validator/registry.rb +27 -0
  109. data/lib/kamal/configuration/validator/role.rb +13 -0
  110. data/lib/kamal/configuration/validator/servers.rb +7 -0
  111. data/lib/kamal/configuration/validator.rb +251 -0
  112. data/lib/kamal/configuration/volume.rb +29 -0
  113. data/lib/kamal/configuration.rb +465 -0
  114. data/lib/kamal/docker.rb +30 -0
  115. data/lib/kamal/env_file.rb +44 -0
  116. data/lib/kamal/git.rb +37 -0
  117. data/lib/kamal/otel_shipper.rb +176 -0
  118. data/lib/kamal/output/base_logger.rb +29 -0
  119. data/lib/kamal/output/file_logger.rb +51 -0
  120. data/lib/kamal/output/formatter.rb +36 -0
  121. data/lib/kamal/output/otel_logger.rb +70 -0
  122. data/lib/kamal/secrets/adapters/aws_secrets_manager.rb +59 -0
  123. data/lib/kamal/secrets/adapters/base.rb +33 -0
  124. data/lib/kamal/secrets/adapters/bitwarden.rb +81 -0
  125. data/lib/kamal/secrets/adapters/bitwarden_secrets_manager.rb +66 -0
  126. data/lib/kamal/secrets/adapters/doppler.rb +57 -0
  127. data/lib/kamal/secrets/adapters/enpass.rb +71 -0
  128. data/lib/kamal/secrets/adapters/gcp_secret_manager.rb +112 -0
  129. data/lib/kamal/secrets/adapters/last_pass.rb +40 -0
  130. data/lib/kamal/secrets/adapters/one_password.rb +104 -0
  131. data/lib/kamal/secrets/adapters/passbolt.rb +129 -0
  132. data/lib/kamal/secrets/adapters/test.rb +16 -0
  133. data/lib/kamal/secrets/adapters.rb +16 -0
  134. data/lib/kamal/secrets/dotenv/inline_command_substitution.rb +47 -0
  135. data/lib/kamal/secrets.rb +53 -0
  136. data/lib/kamal/sshkit_with_ext.rb +273 -0
  137. data/lib/kamal/tags.rb +40 -0
  138. data/lib/kamal/utils/sensitive.rb +20 -0
  139. data/lib/kamal/utils.rb +110 -0
  140. data/lib/kamal/version.rb +3 -0
  141. data/lib/kamal.rb +15 -0
  142. metadata +388 -0
@@ -0,0 +1,228 @@
1
+ # Kamal Configuration
2
+ #
3
+ # Configuration is read from the `config/deploy.yml`.
4
+
5
+ # Destinations
6
+ #
7
+ # When running commands, you can specify a destination with the `-d` flag,
8
+ # e.g., `kamal deploy -d staging`.
9
+ #
10
+ # In this case, the configuration will also be read from `config/deploy.staging.yml`
11
+ # and merged with the base configuration.
12
+
13
+ # Extensions
14
+ #
15
+ # Kamal will not accept unrecognized keys in the configuration file.
16
+ #
17
+ # However, you might want to declare a configuration block using YAML anchors
18
+ # and aliases to avoid repetition.
19
+ #
20
+ # You can prefix a configuration section with `x-` to indicate that it is an
21
+ # extension. Kamal will ignore the extension and not raise an error.
22
+
23
+ # The service name
24
+ #
25
+ # This is a required value. It is used as the container name prefix.
26
+ service: myapp
27
+
28
+ # The Docker image name
29
+ #
30
+ # The image will be pushed to the configured registry.
31
+ image: my-image
32
+
33
+ # Labels
34
+ #
35
+ # Additional labels to add to the container:
36
+ labels:
37
+ my-label: my-value
38
+
39
+ # Volumes
40
+ #
41
+ # Additional volumes to mount into the container:
42
+ volumes:
43
+ - /path/on/host:/path/in/container:ro
44
+
45
+ # Registry
46
+ #
47
+ # The Docker registry configuration, see kamal docs registry:
48
+ registry:
49
+ ...
50
+
51
+ # Servers
52
+ #
53
+ # The servers to deploy to, optionally with custom roles, see kamal docs servers:
54
+ servers:
55
+ ...
56
+
57
+ # Environment variables
58
+ #
59
+ # See kamal docs env:
60
+ env:
61
+ ...
62
+
63
+ # Asset path
64
+ #
65
+ # Used for asset bridging across deployments, default to `nil`.
66
+ #
67
+ # If there are changes to CSS or JS files, we may get requests
68
+ # for the old versions on the new container, and vice versa.
69
+ #
70
+ # To avoid 404s, we can specify an asset path.
71
+ # Kamal will replace that path in the container with a mapped
72
+ # volume containing both sets of files.
73
+ # This requires that file names change when the contents change
74
+ # (e.g., by including a hash of the contents in the name).
75
+ #
76
+ # To configure this, set the path to the assets.
77
+ #
78
+ # You can also specify mount options after a colon, such as `ro` for read-only
79
+ # or `z`/`Z` for SELinux labels
80
+ asset_path: /path/to/assets
81
+
82
+ # Hooks path
83
+ #
84
+ # Path to hooks, defaults to `.kamal/hooks`.
85
+ # See https://kamal-deploy.org/docs/hooks for more information:
86
+ hooks_path: /user_home/kamal/hooks
87
+
88
+ # Hook output
89
+ #
90
+ # Hook output visibility. Can be set globally or per-hook.
91
+ # CLI flags (`-v`, `-q`) override these settings.
92
+ #
93
+ # - `:quiet` - hook output is hidden
94
+ # - `:verbose` - hook output is shown
95
+ #
96
+ # With no setting, hook output follows CLI verbosity flags.
97
+ #
98
+ # Note: Failed hooks always show output in the error message regardless of setting.
99
+ #
100
+ # Global setting for all hooks:
101
+ hooks_output: :verbose
102
+ # Or per-hook settings:
103
+ hooks_output:
104
+ pre-deploy: :verbose
105
+ pre-build: :quiet
106
+
107
+ # Secrets path
108
+ #
109
+ # Path to secrets, defaults to `.kamal/secrets`.
110
+ # Kamal looks for `<secrets_path>-common` first and then `<secrets_path>`.
111
+ # When using destinations, it instead looks for `<secrets_path>-common` first and then
112
+ # `<secrets_path>.<destination>`. Later files override earlier ones.
113
+ secrets_path: /user_home/kamal/secrets
114
+
115
+ # Error pages
116
+ #
117
+ # A directory relative to the app root to find error pages for the proxy to serve.
118
+ # Name each page after the HTTP status code it serves, e.g. 404.html, 500.html,
119
+ # 502.html, 503.html, and 504.html.
120
+ error_pages_path: public
121
+
122
+ # Require destinations
123
+ #
124
+ # Whether deployments require a destination to be specified, defaults to `false`:
125
+ require_destination: true
126
+
127
+ # Primary role
128
+ #
129
+ # This defaults to `web`, but if you have no web role, you can change this:
130
+ primary_role: workers
131
+
132
+ # Allowing empty roles
133
+ #
134
+ # Whether roles with no servers are allowed. Defaults to `false`:
135
+ allow_empty_roles: false
136
+
137
+ # Retain containers
138
+ #
139
+ # How many old containers and images we retain, defaults to 5:
140
+ retain_containers: 3
141
+
142
+ # Minimum version
143
+ #
144
+ # The minimum version of Kamal required to deploy this configuration, defaults to `nil`:
145
+ minimum_version: 1.3.0
146
+
147
+ # Readiness delay
148
+ #
149
+ # Seconds to wait for a container to boot after it is running, default 7.
150
+ #
151
+ # This only applies to containers that do not run a proxy or specify a healthcheck:
152
+ readiness_delay: 4
153
+
154
+ # Deploy timeout
155
+ #
156
+ # How long to wait for a container to become ready, default 30:
157
+ deploy_timeout: 10
158
+
159
+ # Drain timeout
160
+ #
161
+ # How long to wait for a container to drain, default 30:
162
+ drain_timeout: 10
163
+
164
+ # Stop timeout
165
+ #
166
+ # How long to wait for a container to stop after SIGTERM, default is
167
+ # the drain_timeout for non-proxied roles and 10s (Docker default) for proxied roles.
168
+ # Can be overridden per role:
169
+ stop_timeout: 30
170
+
171
+ # Run directory
172
+ #
173
+ # Directory to store kamal runtime files in on the host, default `.kamal`:
174
+ run_directory: /etc/kamal
175
+
176
+ # SSH options
177
+ #
178
+ # See kamal docs ssh:
179
+ ssh:
180
+ ...
181
+
182
+ # Builder options
183
+ #
184
+ # See kamal docs builder:
185
+ builder:
186
+ ...
187
+
188
+ # Accessories
189
+ #
190
+ # Additional services to run in Docker, see kamal docs accessory:
191
+ accessories:
192
+ ...
193
+
194
+ # Proxy
195
+ #
196
+ # Configuration for kamal-proxy, see kamal docs proxy:
197
+ proxy:
198
+ ...
199
+
200
+ # SSHKit
201
+ #
202
+ # See kamal docs sshkit:
203
+ sshkit:
204
+ ...
205
+
206
+ # Boot options
207
+ #
208
+ # See kamal docs boot:
209
+ boot:
210
+ ...
211
+
212
+ # Logging
213
+ #
214
+ # Docker logging configuration, see kamal docs logging:
215
+ logging:
216
+ ...
217
+
218
+ # Output
219
+ #
220
+ # Configure output loggers (OTel, file), see kamal docs output:
221
+ output:
222
+ ...
223
+
224
+ # Aliases
225
+ #
226
+ # Alias configuration, see kamal docs alias:
227
+ aliases:
228
+ ...
@@ -0,0 +1,118 @@
1
+ # Environment variables
2
+ #
3
+ # Environment variables can be set directly in the Kamal configuration or
4
+ # read from `.kamal/secrets`.
5
+
6
+ # Reading environment variables from the configuration
7
+ #
8
+ # Environment variables can be set directly in the configuration file.
9
+ #
10
+ # These are passed to the `docker run` command when deploying.
11
+ env:
12
+ DATABASE_HOST: mysql-db1
13
+ DATABASE_PORT: 3306
14
+
15
+ # Secrets
16
+ #
17
+ # Kamal uses dotenv to automatically load environment variables from the configured secrets files.
18
+ #
19
+ # Common secrets across all destinations can be set in `.kamal/secrets-common`. Kamal looks for
20
+ # `.kamal/secrets-common` first, then `.kamal/secrets`, with later values overriding earlier ones.
21
+ #
22
+ # If you are using destinations, Kamal looks for `.kamal/secrets-common` first, then
23
+ # `.kamal/secrets.<destination>`. The non-destination `.kamal/secrets` file is not read when a
24
+ # destination is selected.
25
+ #
26
+ # This file can be used to set variables like `KAMAL_REGISTRY_PASSWORD` or database passwords.
27
+ # You can use variable or command substitution in the secrets file.
28
+ #
29
+ # ```shell
30
+ # KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
31
+ # RAILS_MASTER_KEY=$(cat config/master.key)
32
+ # ```
33
+ #
34
+ # You can also use [secret helpers](../../commands/secrets) for some common password managers.
35
+ #
36
+ # ```shell
37
+ # SECRETS=$(kamal secrets fetch ...)
38
+ #
39
+ # REGISTRY_PASSWORD=$(kamal secrets extract REGISTRY_PASSWORD $SECRETS)
40
+ # DB_PASSWORD=$(kamal secrets extract DB_PASSWORD $SECRETS)
41
+ # ```
42
+ #
43
+ # If you store secrets directly in `.kamal/secrets`, ensure that it is not checked into version control.
44
+ #
45
+ # To pass the secrets, you should list them under the `secret` key. When you do this, the
46
+ # other variables need to be moved under the `clear` key.
47
+ #
48
+ # Unlike clear values, secrets are not passed directly to the container
49
+ # but are stored in an env file on the host:
50
+ env:
51
+ clear:
52
+ DB_USER: app
53
+ secret:
54
+ - DB_PASSWORD
55
+
56
+ # Aliased secrets
57
+ #
58
+ # You can also alias secrets to other secrets using a `:` separator.
59
+ #
60
+ # This is useful when the ENV name is different from the secret name. For example, if you have two
61
+ # places where you need to define the ENV variable `DB_PASSWORD`, but the value is different depending
62
+ # on the context.
63
+ #
64
+ # ```shell
65
+ # SECRETS=$(kamal secrets fetch ...)
66
+ #
67
+ # MAIN_DB_PASSWORD=$(kamal secrets extract MAIN_DB_PASSWORD $SECRETS)
68
+ # SECONDARY_DB_PASSWORD=$(kamal secrets extract SECONDARY_DB_PASSWORD $SECRETS)
69
+ # ```
70
+ env:
71
+ secret:
72
+ - DB_PASSWORD:MAIN_DB_PASSWORD
73
+ tags:
74
+ secondary_db:
75
+ secret:
76
+ - DB_PASSWORD:SECONDARY_DB_PASSWORD
77
+ accessories:
78
+ main_db_accessory:
79
+ env:
80
+ secret:
81
+ - DB_PASSWORD:MAIN_DB_PASSWORD
82
+ secondary_db_accessory:
83
+ env:
84
+ secret:
85
+ - DB_PASSWORD:SECONDARY_DB_PASSWORD
86
+
87
+ # Tags
88
+ #
89
+ # Tags are used to add extra env variables to specific hosts.
90
+ # See kamal docs servers for how to tag hosts.
91
+ #
92
+ # Tags are only allowed in the top-level env configuration (i.e., not under a role-specific env).
93
+ #
94
+ # The env variables can be specified with secret and clear values as explained above.
95
+ env:
96
+ tags:
97
+ <tag1>:
98
+ MYSQL_USER: monitoring
99
+ <tag2>:
100
+ clear:
101
+ MYSQL_USER: readonly
102
+ secret:
103
+ - MYSQL_PASSWORD
104
+
105
+ # Example configuration
106
+ env:
107
+ clear:
108
+ MYSQL_USER: app
109
+ secret:
110
+ - MYSQL_PASSWORD
111
+ tags:
112
+ monitoring:
113
+ MYSQL_USER: monitoring
114
+ replica:
115
+ clear:
116
+ MYSQL_USER: readonly
117
+ secret:
118
+ - READONLY_PASSWORD
@@ -0,0 +1,21 @@
1
+ # Custom logging configuration
2
+ #
3
+ # Set these to control the Docker logging driver and options.
4
+
5
+ # Logging settings
6
+ #
7
+ # These go under the logging key in the configuration file.
8
+ #
9
+ # This can be specified at the root level or for a specific role.
10
+ logging:
11
+
12
+ # Driver
13
+ #
14
+ # The logging driver to use, passed to Docker via `--log-driver`:
15
+ driver: json-file
16
+
17
+ # Options
18
+ #
19
+ # Any logging options to pass to the driver, passed to Docker via `--log-opt`:
20
+ options:
21
+ max-size: 100m
@@ -0,0 +1,25 @@
1
+ # Output
2
+ #
3
+ # Configure where Kamal sends command output logs.
4
+
5
+ # Output options
6
+ #
7
+ # The options are specified under the output key in the configuration file.
8
+ output:
9
+
10
+ # OTel
11
+ #
12
+ # Ship deploy logs to an OpenTelemetry-compatible endpoint via OTLP HTTP.
13
+ #
14
+ # Logs are sent as OTLP log records with resource attributes derived from
15
+ # Kamal's deploy tags (service, version, performer, destination, etc.)
16
+ otel:
17
+ endpoint: http://otel-gateway:4318
18
+
19
+ # File
20
+ #
21
+ # Write deploy logs to a file on the local machine.
22
+ #
23
+ # One log file is created per deploy, named with the timestamp and command.
24
+ file:
25
+ path: /var/log/kamal/
@@ -0,0 +1,207 @@
1
+ # Proxy
2
+ #
3
+ # Kamal uses [kamal-proxy](https://github.com/basecamp/kamal-proxy) to provide
4
+ # gapless deployments. It runs on ports 80 and 443 and forwards requests to the
5
+ # application container.
6
+ #
7
+ # The proxy is configured in the root configuration under `proxy`. These are
8
+ # options that are set when deploying the application, not when booting the proxy.
9
+ #
10
+ # They are application-specific, so they are not shared when multiple applications
11
+ # run on the same proxy.
12
+ #
13
+ proxy:
14
+
15
+ # Hosts
16
+ #
17
+ # The hosts that will be used to serve the app. The proxy will only route requests
18
+ # to this host to your app.
19
+ #
20
+ # If no hosts are set, then all requests will be forwarded, except for matching
21
+ # requests for other apps deployed on that server that do have a host set.
22
+ #
23
+ # Specify one of `host` or `hosts`.
24
+ host: foo.example.com
25
+ hosts:
26
+ - foo.example.com
27
+ - bar.example.com
28
+
29
+ # Loadbalancer
30
+ #
31
+ # Specify a host to run the loadbalancer on. The loadbalancer will distribute requests
32
+ # to all web hosts. If not specified but multiple web hosts are configured, the first
33
+ # web host will be used as the loadbalancer host.
34
+ loadbalancer: lb.example.com
35
+
36
+ # App port
37
+ #
38
+ # The port the application container is exposed on.
39
+ #
40
+ # Defaults to 80:
41
+ app_port: 3000
42
+
43
+ # SSL
44
+ #
45
+ # kamal-proxy can provide automatic HTTPS for your application via Let's Encrypt.
46
+ #
47
+ # This requires that we are deploying to one server and the host option is set.
48
+ # The host value must point to the server we are deploying to, and port 443 must be
49
+ # open for the Let's Encrypt challenge to succeed.
50
+ #
51
+ # If you set `ssl` to `true`, `kamal-proxy` will stop forwarding headers to your app,
52
+ # unless you explicitly set `forward_headers: true`
53
+ #
54
+ # Defaults to `false`:
55
+ ssl: true
56
+
57
+ # Custom SSL certificate
58
+ #
59
+ # In some cases, using Let's Encrypt for automatic certificate management is not an
60
+ # option, for example if you are running from more than one host.
61
+ #
62
+ # Or you may already have SSL certificates issued by a different Certificate Authority (CA).
63
+ #
64
+ # Kamal supports loading custom SSL certificates directly from secrets. You should
65
+ # pass a hash mapping the `certificate_pem` and `private_key_pem` to the secret names.
66
+ ssl:
67
+ certificate_pem: CERTIFICATE_PEM
68
+ private_key_pem: PRIVATE_KEY_PEM
69
+ # ### Notes
70
+ # - If the certificate or key is missing or invalid, deployments will fail.
71
+ # - Always handle SSL certificates and private keys securely. Avoid hard-coding them in source control.
72
+
73
+ # SSL redirect
74
+ #
75
+ # By default, kamal-proxy will redirect all HTTP requests to HTTPS when SSL is enabled.
76
+ # If you prefer that HTTP traffic is passed through to your application (along with
77
+ # HTTPS traffic), you can disable this redirect by setting `ssl_redirect: false`:
78
+ ssl_redirect: false
79
+
80
+ # Forward headers
81
+ #
82
+ # Whether to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers.
83
+ #
84
+ # If you are behind a trusted proxy, you can set this to `true` to forward the headers.
85
+ #
86
+ # By default, kamal-proxy will not forward the headers if the `ssl` option is set to `true`, and
87
+ # will forward them if it is set to `false`.
88
+ forward_headers: true
89
+
90
+ # Response timeout
91
+ #
92
+ # How long to wait for requests to complete before timing out, defaults to 30 seconds:
93
+ response_timeout: 10
94
+
95
+ # Path-based routing
96
+ #
97
+ # For applications that split their traffic to different services based on the request path,
98
+ # you can use path-based routing to mount services under different path prefixes.
99
+ # Usage sample: path_prefix: '/api'
100
+ #
101
+ # You can also specify multiple paths in two ways.
102
+ #
103
+ # When using path_prefix you can supply multiple routes separated by commas.
104
+ path_prefix: "/api,/oauth_callback"
105
+ # You can also specify paths as a list of paths, the configuration will be
106
+ # rolled together into a comma separated string.
107
+ path_prefixes:
108
+ - "/api"
109
+ - "/oauth_callback"
110
+ # By default, the path prefix will be stripped from the request before it is forwarded upstream.
111
+ #
112
+ # So in the example above, a request to /api/users/123 will be forwarded to web-1 as /users/123.
113
+ #
114
+ # To instead forward the request with the original path (including the prefix),
115
+ # specify --strip-path-prefix=false
116
+ strip_path_prefix: false
117
+
118
+ # Healthcheck
119
+ #
120
+ # When deploying, the proxy will by default hit `/up` once every second until we hit
121
+ # the deploy timeout, with a 5-second timeout for each request.
122
+ #
123
+ # Once the app is up, the proxy will stop hitting the healthcheck endpoint.
124
+ healthcheck:
125
+ interval: 3
126
+ path: /health
127
+ timeout: 3
128
+
129
+ # Buffering
130
+ #
131
+ # Whether to buffer request and response bodies in the proxy.
132
+ #
133
+ # By default, buffering is enabled with a max request body size of 1GB and no limit
134
+ # for response size.
135
+ #
136
+ # You can also set the memory limit for buffering, which defaults to 1MB; anything
137
+ # larger than that is written to disk.
138
+ buffering:
139
+ requests: true
140
+ responses: true
141
+ max_request_body: 40_000_000
142
+ max_response_body: 0
143
+ memory: 2_000_000
144
+
145
+ # Logging
146
+ #
147
+ # Configure request logging for the proxy.
148
+ # You can specify request and response headers to log.
149
+ # By default, `Cache-Control`, `Last-Modified`, and `User-Agent` request headers are logged:
150
+ logging:
151
+ request_headers:
152
+ - Cache-Control
153
+ - X-Forwarded-Proto
154
+ response_headers:
155
+ - X-Request-ID
156
+ - X-Request-Start
157
+
158
+ # Run configuration
159
+ #
160
+ # These options are used when booting the proxy container.
161
+ #
162
+ run:
163
+ http_port: 8080 # HTTP port to use (default 80)
164
+ https_port: 8443 # HTTPS port to use (default 443)
165
+ metrics_port: 9090 # Port for Prometheus metrics
166
+ debug: true # Debug logging (default: false)
167
+ log_max_size: "30m" # Maximum log file size (default: "10m")
168
+ publish: false # Publish ports to the host (default: true)
169
+ bind_ips: # List of IPs to bind to when publishing ports
170
+ - 0.0.0.0
171
+ registry: registry:4443 # Container registry for the kamal-proxy image
172
+ # (defaults to Docker Hub)
173
+ repository: myrepo/kamal-proxy # Container repository for the kamal-proxy image
174
+ # (defaults to `ghcr.io/mhenrixon/kamal-proxy`)
175
+ version: v0.8.0 # Version tag of the kamal-proxy image to use
176
+ options: # Additional options to pass to `docker run`
177
+ label:
178
+ - custom.label=kamal-proxy
179
+ memory: 512m
180
+ cpus: 0.5
181
+
182
+ # Enabling/disabling the proxy on roles
183
+ #
184
+ # The proxy is enabled by default on the primary role but can be disabled by
185
+ # setting `proxy: false` in the primary role's configuration.
186
+ #
187
+ # ```yaml
188
+ # servers:
189
+ # web:
190
+ # hosts:
191
+ # - ...
192
+ # proxy: false
193
+ # ```
194
+ #
195
+ # It is disabled by default on all other roles but can be enabled by setting
196
+ # `proxy: true` or providing a proxy configuration for that role.
197
+ #
198
+ # ```yaml
199
+ # servers:
200
+ # web:
201
+ # hosts:
202
+ # - ...
203
+ # web2:
204
+ # hosts:
205
+ # - ...
206
+ # proxy: true
207
+ # ```
@@ -0,0 +1,64 @@
1
+ # Registry
2
+ #
3
+ # The default registry is Docker Hub, but you can change it using `registry/server`.
4
+
5
+ # Using a local container registry
6
+ #
7
+ # If the registry server starts with `localhost`, Kamal will start a local Docker registry
8
+ # on that port and push the app image to it.
9
+ registry:
10
+ server: localhost:5555
11
+
12
+ # Using Docker Hub as the container registry
13
+ #
14
+ # By default, Docker Hub creates public repositories. To avoid making your images public,
15
+ # set up a private repository before deploying, or change the default repository privacy
16
+ # settings to private in your [Docker Hub settings](https://hub.docker.com/repository-settings/default-privacy).
17
+ #
18
+ # A reference to a secret (in this case, `KAMAL_REGISTRY_PASSWORD`) will look up the secret
19
+ # in the local environment:
20
+ registry:
21
+ username:
22
+ - <your docker hub username>
23
+ password:
24
+ - KAMAL_REGISTRY_PASSWORD
25
+
26
+ # Using AWS ECR as the container registry
27
+ #
28
+ # You will need to have the AWS CLI installed locally for this to work.
29
+ # AWS ECR’s access token is only valid for 12 hours. In order to avoid having to manually regenerate the token every time, you can use ERB in the `deploy.yml` file to shell out to the AWS CLI command and obtain the token:
30
+ registry:
31
+ server: <your aws account id>.dkr.ecr.<your aws region id>.amazonaws.com
32
+ username: AWS
33
+ password: <%= %x(aws ecr get-login-password) %>
34
+
35
+ # Using GCP Artifact Registry as the container registry
36
+ #
37
+ # To sign into Artifact Registry, you need to
38
+ # [create a service account](https://cloud.google.com/iam/docs/service-accounts-create#creating)
39
+ # and [set up roles and permissions](https://cloud.google.com/artifact-registry/docs/access-control#permissions).
40
+ # Normally, assigning the `roles/artifactregistry.writer` role should be sufficient.
41
+ #
42
+ # Once the service account is ready, you need to generate and download a JSON key and base64 encode it:
43
+ #
44
+ # ```shell
45
+ # base64 -i /path/to/key.json | tr -d "\\n"
46
+ # ```
47
+ #
48
+ # You'll then need to set the `KAMAL_REGISTRY_PASSWORD` secret to that value.
49
+ #
50
+ # Use the environment variable as the password along with `_json_key_base64` as the username.
51
+ # Here’s the final configuration:
52
+ registry:
53
+ server: <your registry region>-docker.pkg.dev
54
+ username: _json_key_base64
55
+ password:
56
+ - KAMAL_REGISTRY_PASSWORD
57
+
58
+ # Validating the configuration
59
+ #
60
+ # You can validate the configuration by running:
61
+ #
62
+ # ```shell
63
+ # kamal registry login
64
+ # ```