Skip to content

Commit

Permalink
Merge pull request #767 from lusergit/chore/seeds
Browse files Browse the repository at this point in the history
chore(seeds): reconcile tenant when seeding
  • Loading branch information
davidebriani authored Dec 9, 2024
2 parents 5517c6e + 323f422 commit 97c7032
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
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

0 comments on commit 97c7032

Please sign in to comment.