Donal McBreen
448349d0e5
Merge pull request #812 from basecamp/sshkit-1.22.2-minimum
...
Set sshkit minimum version to 1.22.2
2024-05-20 10:39:17 +01:00
Donal McBreen
b6dba57c7d
Set sshkit minimum version to 1.22.2
...
This includes a fix for a bug in the eviction thread that could cause
this error:
```
[ERROR (IOError): Exception while executing on host foo: closed stream]
```
See https://github.com/capistrano/sshkit/pull/534
2024-05-20 10:06:53 +01:00
Donal McBreen
88947b6a7b
Merge pull request #805 from basecamp/env-under-tags
...
Move env_tags under env key
2024-05-15 11:09:47 +01:00
Donal McBreen
f48c227768
Move env_tags under env key
...
Instead of:
```
env:
CLEAR_TAG: untagged
env_tags:
tag1:
CLEAR_TAG: tagged
```
We'll have:
```
env:
clear:
CLEAR_TAG: untagged
tags:
tag1:
CLEAR_TAG: tagged
```
2024-05-15 10:19:22 +01:00
Donal McBreen
12cad5458a
Merge pull request #762 from kryachkov/main
...
Trim long hostnames
2024-05-10 16:05:27 +01:00
Donal McBreen
f8b7f74543
Merge pull request #786 from hundredwatt/add-target-option-to-builder
...
Add --target option to Builder to support multi-stage Docker builds
2024-05-10 15:15:31 +01:00
Donal McBreen
489d6dbcbb
Merge pull request #789 from basecamp/host-tags
...
Host specific env with tags
2024-05-10 08:08:29 +01:00
Donal McBreen
6d062ce271
Host specific env with tags
...
Allow hosts to be tagged so we can have host specific env variables.
We might want host specific env variables for things like datacenter
specific tags or testing GC settings on a specific host.
Right now you either need to set up a separate role, or have the app
be host aware.
Now you can define tag env variables and assign those to hosts.
For example:
```
servers:
- 1.1.1.1
- 1.1.1.2: tag1
- 1.1.1.2: tag2
- 1.1.1.3: [ tag1, tag2 ]
env_tags:
tag1:
ENV1: value1
tag2:
ENV2: value2
```
The tag env supports the full env format, allowing you to set secret and
clear values.
2024-05-09 16:02:45 +01:00
Donal McBreen
3c8428504d
Bump version for 1.5.2
2024-05-07 09:44:11 +01:00
Donal McBreen
8e71c48747
Merge pull request #759 from basecamp/details-accessory-host
...
Output the host when running accessory details
2024-05-02 15:54:08 +01:00
Donal McBreen
67a86e1068
Merge pull request #790 from basecamp/warn-on-missing-builder
...
Warn on missing builder
2024-05-02 12:50:00 +01:00
Donal McBreen
b67f40bdf7
Warn on missing builder
...
We are going to try to create a builder if one is missing, so let's warn
rather than report it as an error.
2024-05-02 12:38:20 +01:00
Donal McBreen
375f0283c4
Merge pull request #785 from basecamp/filter-traefik-hosts
...
Apply --hosts and --roles filters to traefik hosts as well
2024-04-29 14:48:23 +01:00
Donal McBreen
f48f528043
Bump version for 1.5.1
2024-04-26 14:26:02 +01:00
Donal McBreen
ec0a082542
Merge pull request #779 from basecamp/fix-log-following
...
Escape single quotes to fix log following
2024-04-26 14:25:27 +01:00
Donal McBreen
6c638a8a77
Merge pull request #778 from basecamp/glob-match-roles-and-hosts
...
Allow glob matches for roles and hosts
2024-04-26 14:20:17 +01:00
Donal McBreen
1f5b936fa2
Escape single quotes to fix log following
...
Fixes: https://github.com/basecamp/kamal/issues/777
2024-04-26 14:16:19 +01:00
Donal McBreen
f785451cc7
Allow glob matches for roles and hosts
...
This lets you do things like:
```
kamal details -h '1.1.1.[1-9]'
kamal details -r 'w{eb,orkers}'
```
2024-04-26 13:43:52 +01:00
Donal McBreen
d475e88dbe
Bump version for 1.5.0
2024-04-25 13:39:06 +01:00
Donal McBreen
d551f044d6
Merge pull request #772 from aishek/take-accessory-hosts-into-account
...
Take accessory hosts into account for --hosts
2024-04-25 11:57:45 +01:00
Donal McBreen
2611179d5e
Merge pull request #773 from xiaohui-zhangxh/docker-env-file-keep-non-ascii
...
don't escape non-ascii characters in docker env file
2024-04-25 11:57:14 +01:00
Donal McBreen
1a013b8d4b
Merge pull request #770 from ttilberg/769-ensure-valid-service-name-with-capital-letters
...
Allow capital letters to match valid service name, such as in MyApp
2024-04-25 11:52:55 +01:00
Donal McBreen
e6d436f646
Output the host when running accessory details
...
We already do this for app and Traefik hosts.
2024-04-05 12:46:51 +01:00
Donal McBreen
31669d4dce
Merge pull request #758 from basecamp/any-runtime-in-test
...
Accept any runtime in the hook tests
2024-04-03 16:27:59 +01:00
Donal McBreen
9d20c1466e
Merge pull request #757 from basecamp/executable-sample-docker-setup-hook
...
Make the sample docker setup hook executable
2024-04-03 16:12:46 +01:00
Donal McBreen
ff1dabe7f8
Merge pull request #756 from basecamp/tidy-up-role-host-setup
...
Tidy up role and host commander setup
2024-04-03 16:09:12 +01:00
Donal McBreen
69aa422890
Accept any runtime in the hook tests
...
Occasionally in CI things run slowly and it takes more that 1 second
for a cli test to run, so let's allow any value for the runtime in the
hook checks.
2024-04-03 16:06:53 +01:00
Donal McBreen
f8b0883036
Make the sample docker setup hook executable
...
Fixes https://github.com/basecamp/kamal/issues/754
2024-04-03 15:50:47 +01:00
Donal McBreen
c8100d1f26
Tidy up role and host commander setup
...
Extract Kamal::Commander::Specifics to deal with host and role setup and
ensure that primary hosts and roles always come first. This means that
in a rolling deploy we deploy to the primary ones first.
This will be important when we remove the healthcheck step as we want
to confirm the primary host can be deployed to before completing a
deployment for other roles.
By setting the hosts and roles all together in one place we can sort
the primary ones to the front without creating infinite loops.
2024-04-03 15:46:30 +01:00
Donal McBreen
3628ecaa44
Merge pull request #753 from basecamp/dump-hook-output-on-failure
...
Include error message on failure
2024-04-03 10:52:49 +01:00
Donal McBreen
67a2d5e7ca
Include error message on failure
2024-04-03 10:43:20 +01:00
Donal McBreen
5e492ecc4d
Merge pull request #748 from basecamp/latest-by-tag
...
Latest by tag
2024-04-03 09:11:03 +01:00
Donal McBreen
77bad291a1
Merge pull request #751 from basecamp/app-exec-env
...
Set env variables when running kamal app exec
2024-04-02 11:03:38 +01:00
Donal McBreen
a0ce9f66c4
Merge pull request #752 from basecamp/dont-debug-hooks
...
Use default verbosity for hooks
2024-04-02 11:03:24 +01:00
Donal McBreen
82962c375d
Use default verbosity for hooks
2024-04-02 10:47:05 +01:00
Donal McBreen
8a6a51977f
Set env variables when running kamal app exec
...
Allow additional env variable to be set when running `kamal app exec`.
Works for both new and existing containers.
2024-04-01 15:01:32 +01:00
Donal McBreen
2562853ae3
Merge pull request #746 from igor-alexandrov/file-join
...
Replaced string interpolations with File.join to build paths
2024-03-29 13:47:24 +00:00
Donal McBreen
ed90b99f0d
Add tag_latest_image tests
2024-03-29 10:51:57 +00:00
Donal McBreen
ba7a13f895
Only tag after deploying to all hosts
2024-03-29 10:29:58 +00:00
Donal McBreen
05ac808f2a
Use image tag to determine stale containers
...
Use current_running_version to determine the latest version when finding
stale containers.
2024-03-29 10:23:50 +00:00
Donal McBreen
fb7d9077ff
Use latest tag for the current destination
2024-03-29 09:48:09 +00:00
Donal McBreen
bade195e93
Redefine what the "latest" container means
...
Currently the latest container is the one that was created last. But if
we have had a failed deployment that left two containers running that
would not be the one we want. The second container could be in a
restart loop for example.
Instead we want the container that is running the image tagged as
latest. As we now tag as latest after a successful deployment we can
trust that that is a healthy container.
In the case that there is no container running the latest image tag,
we'll fall back to the latest container.
This could happen if the deploy was halted in between the old container
being stopped and the image being tagged as latest.
2024-03-29 08:51:50 +00:00
Donal McBreen
55dd2f49c1
Tag image after booting and include destination
...
If you are deploying more than one destination to a host, the latest
tags will conflict, so we'll append the destination to the tag.
The latest tag is used when booting the app or exec-ing a new container.
If a deploy doesn't complete on a host for all roles then we should
probably not be using it, so move the tagging to the end of the boot
process.
2024-03-29 08:51:50 +00:00
Donal McBreen
8bb596e216
Merge pull request #741 from igor-alexandrov/destination_in_lock
...
Added destination to the lock directory
2024-03-28 08:26:57 +00:00
Donal McBreen
6aacd1f9e2
Merge pull request #745 from basecamp/add-empty-destination-label
...
Label containers with empty destinations
2024-03-27 15:05:43 +00:00
Donal McBreen
20e71d91c0
Label containers with empty destinations
...
This will allow us to filter for containers that have no destination in
cases where we deploy an empty + a non empty destination to the same
host.
To note:
```
\# Containers with a destination label
$ docker ps --filter label=destination
\# Containers with an empty destination label
$ docker ps --filter label=destination=
```
2024-03-27 14:48:55 +00:00
Donal McBreen
866303a59b
Merge pull request #700 from basecamp/git-archive-build
...
Build from a git archive
2024-03-27 09:23:00 +00:00
Donal McBreen
53bfefeb2f
Make building from a git archive the default
...
If no context is specified and we are in a git repo, then we'll build
from a git archive by default. This means we don't need a separate
setting and gives us a safer default build.
2024-03-27 08:42:10 +00:00
Donal McBreen
f3b7569032
Build from a git archive
...
Building directly from a checkout will pull in uncommitted files to or
more sneakily files that are git ignored, but not docker ignored.
To avoid this, we'll add an option to build from a git archive of HEAD
instead. Docker doesn't provide a way to build directly from a git
repo, so instead we create a tarball of the current HEAD with git
archive and pipe it into the build command.
When building from a git archive, we'll still display the warning about
uncommitted changes, but we won't add the `_uncommitted_...` suffix to
the container name as they won't be included in the build.
Perhaps this should be the default, but we'll leave that decision for
now.
2024-03-27 08:38:56 +00:00
Donal McBreen
e5457cf7b4
Merge pull request #736 from tiramizoo/traefik-info
...
Add tip how to apply changes to traefik by "traefik reboot"
2024-03-27 08:38:15 +00:00
Donal McBreen
786454f2ee
Merge pull request #502 from latyshev/main
...
Fix accessory name checking that is passing to command `kamal accessory`
2024-03-26 13:58:26 +00:00
Donal McBreen
827e18480d
Merge pull request #732 from basecamp/always-send-clear-env
...
Always send the clear env to the container
2024-03-26 11:01:59 +00:00
Donal McBreen
9f9c9ccbde
Merge pull request #742 from igor-alexandrov/remove_service_role_dest
...
Removed unused method from Kamal::Commands::App
2024-03-26 08:10:36 +00:00
Donal McBreen
5481fbb973
Test that we pull in env host variables
...
Now that clear env variables specified on the command line we can check
that values specified as `${VAR}` are pulled in from the host.
2024-03-25 12:26:37 +00:00
Donal McBreen
49afdbb09a
Always send the clear env to the container
...
Secret and clear env variables have different lifecycles. The clear ones
are part of the repo, so it makes sense to always deploy them with the
rest of the repo.
The secret ones are external so we can't be sure that they are up to
date, therefore they require an explicit push via `envify` or `env push`.
We'll keep the env file, but now it just contains secrets. The clear
values are passed directly to `docker run`.
2024-03-25 11:42:27 +00:00
Donal McBreen
5f58575b62
Merge pull request #730 from igor-alexandrov/confirming_dialogs
...
Added -y option to kamal traefik reboot command
2024-03-22 15:14:44 +00:00
Donal McBreen
ea9f8b488d
Merge pull request #735 from basecamp/extract-app-boot-steps
...
Extract app boot steps
2024-03-22 09:35:04 +00:00
Donal McBreen
83472af32c
Merge pull request #734 from basecamp/rubocop-rails-omakase
...
Switch to rubocop-rails-omakase rubocop rules
2024-03-22 09:33:25 +00:00
Donal McBreen
e99e1955b8
Extract app boot steps
...
The Kamal::Cli::App#boot has a lot to do, so extract the steps to make
things clearer.
2024-03-22 09:21:52 +00:00
Donal McBreen
30e0c44396
Switch to rubocop-rails-omakase rubocop rules
...
No code changes required
2024-03-21 13:47:20 +00:00
Donal McBreen
20d6e5365e
Merge pull request #733 from basecamp/integration-test-roles
...
Integration test roles
2024-03-21 13:43:33 +00:00
Donal McBreen
72ace2bf0b
Add an integration test for roles
...
Add an app with roles to the integration tests. We'll deploy two web
containers and one worker. The worker just sleeps, so we are testing
that the container has booted.
2024-03-21 13:30:53 +00:00
Donal McBreen
ba40d026d0
Make integration test app to deploy configurable
2024-03-21 12:09:59 +00:00
Donal McBreen
474b76cf47
Merge pull request #701 from basecamp/rubocop
...
Add Rubocop
2024-03-20 10:59:35 +00:00
Donal McBreen
3ecfb3744f
Add Rubocop
...
- Pull in the 37signals house style
- Autofix violations
- Add to CI
2024-03-20 10:23:02 +00:00
Donal McBreen
c985fa33d1
Bump version for 1.4.0
2024-03-20 09:27:23 +00:00
Donal McBreen
e8b9f8907f
Merge pull request #715 from basecamp/use-role-not-string-in-config
...
Pass around Roles instead of Strings
2024-03-08 08:55:53 +00:00
Donal McBreen
4966d52919
Pass around Roles instead of Strings
...
Avoid looking up roles by names everywhere. This avoids the awkward
role/role_config naming as well.
2024-03-08 08:44:35 +00:00
Donal McBreen
52bb40add0
Merge pull request #656 from DanielJackson-Oslo/informative-error-message-on-lock
...
Informative message on lock error
2024-03-07 11:16:18 +00:00
Donal McBreen
73a9276cdd
Fix up app command tests
2024-03-07 11:11:20 +00:00
Donal McBreen
8c0784ed4a
Merge pull request #634 from alhafoudh/main
...
Allow lines option to be configured when following app logs
2024-03-07 11:11:08 +00:00
Donal McBreen
089a2d3bba
Merge pull request #710 from basecamp/install-wget-or-curl
...
Install docker with curl or wget
2024-03-07 11:01:30 +00:00
Donal McBreen
bd76d23916
Merge pull request #593 from CleverFew/role_logging_config
...
Role specific logging configuration
2024-03-07 10:53:34 +00:00
Donal McBreen
fa37fcd10c
Merge pull request #585 from tsvallender/docker-network
...
Add docker-setup hook
2024-03-07 10:51:08 +00:00
Donal McBreen
f5dc0858b0
Update error message to include wget
2024-03-07 10:49:32 +00:00
Donal McBreen
9dddb140b1
Merge pull request #558 from GeNiuS69/add-skip_push-to-setup
...
Add --skip_push option to setup
2024-03-07 10:26:41 +00:00
Donal McBreen
26b1d57c90
Install docker with curl or wget
...
If curl is not available to download the docker install script, try
with wget instead.
If neither is available or both fail, return a simple failing script
so that we don't carry on regardless.
Fixes: https://github.com/basecamp/kamal/issues/395
2024-03-07 10:16:03 +00:00
Donal McBreen
b94199415f
Convert combine by: '||' to any
2024-03-07 09:10:49 +00:00
Donal McBreen
32a2ae5b2c
Merge pull request #708 from nickhammond/valid_service_name
...
Remove warning for valid service name
2024-03-06 16:22:04 +00:00
Donal McBreen
5c32be10f1
Merge pull request #707 from basecamp/boot-strategy-min-limit-1
...
Ensure a minimum limit of 1 for % boot strategy
2024-03-06 16:06:35 +00:00
Donal McBreen
dc5af03593
Update tests to match single quotes
2024-03-06 16:04:31 +00:00
Donal McBreen
1abd029ea0
Merge pull request #696 from dorianmariecom/patch-1
...
Replace \`service\` by 'service' so it doesn't get executed by bash
2024-03-06 16:04:11 +00:00
Donal McBreen
c4d0d3e5eb
Merge pull request #704 from basecamp/escape-registry-username-password
...
Escape the docker registry username and password
2024-03-06 15:58:46 +00:00
Donal McBreen
46e7cf8e78
Merge pull request #706 from basecamp/kamal-remove-noop
...
Ensure `kamal remove` completes without setup
2024-03-06 15:58:34 +00:00
Donal McBreen
c7cfc074b6
Ensure a minimum limit of 1 for % boot strategy
...
Fixes: https://github.com/basecamp/kamal/issues/681
2024-03-06 15:51:35 +00:00
Donal McBreen
c10f43e365
Merge pull request #692 from nickhammond/valid_service_name
...
Add a simple validation to the service name to prevent setup issues
2024-03-06 15:24:39 +00:00
Donal McBreen
8e2184d65e
Ensure kamal remove completes without setup
...
If `kamal setup` has not run or errored out part way through,
`kamal remove` should still complete.
Fixes: https://github.com/basecamp/kamal/issues/629
2024-03-06 14:59:26 +00:00
Donal McBreen
2be397b679
Escape the docker registry username and password
...
Fixes: https://github.com/basecamp/kamal/issues/278
2024-03-06 11:04:55 +00:00
Donal McBreen
cc8c508556
Merge branch 'main' into valid_service_name
2024-03-05 11:02:33 +00:00
Donal McBreen
6563393d9a
Merge pull request #627 from aishek/626-mention-sprockets-config-in-deploy-template
...
Mention Sprockets config in deploy template
2024-03-04 15:31:41 +00:00
Donal McBreen
828cca322b
Merge pull request #650 from basecamp/retained-containers
...
Config the number of containers to keep
2024-03-04 12:05:35 +00:00
Donal McBreen
cb030e8751
Merge pull request #680 from igor-alexandrov/traefik-2.10
...
Bump default Traefik image to 2.10
2024-03-04 11:58:37 +00:00
Donal McBreen
6892abb4be
Config the number of containers to keep
...
By default we keep 5 containers around for rollback. The containers
don't take much space, but the images for them can.
Make the number of containers to retain configurable, either in the
config with the `retain_containers` setting on the command line
with the `--retain` option.
2024-03-04 11:55:45 +00:00
Donal McBreen
bcfd0ca88a
Merge pull request #645 from juan-apa/fix-missing-netscp-require
...
require missing net/scp dependency
2024-03-04 11:49:43 +00:00
Donal McBreen
2e8071a5b3
Merge pull request #608 from CleverFew/fix_accessory_cli_host_params
...
Accessory CLI respects `--hosts`
2024-03-04 11:31:50 +00:00
Donal McBreen
200e2686fd
Merge pull request #506 from rience/custom-acc-service-name
...
Allow for Custom Accessory Service Name
2024-03-04 10:57:10 +00:00
Donal McBreen
db94789dc1
Merge pull request #434 from rience/ssh-agent-support
...
Supports Passing SSH Agent Socket to Build Options
2024-03-04 10:54:47 +00:00
Donal McBreen
aca7796e9d
Bump version for 1.3.1
2024-01-10 08:56:34 +00:00
Donal McBreen
8b6d8306d1
Merge pull request #637 from basecamp/tests-wait-longer-for-health
...
Be a bit more patient during tests
2024-01-09 16:45:28 +00:00
Donal McBreen
bb50546467
Merge pull request #636 from basecamp/tests-clean-known-hosts
...
Fix Net::SSH::HostKeyMismatch between bin/test runs
2024-01-09 16:45:12 +00:00