Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(seeds): reconcile tenant when seeding #767

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions backend/priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,20 @@ tenant =
{status, realm_pk} =
read_key!.("SEEDS_REALM_PRIVATE_KEY_FILE", "SEEDS_REALM_ORIGINAL_FILE", "realm_private")

Astarte.create_realm!(
%{cluster_id: cluster.id, name: read_env_var.("SEEDS_REALM"), private_key: realm_pk},
tenant: tenant
)

if status == :default do
"""
You are using the default realm private key. \
This instance will not be able to connect to Astarte.
"""
|> String.trim_trailing("\n")
|> Logger.warning()
else
Edgehog.Tenants.reconcile_tenant(tenant)
end

Astarte.create_realm!(
%{cluster_id: cluster.id, name: read_env_var.("SEEDS_REALM"), private_key: realm_pk},
tenant: tenant
)

:ok
8 changes: 0 additions & 8 deletions doc/pages/tutorials/edgehog_in_5_minutes.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ You can finally navigate to `http://edgehog.localhost` in your browser and login

## Test Astarte connection

Astarte connectivity may not work right away, as edgehog has not yet reconciled
its interfaces and triggers with astarte. Without waiting, we can force it to execute
the reconciler using:

```sh
$ docker compose exec edgehog-backend bin/edgehog rpc "Edgehog.Tenants.list_tenants |> Enum.each(&Edgehog.Tenants.reconcile_tenant/1)"
```

If you now connect a device to astarte and open or reload the edgehog web page,
you should see the new device in the appropriate section.

Expand Down
Loading