Commit Graph

853 Commits

Author SHA1 Message Date
Jamil
f65fcffbfc fix(portal): fix sentry before_send when message is nil (#9349)
A regression was introduced in #9242 where it appears that some Sentry
events don't contain messages, so the filtering module is updated only
to act on events with messages.
2025-06-01 12:32:08 -07:00
Brian Manifold
870aee3812 refactor(portal): add migration to remove created_by_ columns (#9318)
Why:

* This commit contains only a migration to remove the
created_by_identity and created_by_actor columns on multiple tables.
This migration will be run manually due to the long running sync jobs
that are currently in the system. This migration should be a no-op after
the manual DB updates.
2025-06-01 12:08:15 -07:00
Jamil
cc6c57125d revert: "fix(portal): Silence cluster challenge reply errors" (#9345)
This was actually an issue due to accidentally deleting the
`RELEASE_COOKIE` var.

Reverts firezone/firezone#9344
2025-06-01 10:49:49 -07:00
Jamil
42bccfd5e5 fix(portal): Silence cluster challenge reply errors (#9344)
Issues with node connections will be reported by the threshold logger.
2025-06-01 17:29:07 +00:00
Jamil
73c3e2d87b refactor(portal): move gateway events to WAL (#9299)
This PR moves Gateway events to be triggered by the WAL broadcaster.
Some things of note that are cleaned up:

- The gateway `:update` event was never received anywhere (but in a
test) and so has been removed
- The account topic has been removed as it was also never acted upon
anywhere. Presence yes, but topic no
- The group topic has also been removed as it was only used to receive
broadcasted disconnects when a group is deleted, but this was already
handled by the token deletion and so is redundant.
2025-06-01 16:40:28 +00:00
Jamil
bfca4e8411 fix(portal): Use threshold-based logging for cluster errors (#9342)
We periodically fetch a list of all `RUNNING` VMs in GCP and then try to
connect to them for clustering. However, during deploys, it's expected
that we won't be able to connect to new VMs until they are fully up. The
fetch doesn't take health checks into account, so we need a
threshold-based error logging.

To address this, we do the following:

- We only log an error when failing to connect to nodes if we are
currently below the threshold for each of the `api`, `domain`, and `web`
node counts
- We silence node timeout errors, as these will happen during deploys
2025-06-01 15:53:38 +00:00
Jamil
544b6455eb fix(portal): ensure cluster state heals (#9319)
We use `libcluster`, a common Elixir library, for node discovery. It's a
very lightweight wrapper around Erlang's standard `Node.connect`
functionality.

It supports custom cluster formation strategies, and we've implemented
one based on fetching the list of nodes from the GCP API, and then
attempting to connect to them.

Unfortunately, our implementation had two bugs that prevented the
cluster from healing in the following two cases:

- If we successfully connect to nodes, we tracked an internal state var
as having successfully connected to them, forever. If we lost the
connection to these nodes (such as during a deploy where the elixir
nodes don't come up in time, causing the instance group manager to reap
them), then the state would never be updated, and we would never
reconnect to the lost nodes.
- If we failed to fetch the list of nodes more than 10 times (every 10
seconds, so 100 seconds), then we would fail to schedule the timer to
load the nodes again.

The first issue is fixed by removing our kept state altogether - this is
what libcluster is for. We can simply try to connect to the most recent
list of nodes returned from Google's API, and we now log a warning for
any nodes that don't connect.

The second issue is fixed by always scheduling the timer, forever,
regardless of the state of the Google API.

Fixes #8660 
Fixes #8698
2025-05-31 05:01:52 +00:00
Jamil
23bae8f878 fix(portal): Use account param for autoredirect (#9304)
When the client is connecting for the first time without any cookies
loaded the `conn.assigns.account` is non-existent, causing a `KeyError`.

Instead, we should be loading this param from the URL and fetching the
account from it.
2025-05-30 21:23:25 +00:00
Brian Manifold
a51b35a6b4 refactor(portal): remove created_by_<identity/actor> columns (#9306)
Why:

* Now that we have started using the `created_by_subject` field on
various tables, we no longer need to keep the
`created_by_<identity/actor>` fields. This will help remove a foreign
key reference and will be one step closer to allowing us to hard delete
data rather than soft deleting all data in order to keep foreign key
references like these.
2025-05-30 21:06:35 +00:00
Jamil
5fb36cf327 fix(portal): Fix sign out acceptance test (#9302)
In #9294, we moved the token deletion side effect to the WAL consumer,
which is not executed for standard tests. As such, we need to call this
callback manually in the sign out acceptance test.

Fixes
https://github.com/firezone/firezone/actions/runs/15337858094/job/43158416750?pr=9295

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-30 07:16:55 +00:00
Jamil
e09c7b42b0 refactor(portal): Move token events to WAL broadcaster (#9294)
Moves the broadcasting of `disconnect` messages caused by token
soft-deletions to the WAL broadcaster.

Notably, many tests had to be cleaned up because they were specifically
testing this side effect. Instead, these tests now test (1) the token is
deleted, and then the token deletion handler is tested to ensure the
message is broadcasted.
2025-05-29 17:46:57 +00:00
Jamil
6cea0cd6ec refactor(portal): Move client updates to WAL broadcaster (#9288)
Client updates are next on the path to moving more side effects to the
WAL broadcaster. This one has the following notable changes:

- ~~The `actor_clients` pubsub topic were only used to broadcast removal
of clients belonging to an actor; these are no longer needed since we
handle this in the individual removal event~~ EDIT: only the presence is
kept
- The `account_clients:{account_id}` pubsub and presence topic
definition has been moved to `Events.Hooks.Accounts` because these are
broadcasted using the account_id field based on account changes, and
have nothing to do with the client lifecycle


Related: #6294 
Related: #8187
2025-05-29 16:56:08 +00:00
Jamil
7c674ea21c refactor(portal): Move expire_flow to WAL broadcaster (#9286)
Similar to #9285, we move the `expire_flow` event to be broadcasted from
the WAL broadcaster.

Unrelated tests needed to be updated to not expect to receive the
broadcast, and instead check to ensure the record has been updated.

A minor bug is also fixed in the ordering of the `old_data, data`
fields.

Tested manually on dev.

Related: #6294 
Related: #8187
2025-05-29 06:35:03 +00:00
Jamil
8d701efe4b refactor(portal): Move config_changed to WAL broadcaster (#9285)
Now that the WAL consumer has been dry running in production for some
time, we can begin moving events over to it.

We start with a relatively simple case: the account `config_changed`
event.

Since side effects now happen decoupled from the actual record updates,
testing is updated in this PR:

- We don't expect broadcasts to happen in the `accounts_test.exs` -
these context modules are now solely responsible for managing updates to
records and will no longer need to worry about side effects (in the
typical case) like subscribe and broadcast
- The Event hooks module now contains all logic related to processing
side effects for a particular account update.

The net effect is that we now have dedicated module and tests for side
effects, starting with `accounts`.

Related: #6294 
Related: #8187
2025-05-28 18:23:48 +00:00
Brian Manifold
1358da189d refactor(portal): start using created_by_subject (#9284)
Now that we've added the `created_by_subject` column on all relevant
tables, we can start using that data in the portal.
2025-05-28 14:57:36 +00:00
Jamil
a3cb9aecbd refactor(portal): prefix event handlers with on_ (#9282)
These are event handlers and this naming makes a tad more sense.
2025-05-27 21:16:55 +00:00
dependabot[bot]
148a148b96 build(deps): bump logger_json from 7.0.2 to 7.0.3 in /elixir (#9266)
Bumps [logger_json](https://github.com/Nebo15/logger_json) from 7.0.2 to
7.0.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Nebo15/logger_json/releases">logger_json's
releases</a>.</em></p>
<blockquote>
<h2>7.0.3</h2>
<h2>What's Changed</h2>
<ul>
<li>Format <code>metadata[:file]</code> as string in
<code>Formatters.Basic</code> by <a
href="https://github.com/smaximov"><code>@​smaximov</code></a> in <a
href="https://redirect.github.com/Nebo15/logger_json/pull/159">Nebo15/logger_json#159</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/smaximov"><code>@​smaximov</code></a>
made their first contribution in <a
href="https://redirect.github.com/Nebo15/logger_json/pull/159">Nebo15/logger_json#159</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Nebo15/logger_json/compare/7.0.2...7.0.3">https://github.com/Nebo15/logger_json/compare/7.0.2...7.0.3</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a0436795e1"><code>a043679</code></a>
Bump version</li>
<li><a
href="6d524a5577"><code>6d524a5</code></a>
Format <code>metadata[:file]</code> as string in
<code>Formatters.Basic</code> (<a
href="https://redirect.github.com/Nebo15/logger_json/issues/159">#159</a>)</li>
<li>See full diff in <a
href="https://github.com/Nebo15/logger_json/compare/7.0.2...7.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=logger_json&package-manager=hex&previous-version=7.0.2&new-version=7.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 16:52:01 +00:00
dependabot[bot]
f151386d1c build(deps): bump sentry from 10.9.0 to 10.10.0 in /elixir (#9265)
Bumps [sentry](https://github.com/getsentry/sentry-elixir) from 10.9.0
to 10.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/getsentry/sentry-elixir/releases">sentry's
releases</a>.</em></p>
<blockquote>
<h2>10.10.0</h2>
<p>This release adds Telemetry crash reporting, fixes compatibility with
Erlang/OTP 28, and includes several bug fixes.</p>
<h3>New features</h3>
<ul>
<li>Add Telemetry integration for capturing Telemetry crash events in
Sentry (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/887">#887</a>
by <a
href="https://github.com/whatyouhide"><code>@​whatyouhide</code></a>)</li>
<li>Add <code>:owner</code> option for check-ins, providing more control
over cron monitoring (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/879">#879</a>
by <a
href="https://github.com/Miradorn"><code>@​Miradorn</code></a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Fix regexes on Erlang/OTP 28 (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/889">#889</a>
by <a
href="https://github.com/josevalim"><code>@​josevalim</code></a>)</li>
<li>Fix ignored exception in the default filter by correcting
<code>Plug.Parsers.RequestTooLarge</code> reference (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/884">#884</a>
by <a
href="https://github.com/mbaleczny"><code>@​mbaleczny</code></a>)</li>
<li>Fix hyperlink tag in <code>Sentry.LoggerBackend</code> moduledoc (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/880">#880</a>
by <a
href="https://github.com/bjacquet"><code>@​bjacquet</code></a>)</li>
<li>Remain compatible with new translation format to be introduced in
Elixir 1.19 (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/885">#885</a>
by <a
href="https://github.com/martosaur"><code>@​martosaur</code></a>)</li>
</ul>
<h3>Various improvements</h3>
<ul>
<li>Update OTP and OS in CI (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/882">#882</a>
by <a href="https://github.com/solnic"><code>@​solnic</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/getsentry/sentry-elixir/blob/master/CHANGELOG.md">sentry's
changelog</a>.</em></p>
<blockquote>
<h2>10.10.0</h2>
<p>This release adds Telemetry crash reporting, fixes compatibility with
Erlang/OTP 28, and includes several bug fixes.</p>
<h3>New features</h3>
<ul>
<li>Add Telemetry integration for capturing Telemetry crash events in
Sentry (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/887">#887</a>
by <a
href="https://github.com/whatyouhide"><code>@​whatyouhide</code></a>)</li>
<li>Add <code>:owner</code> option for check-ins, providing more control
over cron monitoring (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/879">#879</a>
by <a
href="https://github.com/Miradorn"><code>@​Miradorn</code></a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Fix regexes on Erlang/OTP 28 (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/889">#889</a>
by <a
href="https://github.com/josevalim"><code>@​josevalim</code></a>)</li>
<li>Fix ignored exception in the default filter by correcting
<code>Plug.Parsers.RequestTooLarge</code> reference (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/884">#884</a>
by <a
href="https://github.com/mbaleczny"><code>@​mbaleczny</code></a>)</li>
<li>Fix hyperlink tag in <code>Sentry.LoggerBackend</code> moduledoc (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/880">#880</a>
by <a
href="https://github.com/bjacquet"><code>@​bjacquet</code></a>)</li>
<li>Remain compatible with new translation format to be introduced in
Elixir 1.19 (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/885">#885</a>
by <a
href="https://github.com/martosaur"><code>@​martosaur</code></a>)</li>
</ul>
<h3>Various improvements</h3>
<ul>
<li>Update OTP and OS in CI (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/882">#882</a>
by <a href="https://github.com/solnic"><code>@​solnic</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ded36e8e95"><code>ded36e8</code></a>
release: 10.10.0</li>
<li><a
href="2ced90ef99"><code>2ced90e</code></a>
Revert &quot;Add SpanProcessor for OpenTelemetry (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/875">#875</a>)&quot;</li>
<li><a
href="59ba37f493"><code>59ba37f</code></a>
Update CHANGELOG for release 10.10.0 (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/890">#890</a>)</li>
<li><a
href="84e61f5a40"><code>84e61f5</code></a>
Add Telemetry integration (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/887">#887</a>)</li>
<li><a
href="97d62eddb0"><code>97d62ed</code></a>
Fix regexes on Erlang/OTP 28 (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/889">#889</a>)</li>
<li><a
href="9887bd0cbc"><code>9887bd0</code></a>
Add SpanProcessor for OpenTelemetry (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/875">#875</a>)</li>
<li><a
href="14e20693a5"><code>14e2069</code></a>
Remain compatible with new translation format to be introduced in Elixir
1.19...</li>
<li><a
href="fd2e473376"><code>fd2e473</code></a>
Fix ignored exception in the default filter (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/884">#884</a>)</li>
<li><a
href="ebda03f8d8"><code>ebda03f</code></a>
Update GH issue templates for Linear compatibility (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/883">#883</a>)</li>
<li><a
href="93030f29e5"><code>93030f2</code></a>
Update OTP and OS in CI (<a
href="https://redirect.github.com/getsentry/sentry-elixir/issues/882">#882</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/getsentry/sentry-elixir/compare/10.9.0...10.10.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=sentry&package-manager=hex&previous-version=10.9.0&new-version=10.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 16:51:56 +00:00
dependabot[bot]
d57d3cbf94 build(deps): bump phoenix_ecto from 4.6.3 to 4.6.4 in /elixir (#9256)
Bumps [phoenix_ecto](https://github.com/phoenixframework/phoenix_ecto)
from 4.6.3 to 4.6.4.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/phoenixframework/phoenix_ecto/blob/main/CHANGELOG.md">phoenix_ecto's
changelog</a>.</em></p>
<blockquote>
<h2>v4.6.4</h2>
<ul>
<li>Enhancements
<ul>
<li>Wrap raised Ecto exceptions so context is not lost</li>
<li>Do not override changeset actions</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/phoenixframework/phoenix_ecto/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=phoenix_ecto&package-manager=hex&previous-version=4.6.3&new-version=4.6.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 14:29:46 +00:00
dependabot[bot]
632ab46e9e build(deps): bump @fontsource/source-sans-3 from 5.2.6 to 5.2.7 in /elixir/apps/web/assets (#9252)
Bumps
[@fontsource/source-sans-3](https://github.com/fontsource/font-files/tree/HEAD/fonts/google/source-sans-3)
from 5.2.6 to 5.2.7.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/fontsource/font-files/commits/HEAD/fonts/google/source-sans-3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@fontsource/source-sans-3&package-manager=npm_and_yarn&previous-version=5.2.6&new-version=5.2.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 13:57:39 +00:00
dependabot[bot]
8f8f7d4956 build(deps): bump workos from 1.1.0 to 1.1.1 in /elixir (#9262)
Bumps [workos](https://github.com/workos/workos-elixir) from 1.1.0 to
1.1.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/workos/workos-elixir/releases">workos's
releases</a>.</em></p>
<blockquote>
<h2>v1.1.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Update WorkOS Dependency Version in Readme by <a
href="https://github.com/matthew-kerle"><code>@​matthew-kerle</code></a>
in <a
href="https://redirect.github.com/workos/workos-elixir/pull/65">workos/workos-elixir#65</a></li>
<li>Fix types n cast by <a
href="https://github.com/apoorv-2204"><code>@​apoorv-2204</code></a> in
<a
href="https://redirect.github.com/workos/workos-elixir/pull/63">workos/workos-elixir#63</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/matthew-kerle"><code>@​matthew-kerle</code></a>
made their first contribution in <a
href="https://redirect.github.com/workos/workos-elixir/pull/65">workos/workos-elixir#65</a></li>
<li><a
href="https://github.com/apoorv-2204"><code>@​apoorv-2204</code></a>
made their first contribution in <a
href="https://redirect.github.com/workos/workos-elixir/pull/63">workos/workos-elixir#63</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/workos/workos-elixir/compare/v1.1.0...v1.1.1">https://github.com/workos/workos-elixir/compare/v1.1.0...v1.1.1</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b90ef7ae62"><code>b90ef7a</code></a>
Bump to 1.1.1</li>
<li><a
href="16616322b3"><code>1661632</code></a>
fix(profile): 🐛 ensure casting of all fields in profile</li>
<li><a
href="d5adc7bbbd"><code>d5adc7b</code></a>
fix(profile struct):  fix cast of profile and token, to cast
profile map...</li>
<li><a
href="4fead72dcc"><code>4fead72</code></a>
Update deprecated runner in GHA workflow</li>
<li><a
href="ea11c24bd3"><code>ea11c24</code></a>
Pin third-party actions to currently used SHA (<a
href="https://redirect.github.com/workos/workos-elixir/issues/66">#66</a>)</li>
<li><a
href="d65cec3d04"><code>d65cec3</code></a>
Update WorkOS Dependency Version in Readme</li>
<li>See full diff in <a
href="https://github.com/workos/workos-elixir/compare/v1.1.0...v1.1.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=workos&package-manager=hex&previous-version=1.1.0&new-version=1.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 13:56:52 +00:00
Jamil
3659b07259 fix(portal): Fix capitalization for All Identity Providers (#9241) 2025-05-26 17:30:01 +00:00
Jamil
068f7dfc8e chore(deps): Bump codespell to 2.4.1 and fix found issues (#9221)
The dictionary was updated in and codespell found a few minor issues to
fix.

Supersedes #8990
2025-05-24 22:02:06 +00:00
Brian Manifold
3eacb6b9b5 fix(portal): Add sync deletion circuit breaker (#9194)
Why:

* We have seen issues with Google Admin SDK API returning bad
information when requesting directory info, such as Groups and
Identities. The requests seem to return successful HTTP codes, but the
data is missing, which our sync system interprets as all
Groups/Identities have been deleted from the Google Workspace. In order
to prevent this from happening a deletion circuit breaker function has
been added to stop a sync job if a certain percentage of the identities
will be deleted on the current run. This should prevent the possibility
of mass deleting Groups/Identities if an Identity Provider hands back
incorrect info on any sync.

Fixes: #9188
2025-05-22 04:31:21 +00:00
Brian Manifold
12b4a12f26 feat(portal): Add created_by_subject (#9176)
Why:

* We have decided to change the way we will do audit logging. Instead of
soft deleting data and keeping it in the table it was created in, we
will be moving to an audit trail table where various actions will be
recorded in a table/DB specifically for auditing purposes. Due to this
change we need to make sure that we don't have stale/dangling
references. One set of references we keep everywhere is
`created_by_identity_id` and `created_by_actor_id`. Those foreign key
references won't be able to be used after moving to the new audit
system. This commit will allow us to keep that info by pulling the
values and storing the data in a created_by_subject field on the record.
2025-05-20 20:03:46 +00:00
Jamil
ca59492003 fix(portal): bump width of default auth provider selection (#9174)
This is just a bit short at the moment:

<img width="467" alt="Screenshot 2025-05-16 at 3 55 55 PM"
src="https://github.com/user-attachments/assets/6d4b6d6d-d3a2-453e-a860-cb638127f684"
/>

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-16 16:20:47 -07:00
Jamil
c18cb69157 feat(portal): Add broadcast to simulate more real-world events (#9172)
We are currently consuming the WAL on production and it has shown very
little cost in terms of resource usage.

It would be better to get a more real-world test by sending actual
broadcasts with data.

To do this, we simply send a `Domain.PubSub.broadcast` with all of the
data received in the WAL message, which represents an absolute
worst-case scenario.
2025-05-16 22:00:59 +00:00
Jamil
f07aa8aa3a fix(portal): Add ReplicationConnectionManager (#9158)
When deploying, new Elixir nodes are spun up before the old ones are
brought down. This ensures that the state in the cluster is merge into
the new nodes between the old ones go away.

This also means, however, that the existing WAL consumer is still up
when our new one tries to come online.

Normally, this isn't an issue, because we find the old pid and return it
with `{:ok, existing_pid}`. When that VM goes away, the Supervisor(s) of
the new application notice and restart it,

However, if the cluster state diverges or is inconsistent during this
period, we may fail to find the existing pid, and try to start a new
ReplicationConnection. If the old pid is still active, this will fail
because there's a mutex on the connection. The original implementation
was designed to handle this case using the Supervisor with a
`:transient` restart policy.

What the author failed to understand is that the restart policy applies
only to _restarts_ and not initial starts, so if all of the new
application servers fail to find the old pid which is still connected,
and they all fail to come up, we won't consume the WAL.

This is fixed with a `ReplicationConnectionManager` that always comes up
fine, and then simply tries to start a `ReplicationConnection` every
30s, giving up after 5 minutes if it can't start one or find an existing
one. This will crash, causing the Supervisor to restart us, and then
notify us.
2025-05-16 19:54:27 +00:00
Jamil
65c58ee254 feat(portal): Zero-click client authentication (#9144)
Adds a new field to `settings/identity_providers` that allows an Admin
to designate any non-email/otp provider as the `default` for client
authentication. Clients will then navigate directly to the provider's
`/redirect` endpoint when authenticating, which in many cases will
automatically sign them in.

No existing providers are updated in this PR.



https://github.com/user-attachments/assets/7b962a25-76fd-491f-a194-60ed993821fc
2025-05-16 19:26:08 +00:00
Brian Manifold
dd5a53f686 fix(portal): Fix sign_up to properly populate email (#9105)
Why:

* During the account sign up flow, the email of the first admin was not
being populated in the `email` column on the auth_identities table. This
was due to atoms being passed in the attrs instead of strings to the
`create_identity` function. A migration was also created to backfill the
missing emails in the `auth_identities` table.
2025-05-13 19:49:25 +00:00
Brian Manifold
a8bea13591 fix(portal): Remove redundant index on actor_group_memberships (#9063)
Why:

* It was pointed out that the way Postgresql does compound indexes there
is no need to have an individual index on the first column of the
compound index. This commit removes the redundant index on the
`actor_id` for the `actor_group_membership` table.
2025-05-09 05:32:45 +00:00
Brian Manifold
20d8246ce8 fix(portal): Add indexes to actor_group_memberships (#9058)
Why:

* As we move towards hard deleting data one issue we've run into is with
cascading deletes on the actor_group_memberships table. In order to
solve this problem indexes have been created on the `actor_id` and
`group_id` columns of the actor_group_memberships.
2025-05-09 01:47:24 +00:00
Jamil
8a7f248dda fix(portal): ignore expected replication connection failures (#9003)
These are expected during deploys, so don't log them as errors. If the
Supervisor fails to start us after exhausting all attempts, it will log
an error.
2025-05-02 00:45:02 +00:00
Jamil
ce8c32229c docs: Reorder gcloud auth step for cloudsql (#9001)
This is almost always required.
2025-05-01 21:50:04 +00:00
Jamil
299fbcd096 fix(portal): Properly check background jobs (#8986)
The `background_jobs_enabled` config in an ENV var that needs to be set
for a specific configuration key. It's not set on the top-level
`:domain` config by default.

Instead, it's used to enable / disable specific modules to start by the
application's Supervisor.

The `Domain.Events.ReplicationConnection` module is updated in this PR
to follow this convention.
2025-05-01 16:32:43 +00:00
dependabot[bot]
7cd22097ba build(deps): bump logger_json from 7.0.0 to 7.0.2 in /elixir (#8975)
Bumps [logger_json](https://github.com/Nebo15/logger_json) from 7.0.0 to
7.0.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Nebo15/logger_json/releases">logger_json's
releases</a>.</em></p>
<blockquote>
<h2>7.0.2</h2>
<h2>What's Changed</h2>
<ul>
<li>Datadog: report <code>error.kind</code> and <code>error.stack</code>
for non-crash error+ logs by <a
href="https://github.com/aloukissas"><code>@​aloukissas</code></a> in <a
href="https://redirect.github.com/Nebo15/logger_json/pull/157">Nebo15/logger_json#157</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/aloukissas"><code>@​aloukissas</code></a> made
their first contribution in <a
href="https://redirect.github.com/Nebo15/logger_json/pull/157">Nebo15/logger_json#157</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Nebo15/logger_json/compare/7.0.1...7.0.2">https://github.com/Nebo15/logger_json/compare/7.0.1...7.0.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="6e0b5ca332"><code>6e0b5ca</code></a>
Bump version</li>
<li><a
href="7de4c86996"><code>7de4c86</code></a>
pattern match</li>
<li><a
href="42c074a193"><code>42c074a</code></a>
honor existing metadata</li>
<li><a
href="b7a1e1ae5c"><code>b7a1e1a</code></a>
remove else clause</li>
<li><a
href="bd6144a591"><code>bd6144a</code></a>
logger level option</li>
<li><a
href="564f1e14ab"><code>564f1e1</code></a>
no need for stack</li>
<li><a
href="2cf9140036"><code>2cf9140</code></a>
feat: report error.kind and error.stack for non-crash error+ logs</li>
<li><a
href="14aa482efb"><code>14aa482</code></a>
Add kind and top level message to DataDog formatter</li>
<li><a
href="c0bcd290d1"><code>c0bcd29</code></a>
Allow using old tuples in config.exs and promote using new/1 in
runtime.exs</li>
<li>See full diff in <a
href="https://github.com/Nebo15/logger_json/compare/7.0.0...7.0.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=logger_json&package-manager=hex&previous-version=7.0.0&new-version=7.0.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 15:22:08 +00:00
dependabot[bot]
5d62a7d357 build(deps): bump ex_cldr_numbers from 2.35.0 to 2.35.1 in /elixir (#8974)
Bumps [ex_cldr_numbers](https://github.com/elixir-cldr/cldr_numbers)
from 2.35.0 to 2.35.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/elixir-cldr/cldr_numbers/releases">ex_cldr_numbers's
releases</a>.</em></p>
<blockquote>
<h2>Cldr Numbers version 2.35.1</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fix formatting currency amounts when the currency format does not
have a digit placeholder (<code>0</code> and <code>#</code>) directly
next to the currency placeholder (<code>¤</code>). Thanks to <a
href="https://github.com/benregn"><code>@​benregn</code></a> for the
report. Closes <a
href="https://redirect.github.com/elixir-cldr/cldr_numbers/issues/54">#54</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/elixir-cldr/cldr_numbers/blob/main/CHANGELOG.md">ex_cldr_numbers's
changelog</a>.</em></p>
<blockquote>
<h2>Cldr Numbers v2.35.1</h2>
<p>This is the changelog for Cldr v2.35.1 released on April 23rd, 2025.
For older changelogs please consult the release tag on <a
href="https://github.com/elixir-cldr/cldr_numbers/tags">GitHub</a></p>
<h3>Bug Fixes</h3>
<ul>
<li>Fix formatting currency amounts when the currency format does not
have a digit placeholder (<code>0</code> and <code>#</code>) directly
next to the currency placeholder (<code>¤</code>). Thanks to <a
href="https://github.com/benregn"><code>@​benregn</code></a> for the
report. Closes <a
href="https://redirect.github.com/elixir-cldr/cldr_numbers/issues/54">#54</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1fb2f82370"><code>1fb2f82</code></a>
Fix currency formatting. Closes <a
href="https://redirect.github.com/elixir-cldr/cldr_numbers/issues/54">#54</a></li>
<li>See full diff in <a
href="https://github.com/elixir-cldr/cldr_numbers/compare/v2.35.0...v2.35.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ex_cldr_numbers&package-manager=hex&previous-version=2.35.0&new-version=2.35.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 13:59:21 +00:00
dependabot[bot]
aa4f66df37 build(deps): bump tzdata from 1.1.2 to 1.1.3 in /elixir (#8973)
Bumps [tzdata](https://github.com/lau/tzdata) from 1.1.2 to 1.1.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/lau/tzdata/blob/master/CHANGELOG.md">tzdata's
changelog</a>.</em></p>
<blockquote>
<h2>[1.1.3] - 2025-03-05</h2>
<h3>Fixed</h3>
<ul>
<li>Fix Elixir compiler warnings for decreasing ranges without explicit
steps (Christoph Grothaus)</li>
<li>Fix various Elixir compiler warnings (Thomas Cioppettini)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Now requires Elixir 1.9 or greater instead of 1.8 or greater.</li>
<li>tzdata release version shipped with this library is now 2025a
instead of 2024b.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="61fb7ecf68"><code>61fb7ec</code></a>
Version 1.1.3 (<a
href="https://redirect.github.com/lau/tzdata/issues/158">#158</a>)</li>
<li><a
href="f760899337"><code>f760899</code></a>
Fix Elixir compiler warnings for decreasing ranges without explicit
steps (<a
href="https://redirect.github.com/lau/tzdata/issues/154">#154</a>)</li>
<li><a
href="7791318499"><code>7791318</code></a>
chore(Elixir): Fix warnings emitted by elixir 1.16 (<a
href="https://redirect.github.com/lau/tzdata/issues/139">#139</a>)</li>
<li>See full diff in <a
href="https://github.com/lau/tzdata/compare/v1.1.2...v1.1.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tzdata&package-manager=hex&previous-version=1.1.2&new-version=1.1.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 13:59:08 +00:00
dependabot[bot]
532c26fa48 build(deps): bump observer_cli from 1.8.2 to 1.8.3 in /elixir (#8970)
Bumps [observer_cli](https://github.com/zhongwencool/observer_cli) from
1.8.2 to 1.8.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/zhongwencool/observer_cli/releases">observer_cli's
releases</a>.</em></p>
<blockquote>
<h2>1.8.3</h2>
<h2>What's Changed</h2>
<ul>
<li>process_info(Pid, monitors) can also return {port, _} tuples by <a
href="https://github.com/gomoripeti"><code>@​gomoripeti</code></a> in <a
href="https://redirect.github.com/zhongwencool/observer_cli/pull/110">zhongwencool/observer_cli#110</a></li>
<li>correct the units shown for memory data by <a
href="https://github.com/gonzalobf"><code>@​gonzalobf</code></a> in <a
href="https://redirect.github.com/zhongwencool/observer_cli/pull/111">zhongwencool/observer_cli#111</a></li>
<li>Fix compile warning on OTP 27 by <a
href="https://github.com/zmstone"><code>@​zmstone</code></a> in <a
href="https://redirect.github.com/zhongwencool/observer_cli/pull/114">zhongwencool/observer_cli#114</a></li>
<li>Fix mnesia crash by handling unknown storage types by <a
href="https://github.com/zhongwencool"><code>@​zhongwencool</code></a>
in <a
href="https://redirect.github.com/zhongwencool/observer_cli/pull/115">zhongwencool/observer_cli#115</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/gonzalobf"><code>@​gonzalobf</code></a>
made their first contribution in <a
href="https://redirect.github.com/zhongwencool/observer_cli/pull/111">zhongwencool/observer_cli#111</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/zhongwencool/observer_cli/compare/v1.8.2...1.8.3">https://github.com/zhongwencool/observer_cli/compare/v1.8.2...1.8.3</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5ef0a2cec2"><code>5ef0a2c</code></a>
chore: include docs dir</li>
<li><a
href="de56d61c8c"><code>de56d61</code></a>
Merge pull request <a
href="https://redirect.github.com/zhongwencool/observer_cli/issues/115">#115</a>
from zhongwencool/mnesia-crash</li>
<li><a
href="49440d8134"><code>49440d8</code></a>
Migrate documentation from doc to docs directory and switch to
ex_doc</li>
<li><a
href="cbfcf75ecc"><code>cbfcf75</code></a>
bump to 1.8.3</li>
<li><a
href="93453bd876"><code>93453bd</code></a>
Fix mnesia crash by handling unknown storage types</li>
<li><a
href="54f152d717"><code>54f152d</code></a>
Fix compile warning on OTP 27</li>
<li><a
href="c4eba84200"><code>c4eba84</code></a>
correct the units shown for memory data</li>
<li><a
href="12ef05329c"><code>12ef053</code></a>
process_info(Pid, monitors) can also return {port, _} tuples</li>
<li>See full diff in <a
href="https://github.com/zhongwencool/observer_cli/compare/v1.8.2...1.8.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=observer_cli&package-manager=hex&previous-version=1.8.2&new-version=1.8.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 13:58:55 +00:00
dependabot[bot]
48151cb4ba build(deps): bump argon2_elixir from 4.1.2 to 4.1.3 in /elixir (#8966)
Bumps [argon2_elixir](https://github.com/riverrun/argon2_elixir) from
4.1.2 to 4.1.3.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c77ab6660b"><code>c77ab66</code></a>
update version to v4.1.3</li>
<li><a
href="2bc37dcc9f"><code>2bc37dc</code></a>
Merge pull request <a
href="https://redirect.github.com/riverrun/argon2_elixir/issues/68">#68</a>
from meeq/patch-1</li>
<li><a
href="af29b73a65"><code>af29b73</code></a>
Fix Clang compile warning</li>
<li>See full diff in <a
href="https://github.com/riverrun/argon2_elixir/compare/v4.1.2...v4.1.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=argon2_elixir&package-manager=hex&previous-version=4.1.2&new-version=4.1.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 13:58:43 +00:00
Jamil
8e054f5c74 fix(portal): Restrict WAL streaming to domain nodes only (#8956)
The `web` and `api` application use `domain` as a dependency in their
`mix.exs`. This means by default their Supervisor will start the
Domain's supervision tree as well.

The author did not realize this at the time of implementation, and so we
now leverage the convention in place for restricting tasks to `domain`
nodes, the `background_jobs_enabled` application configuration
parameter.

We also add an info log when the replication slot is being started so we
can verify the node it's starting on.
2025-05-01 13:28:40 +00:00
Jamil
42b2420c00 ci(portal): Only set GIT_SHA before main app compile (#8955)
Delaying setting the GIT_SHA until as late as possible allows us to
cache more layers.

Fixes #8774
Related: #8948
2025-05-01 05:15:47 +00:00
Jamil
c0a670d947 fix(portal): Restart ReplicationConnection using Supervisor (#8953)
When deploying, the cluster state diverges temporarily, which allows
more than one `ReplicationConnection` process to start on the new nodes.

(One of) the old nodes still has an active slot, and we get an "object
in use" error `(Postgrex.Error) ERROR 55006 (object_in_use) replication
slot "events_slot" is active for PID 603037`.

Rather than use ReplicationConnection's restart behavior (which logs
tons of errors with Logger.error), we can use the Supervisor here
instead, and continue to try and start the ReplicationConnection until
successful.

Note that if the process name is registered (globally) and running,
ReplicationConnection.start_link/1 simply returns `{:ok, pid}` instead
of erroring out with `:already_running`, so eventually one of the nodes
will succeed and the remaining ones will return the globally-registered
pid.
2025-05-01 03:48:35 +00:00
Jamil
fdd1105b10 fix(portal): alter db user role with replication (#8952)
We need the `replication` attribute set on the db user. This is
trivially done in a migration, and with the `CURRENT_USER` specifier, we
don't need to fetch the Application configuration.
2025-04-30 13:02:34 -07:00
Jamil
1f8090c60d fix(portal): use existing database user for replication (#8950)
Turns out we are making replication overly complex by creating a
dedicated user for it. The `web` user is already privileged and we can
reuse it since the replication system operates in the same security
context as the remaining app.
2025-04-30 11:19:14 -07:00
Jamil
a98a9867af fix(portal): Redact entire connection_opts param (#8946)
The LoggerJSON Redactor only redacts top-level keys, so we need to
redact the entire `connection_opts` param to redact its contained
password.

We also don't need to pass around `connection_opts` across the entire
ReplicationConnection process state, only for the initial connection, so
we refactor that out of the `state`.
2025-04-30 16:33:21 +00:00
Jamil
968db2ae39 feat(portal): Receive WAL events (#8909)
Firezone's control plane is a realtime, distributed system that relies
on a broadcast/subscribe system to function. In many cases, these events
are broadcasted whenever relevant data in the DB changes, such as an
actor losing access to a policy, a membership being deleted, and so
forth.

Today, this is handled in the application layer, typically happening at
the place where the relevant DB call is made (i.e. in an
`after_commit`). While this approach has worked thus far, it has several
issues:

1. We have no guarantee that the DB change will issue a broadcast. If
the application is deployed or the process crashes after the DB changes
are made but before the broadcast happens, we will have potentially
failed to update any connected clients or gateways with the changes.
2. We have no guarantee that the order of DB updates will be maintained
in order for broadcasts. In other words, app server A could win its DB
operation against app server B, but then proceed to lose being the first
to broadcast.
3. If the cluster is in a bad state where broadcasts may return an error
(i.e. https://github.com/firezone/firezone/issues/8660), we will never
retry the broadcast.

To fix the above issues, we introduce a WAL logical decoder that process
the event stream one message at a time and performs any needed work.
Serializability is guaranteed since we only process the WAL in a single,
cluster-global process, `ReplicationConnection`. Durability is also
guaranteed since we only ACK WAL segments after we've successfully
ingested the event.

This means we will only advance the position of our WAL stream after
successfully broadcasting the event.

This PR only introduces the WAL stream processing system but does not
introduce any changes to our current broadcasting behavior - that's
saved for another PR.
2025-04-29 23:53:06 -07:00
Jamil
48319df9f0 revert(#8893): Revert adding wal2json dev image (#8908)
Turns out that the standard `pgoutput` plugin shipped with Postgres will
do everything we need it to, and there are good examples of prior art
decoding its binary output in Elixir (in production).

So to avoid adding a dependency on `wal2json` here, we'll go with that.
2025-04-26 22:43:32 +00:00
Brian Manifold
3f3f007920 fix(portal): Update copy to clipboard button (#8907)
Why:

* The copy to clipboard button was not working at all on the API new
token page due to the fact that the FlowbiteJS library expects the
presence of the elements in the DOM on first render. This was not true
of the API Token code block. Along with that issue the existing code
blocks copy to clipboard buttons did not give any visual indication that
the copy had been completed. It was also somewhat difficult to see the
copy to clipboard button on those code blocks as well. This commit
updates the buttons to be more visible, as well as adds a phx-hook to
make sure the FlowbiteJS init functions are run on every code block even
if it's inserted after the initial load of the page and adds functions
that are run as a callback to toggle the button text and icon to show
the text has been copied.
2025-04-26 00:43:43 +00:00
Jamil
f6ae7559e8 feat(ci): Add custom postgres Dockerfile for wal2json (#8893)
In order to develop and test WAL replication, we need the wal2json
module installed in our dev postgres image. The module itself builds
very quickly, but I thought it would be better to have this
automatically built and pushed as part of a nightly job so that CI and
developers can make use of it.
2025-04-25 12:31:40 +00:00