Commit Graph
2084 Commits
Author SHA1 Message Date
Wez Furlong 68e01e00cf ci: build mkdocs image periodically 2024-07-03 15:26:48 -07:00
Wez Furlong 32330758a9 docs: fixup repo/tag for mkdocs image 2024-07-03 15:18:59 -07:00
Wez Furlong 24caa792fc docs: maybe build and run our own mkdocs image 2024-07-03 15:15:15 -07:00
Wez Furlong d416b31af9 docs: add toml_data macro
This macro allows embedding TOML data into the docs,
and showing it in a tab that has both the TOML and JSON
representation of that data.

It works by executing the toml2jsonc helper that was added
in an earlier commit.

There's some machinery here to compile that utility to run
in the context of the mkdocs docker image; that works
locally, let's see how well it works in CI!

Usage is simple; before:

```toml
["something"]
foo = "bar"
```

after:

{% call toml_data() %}
["something"]
foo = "bar"
{% endcall %}

The first page to get switched over to this is https://docs.kumomta.com/tutorial/configuring_kumomta/

refs: https://github.com/KumoCorp/kumomta/issues/212
2024-07-03 14:59:52 -07:00
Wez Furlong 007e234d9e Add toml2jsonc utility to convert toml to json with comments
The intended purpose is to use to auto-generate json representations
of example toml data files for the documentation.

refs: https://github.com/KumoCorp/kumomta/issues/212
2024-07-03 11:53:59 -07:00
Wez Furlong e49985ff54 logging: capture incoming SMTP command line for Rejections 2024-07-03 06:46:01 -07:00
Wez Furlong acdb8e36d4 docs: add some diagrams to the deployment architecture page
I noticed that this page was totally blank; let's add some
useful content here!

refs: https://github.com/KumoCorp/kumomta/issues/214
2024-07-01 09:50:24 -07:00
Wez Furlong ca3339cebb docs: remove "building docker image" from "using docker" docs
It doesn't fit there, and the topic is a bit more complex
than that brief summary.
2024-07-01 07:21:08 -07:00
Wez Furlong c524ef5d11 deps: upgrade mlua from 0.8 -> 0.9
I've been holding off on this for a while, because I remember
this upgrade being a bit of a PITA for wezterm.  Since then
there is a `derive(FromLua)` that makes the transition much
easier.

This upgrade makes it potentially a bit easier/nicer/cheaper for
memoize, because it is now possible to retrieve references to userdata
values (rather than always cloning them), but I haven't done anything
special to take advantage of that in this commit.
2024-06-28 17:28:42 -07:00
Wez Furlong 91ce59628d ci: fixup run-lua-test for running in ci 2024-06-28 13:33:47 -07:00
Wez Furlong 9ddc15c7a1 sources.lua: Add typing and test
refs: #211
2024-06-28 13:06:51 -07:00
Wez Furlong 426b5b8d31 log_hooks: add typing
This will perform more explicit checks to make sure that the name
is defined and so on. It also now will check for conflicting
log hook names as well.

refs: #211
2024-06-28 12:31:49 -07:00
Wez Furlong e96dfcfe38 typing: refine error handling for _dynamic fields
Better distinguish between unknown and mismatched types for dynamic
fields, and show a better error message for them.

refs: #211
2024-06-28 10:06:27 -07:00
Wez Furlong 11bbd07f3f listener_domains: add typing and validation
refs: #211
2024-06-28 09:43:38 -07:00
Wez Furlong f0b91dd652 queue.lua: add typing
I regret optimizing the structure for toml when this module was
created, as it makes it difficult to define a regular schema.

This commit introduces typed records for the queue helper
data structure, and, unfortunately, a parsing layer to adapt
between the toml data and the well-defined types.

It also adjusts how lua tests are run; previously we'd co-opt the main
flow of parsing by looking at an env var, but since the modules can now
potentially require each other (especially the typing module) we need to
de-couple from that, otherwise what happens is that we'd only ever run
the typing module tests and exit. So we now have a script that imports
all the modules and runs their respective `:test()` methods.

refs: #211
2024-06-28 08:54:46 -07:00
Wez Furlong ef8cbea354 docs: fixup links to the rapidoc http page 2024-06-27 19:56:53 -07:00
Wez Furlong 49facb4d0a docs: fixup amqp docs some more 2024-06-27 19:51:09 -07:00
Wez Furlong 5b0d936ef7 docs: improve markdown output for the kcli help 2024-06-27 15:40:39 -07:00
Wez Furlong fa2c6225e8 docs: add kcli reference docs
These are automatically extracted from `kcli --help`.
2024-06-27 15:18:07 -07:00
Wez Furlong 5d7cf4005f docs: fixup AMQP example 2024-06-27 09:42:36 -07:00
Wez Furlong d66d6bd750 docs: fix link 2024-06-27 08:39:03 -07:00
Wez Furlong e683fed556 docs: move Log Record to its own reference page
This makes it a bit easier to find and link to.
2024-06-27 08:28:45 -07:00
Wez Furlong 7330721766 docs: changelog for #211 and kumod --validate 2024-06-27 07:02:10 -07:00
Wez Furlong fb2dad8b10 validation: check for ordering of get_queue_config events
refs: https://github.com/KumoCorp/kumomta/issues/211
2024-06-27 06:54:55 -07:00
Wez Furlong af99c0bb75 run-lua-test: factor out of Makefile
This makes the Makefile less verbose/boilerplate-y
2024-06-27 05:51:11 -07:00
Wez Furlong e63d1ca15c typing.lua: improve error reporting
Make the error messages a bit more regular and a bit easier
to read and trace.
2024-06-26 22:49:32 -07:00
Wez Furlong 245caaea6e dkim_sign.lua: make typing more succinct
This is a bit more legible
2024-06-26 17:48:33 -07:00
Wez Furlong aaaa96e7fb typing.lua: improve tests 2024-06-26 17:38:34 -07:00
Wez Furlong 7392ccf3d8 typing.lua: report errors from the caller's location
Don't attribute the error to the metamethods in the typing
module, attribute them to the calling code.
2024-06-26 17:04:28 -07:00
Wez Furlong d7a4b7a334 Add kumo.traceback
This function captures information about the lua call stack.
This is intended to be used when debugging lua module issues
and shouldn't be used in normal operation, as it can be relatively
expensive.
2024-06-26 17:03:34 -07:00
Wez Furlong b9dccf1cc3 add policy-extras.typing lua module
The primary purpose here is to allow defining typed records
for use in our helpers.

The dkim_sign module has been updated to make use of this
to ensure that the correct shape of data has been loaded.
2024-06-26 16:38:22 -07:00
Wez Furlong f8c3429738 serde: move json/toml to new kumo.serde module. Added YAML.
This helps to avoid bloating kumo-server-common, and makes it
easier to group related functions together in the docs.

The original names are still usable; we'll remove them in a
future release.
2024-06-26 11:08:15 -07:00
Wez Furlong 58ee029e33 kumod: disable INFO log level when in --validate mode
This keeps the output focused on any errors raised by
the validation stage.

refs: https://github.com/KumoCorp/kumomta/issues/211
2024-06-26 07:14:48 -07:00
Wez Furlong b1c04968fe metrics: add a couple of scheduled queue rollups
In addition to tracking queue depth by each scheduled queue,
track metrics for:

* domain
* tenant
* tenant-campaign
2024-06-25 19:14:52 -07:00
Wez Furlong 39818c1e36 Add validation for dkim_sign helper
refs: https://github.com/KumoCorp/kumomta/issues/211
2024-06-25 12:08:37 -07:00
Wez Furlong 471b44ae02 sources.lua: fixup to iterate file names correctly when validating 2024-06-25 11:19:56 -07:00
Wez Furlong 3139be2cfd Add new kumod --validate flag
The purpose is to provide a deeper, offline validation pass
of the policy configuration, prior to deploying and making it
live.

The system behavior changes when in `--validate` mode:

* Listeners, spool and spawned tasks will be silently skipped;
  the parameters will be validated but the primary functions
  of those things will be skipped silently.
* After triggering the `init` event, an additional new `validate_config`
  event (which can be registered multiple times) will be triggered
  to allow lua modules to perform extended validation.
* A module can either raise an error via `error` to immediately report
  a problem, or instead call a new, preferred, `kumo.validation_failed()`
  function to flag validation as failed but allow additional validation
  to be performed and summarized all together.
* Once the `validate_config` event returns, the process will terminate
  with either exit code 0 for a successful validation, or non-zero
  to indicate that something failed.

Validation errors are reported in a human readable form.

This commit adds validate_config event handlers for the following
helper modules:

* `shaping` - any warnings reported by the underlying rust code
  will be reported here and cause validation to fail. This is
  functionally equivalent to using the `validate-shaping` binary,
  except that it will automatically be passed the set of shaping
  files defined by your `init.lua`

  If the `sources` helper is also configured, the list of sources
  referenced by the shaping config will be cross-checked against
  the sources data to confirm that all possible sources are defined.

* `sources` - each listed source and pool will be validated by
  calling `kumo.make_egress_source` or `kumo.make_egress_pool`
  respectively.

  Pool membership will be validated to confirm that every
  listed pool is defined in the sources data.

* `queues` - each domain and tenant that references an egress_pool
  will be cross-checked with the `sources` helper, if the sources
  helper has been configured.

It is now an error to attempt to setup any of the above helpers
more than once.

refs: https://github.com/KumoCorp/kumomta/issues/211
2024-06-25 11:05:04 -07:00
Wez Furlong 6bb74f88da fix some warnings
These are all harmless; we do rely on printing these things
in Debug impls when under test.
2024-06-25 07:41:40 -07:00
Wez Furlong 785feb4510 cidr: update dep and revise error handling
The upstream cidr crate has a released a version that exposes the more
relaxed parser, so refactor the prior work from
7eb5bdcb5f (which was pointing to a
temporary development branch) to reference its "final form".

This is done by exposing a `parse_cidr` function from our cidr-map
crate, and standardizing all callers to route through that.

refs: https://github.com/stbuehler/rust-cidr/issues/8
2024-06-25 07:34:18 -07:00
Wez Furlong 4083afa672 docs: add faq entry for queue flushing 2024-06-24 15:04:12 -07:00
Wez Furlong a2d76df7a9 NEW: rebind API and kcli subcommand
refs: https://github.com/KumoCorp/kumomta/issues/209
2024-06-24 12:26:06 -07:00
Wez Furlong c415cdf4ee cargo update 2024-06-24 07:32:03 -07:00
dependabot[bot] e9b42e8a1f build(deps): bump docker/build-push-action from 5 to 6
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 06:50:46 -07:00
Wez Furlong 10bb7f2717 Add some string and regex functions
closes: https://github.com/KumoCorp/kumomta/issues/220
2024-06-21 17:20:04 -07:00
Mike Hillyer 53820402ba Killing off some orphans. 2024-06-20 17:55:52 -04:00
Wez Furlong 6f83f69236 docs: markdown <ol> is tricky, just use bullets/<ul> 2024-06-20 08:38:56 -07:00
Wez Furlong 7fc8dd97e6 docs: discuss creating an always-suspended queue
closes: https://github.com/KumoCorp/kumomta/issues/210
2024-06-20 08:35:17 -07:00
Wez Furlong 7eb5bdcb5f cidr: improve diagnostics for invalid cidr
This is done in two parts:

1. Showing the list of bad cidrs and their corresponding error messages
2. Upgrading to a yet-to-be-released branch of the underlying cidr
   library that can provide a helpful suggestion of how to fix it

refs: https://github.com/stbuehler/rust-cidr/issues/8
2024-06-20 07:57:34 -07:00
Mike Hillyer 77f9830513 Fix warning in the webhooks page 2024-06-19 16:55:52 -04:00
Mike Hillyer f957d812c1 Add the response rewrite page to the TOC. 2024-06-19 16:35:53 -04:00