Commit Graph

222 Commits

Author SHA1 Message Date
André Falk 63c47eca4c Trim long hostnames
Hostnames longer than 64 characters are not supported by docker
2024-05-07 19:06:39 +02: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 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 82962c375d Use default verbosity for hooks 2024-04-02 10:47:05 +01: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 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 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 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
Igor Alexandrov cee449c269 Put locks in a locks directory. Ensure that locks directory exits on a primary host. 2024-03-27 12:04:39 +04: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
Evgeny Latyshev 981d391d4d Fix accessory name check in with_accessory 2024-03-26 09:29:34 +03: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
Igor Alexandrov bbf952952d Added -y option to kamal traefik reboot command 2024-03-20 22:00:13 +04: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 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 fa37fcd10c Merge pull request #585 from tsvallender/docker-network
Add docker-setup hook
2024-03-07 10:51:08 +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
Trevor Vallender f69c45b7ea Add docker-setup hook
This allows the user to make any necessary configuration changes to
Docker before setting up any containers, allowing those configuration
changes to take effect from the outset.
2024-03-06 19:01:48 +00:00
Donal McBreen dc5af03593 Update tests to match single quotes 2024-03-06 16:04:31 +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
Aleksandr Nigomatulin 064ace0598 Rollback passing invoke_options 2024-02-24 21:36:20 +06:00
Aleksandr Nigomatulin 5ef384d666 Add test 2024-02-17 00:11:03 +06:00
Aleksandr Nigomatulin b94dfe193b Remove unnecessary code 2024-02-16 12:52:07 +06:00
Aleksandr Nigomatulin bc6c027315 Upds according remarks 2024-02-16 11:56:58 +06:00
Nick Lozon f8d8319c2f better test description 2023-12-12 15:37:12 -05:00
Nick Lozon f6a9d54902 unit test 2023-12-12 15:07:29 -05:00
Donal McBreen 11521517fa Merge pull request #550 from dmitrytrager/feature-name-all-for-accessory-reboot
feature: add NAME=all option for accessory reboot
2023-11-16 08:50:51 +00:00
Yoel Cabo 7472e5dfa6 Merge remote-tracking branch 'origin/main' into feat/no-web 2023-11-14 12:11:18 +01:00
Yoel Cabo 887b7dd46d Do not invoke healthcheck on deploy when no web role 2023-11-14 11:34:32 +01:00
Donal McBreen 80cc0c23d8 Merge pull request #578 from basecamp/enable-yaml-aliases
Enable yaml aliases
2023-11-13 09:28:40 +00:00
Yoel Cabo 87cb8c1f71 fix: allow configurations without web roles 2023-11-12 09:39:07 +01:00
Matthew Kent ed58ce6e61 Add test coverage with aliases. 2023-11-11 17:25:50 -08:00
Matthew Kent 6898e8789e Further test the override. 2023-11-10 17:17:16 -08:00
Donal McBreen 97ba6b746b Merge pull request #564 from basecamp/return-502-if-no-container
Return a 502 when container is down
2023-11-08 14:58:22 +00:00
Leon 2d86d4f7cc Add SSH port to run_over_ssh 2023-11-03 22:32:37 +01:00
Donal McBreen 24a2f51641 Return a 502 when container is down
If the app container is down or not responding then traefik will return
a 404 response code. This is not ideal as it suggests a client rather
than a server problem.

To fix this, we'll define a catch all route that always returns a 502.

This is not ideal as this route would take priority over a shorter route
with priorty 1.

TODO: up the priority of the app route.
2023-11-03 14:20:52 +00:00
dmitrytrager 2d22143a24 feature: add NAME=all option for accessory reboot 2023-10-31 00:13:45 +01:00
Aleksandr Nigomatulin cbd99306eb Add skip_push option to setup 2023-10-30 23:27:58 +06:00
Donal McBreen b732b2dd55 Merge pull request #547 from nickhammond/envify/trim-lines
Enable trim mode with ERB
2023-10-30 08:57:55 +00:00
Donal McBreen e9269d2ee8 Merge pull request #501 from rience/optional-envify-push
Optionally Skip Push for "envify"
2023-10-30 08:30:21 +00:00
Donal McBreen d2214b43b7 Merge pull request #499 from basecamp/env-only-needed-for-push
Remove the env check
2023-10-30 08:22:56 +00:00
Donal McBreen 370481921e Merge pull request #498 from basecamp/app-exec-env-file
App exec with env file
2023-10-30 08:22:35 +00:00
Nick Hammond 6c36c82153 Enable trim mode with ERB 2023-10-24 17:09:05 -07:00
Krzysztof Adamski 8ca04032a1 Optionally Skip Push for "envify" 2023-10-23 14:49:39 +02:00
Donal McBreen f6662c7a8f Remove the env check
The env check is not needded anymore as all the commands rely on the
env files having already been created remotely.

The only place the env is needed is when running `kamal env push` and
that will still raise an apropriate error.
2023-09-25 15:23:01 +01:00
Donal McBreen 645f5ab72d App exec with env file
When calling `kamal app exec` for new non interactive containers, run
the command per role on each server and include the role config
including the environment.

Fixes: https://github.com/basecamp/kamal/issues/492
2023-09-25 15:07:05 +01:00
Nick Pezza 1a2796a7d0 Loosen superuser check to match docker-installs script check 2023-09-18 20:32:59 -04:00
Donal McBreen 0861730e0e Run interactive commands with the correct host
Fixes https://github.com/basecamp/kamal/issues/430
2023-09-18 12:00:36 +01:00