Commit Graph

1041 Commits

Author SHA1 Message Date
Donal McBreen a72d1f2718 WIP 2023-08-31 09:57:16 +01:00
Donal McBreen 4491867080 Move static config test 2023-08-31 09:52:58 +01:00
Donal McBreen 782b1979ab WIP 2023-08-31 09:44:10 +01:00
Donal McBreen 989d09e027 Copy env files to remote hosts
Setting env variables in the docker arguments requires having them on
the deploy host.

Instead we'll add two new commands `kamal env push` and
`kamal env delete` which will manage copying the environment as .env
files to the remote host.

Docker will pick up the file with `--env-file <path-to-file>`. Env files
will be stored under `<kamal run directory>/env`.

Running `kamal env push` will create env files for each role and
accessory, and traefik if required.

`kamal envify` has been updated to also push the env files.

By avoiding using `kamal envify` and creating the local and remote
secrets manually, you can now avoid accessing secrets needed
for the docker runtime environment locally. You will still need build
secrets.

One thing to note - the Docker doesn't parse the environment variables
in the env file, one result of this is that you can't specify multi-line
values - see https://github.com/moby/moby/issues/12997.

We maybe need to look docker config or docker secrets longer term to get
around this.

Hattip to @kevinmcconnell - this was all his idea.
2023-08-30 17:00:05 +01:00
Donal McBreen 787688ea08 kamal -> .kamal 2023-08-28 17:13:52 +01:00
Donal McBreen bcfa1d83e8 Configurable Kamal directory
To avoid polluting the default SSH directory with lots of Kamal config,
we'll default to putting them in a `kamal` sub directory.

But also make the directory configurable with the `run_directory` key,
so for example you can set it as `/var/run/kamal/`

The directory is created during bootstrap or before any command that
will need to access a file.
2023-08-28 16:32:18 +01:00
David Heinemeier Hansson 9363b6a464 Bump version for 0.16.1 v0.16.1 2023-08-24 09:16:13 -07:00
David Heinemeier Hansson 338fd4e493 Merge pull request #428 from tbuehlmann/main
Fix picking the first available role on primary_host
2023-08-24 08:36:29 -07:00
David Heinemeier Hansson eb3cb81a79 Merge pull request #368 from tsvallender/main 2023-08-24 06:12:48 -07:00
Tobias Bühlmann 556f7f5a37 Fix picking the first available role on primary_host 2023-08-24 13:50:24 +02:00
Trevor Vallender c2ec04f8c1 Allow Traefik to run without publishing port
Adds the `publish` option which, if set to false, does not pass `--publish` to
`docker run` when starting Traefik. This is useful when running Traefik
behind a reverse proxy, for example.
2023-08-24 10:52:10 +01:00
David Heinemeier Hansson 519659b84c Merge pull request #422 from fig/fix-421
require ActiveSupport module to provide String#remove
2023-08-23 13:50:04 -07:00
David Heinemeier Hansson 560d0698ac Merge pull request #426 from northeastprince/fix-site-in-gemspec
Fix site URL in gemspec
2023-08-23 13:47:26 -07:00
fig f40e8e9af1 Merge branch 'fix-421' of https://github.com/fig/mrsk into fix-421 2023-08-23 15:22:41 +01:00
fig 1ab7405e36 require ActiveSupport module to provide String#remove
fixes #421
2023-08-23 15:17:26 +01:00
Matt Almeida aeadd7c11f Fix site URL in gemspec 2023-08-23 15:15:51 +02:00
Donal McBreen d0fbf538d3 Add integration test hooks back in 2023-08-23 07:36:48 +01:00
David Heinemeier Hansson cfe77934e8 Update README.md
Point all docs to the site so we don't duplicate everything.
2023-08-22 17:11:26 -07:00
David Heinemeier Hansson 3f6ca1648e Update docker-publish.yml
Require setting tag
2023-08-22 15:44:07 -07:00
David Heinemeier Hansson 7c6d302baa Update docker-publish.yml
Allow manual invocation
2023-08-22 15:20:02 -07:00
fig b8eb50b982 require ActiveSupport module to provide String#remove
fixes #421
2023-08-22 20:58:48 +01:00
David Heinemeier Hansson d981c3c968 Move hooks 2023-08-22 12:47:00 -07:00
David Heinemeier Hansson 416860d9b0 Update docker-publish.yml
Reflect rename
2023-08-22 12:34:57 -07:00
David Heinemeier Hansson 33d5d7e9a2 Update README.md
Point to name change.
2023-08-22 12:20:24 -07:00
David Heinemeier Hansson 99c1102a3a Update README.md
Will do a new video shortly.
2023-08-22 12:13:54 -07:00
David Heinemeier Hansson ac11089c7a Bump version for 0.16.0 v0.16.0 2023-08-22 11:42:32 -07:00
David Heinemeier Hansson 180ca219df Merge pull request #423 from basecamp/rename
Rename project to Kamal
2023-08-22 11:41:42 -07:00
David Heinemeier Hansson dc1421a1fc Correct casing 2023-08-22 09:22:32 -07:00
David Heinemeier Hansson c4a203e648 Rename to Kamal 2023-08-22 08:24:31 -07:00
Donal McBreen e2c3709d74 Merge pull request #417 from manastyretskyi/main
Fix builder registry cache when using default registry
2023-08-17 14:08:05 +01:00
Liubomyr Manastyretskyi f68a33465f Fix review comments 2023-08-17 11:58:14 +03:00
Donal McBreen e7bc74d9ee Merge pull request #418 from mrsked/ssh-logging
Configurable log levels
2023-08-16 07:22:18 +01:00
Donal McBreen 1163c3de07 Configurable log levels
Allow ssh log_level to be set - this will help to debug connection
issues.
2023-08-15 16:51:56 +01:00
Donal McBreen 715cd94bbf Merge pull request #413 from mrsked/extract-version-from-container-name-correctly
Extract versions that contains dashes
2023-08-15 15:11:03 +01:00
Donal McBreen dda7099b2f Merge pull request #414 from mrsked/traefik-start-stop-run-errors
Don't hide Traefik errors
2023-08-15 15:10:47 +01:00
Donal McBreen 4262fce863 Merge pull request #415 from igor-alexandrov/fix-builder-configuration-validation
Removed validation for remote and local builder params
2023-08-15 15:10:23 +01:00
Liubomyr Manastyretskyi 6774675547 Fix builder registry cache when using default registry 2023-08-13 12:04:03 +03:00
Igor Alexandrov 0c52a1053e Removed not needed configuration test 2023-08-08 19:14:03 +04:00
Igor Alexandrov c24c7abb79 Fix for https://github.com/mrsked/mrsk/issues/407 2023-08-08 19:04:35 +04:00
Donal McBreen c2d7fd775f Don't hide Traefik errors
When stopping or starting Traefik, don't hide important errors.

Docker doesn't return an error when starting a started container or
stopping a stopped container.

When rebooting we want to know about errors during run as we've just
stopped and removed the previous container.

When booting, we want to leave the running container if it exists,
restart a stopped container and run a new one if none exists.

We can implement this with `docker start ... || docker run ...`:
- if the container is started, `docker start` will exit with 0
- if the container is stopped, `docker start` will start it and exit with 0
- if the container doesn't exist, `docker start` will return a non zero
exit code and `docker run` will create a new container. Any errors in
`docker run` will be returned.
2023-08-08 15:41:16 +01:00
Donal McBreen 4dd8208290 Extract versions that contains dashes
The version extraction assumed that the version is everything after the
last `-` in the container name. This doesn't work if you deploy a
non-MRSK generated version that contains a `-`.

To fix we'll generate the non version prefix and strip it off. In some
places for this to work we need to make sure to pass the role through.

Fixes: https://github.com/mrsked/mrsk/issues/402
2023-08-08 14:16:32 +01:00
Donal McBreen aa89ededde Merge pull request #399 from mrsked/manage-ssh-connection-starts
Manage SSH connection starts
2023-08-07 14:37:34 +01:00
David Heinemeier Hansson 299b166db7 Merge pull request #389 from brunoprietog/include-role-options-when-executing-commands
Include role options when executing commands
2023-07-26 14:04:28 +02:00
Donal McBreen 94d6a763a8 Extract ssh and sshkit configuration 2023-07-26 12:26:23 +01:00
Donal McBreen 752ff53458 Merge pull request #396 from igor-alexandrov/track-uncommitted-changes
Log uncommitted changes during deploy
2023-07-25 14:35:44 +01:00
Donal McBreen eb8c97a417 Document new sshkit settings 2023-07-25 13:09:49 +01:00
Donal McBreen f64b596907 Prevent SSH connection restarts
Set a high idle timeout on the sshkit connection pool. This will
reduce the incidence of re-connection storms when a deployment has been
idle for a while (e.g. when waiting for a docker build).

The default timeout was 30 seconds, so we'll enable keepalives at a
30s interval to match. This is to help prevent connections from being
killed during long idle periods.
2023-07-25 13:09:46 +01:00
Donal McBreen b25cfa178b Limit SSH start concurrency
Starting many (90+) SSH connections has caused us some issues such as
failed DNS lookups and hitting process file descriptor limits.

To mitigate this, patch SSHKit::Backend::Netssh to limit concurrency of
connection starts. We'll default to 30 at a time which seems to work
without issue, but can be configured via:

```
sshkit:
  max_concurrent_starts: 10
```
2023-07-25 13:08:44 +01:00
Donal McBreen edcfc77d95 Bump version for 0.15.1 v0.15.1 2023-07-25 13:07:04 +01:00
Donal McBreen a71e167a03 Merge pull request #400 from mrsked/revert-386-ssh-log-levels
Revert "Configurable SSH log levels"
2023-07-25 13:04:21 +01:00