Karta.Release (Karta v1.0.0)

Used for executing DB release tasks when run in production without Mix installed.

Summary

Functions

Links the user with this address to the identity provider's subject (sub), as printed in the log when their sign-in was refused because the account is not linked (Karta.Accounts.link_oidc/2).

Sets up local login for the user with this address (created when there is none) and prints a new password for them; their TOTP is set up again at the next sign-in, and their sessions end. Option admin: true makes them an instance administrator. Local login must be turned on (KARTA_LOCAL_LOGIN=true) for the password to be of use.

Makes the user with this address an instance administrator (created when there is none, to sign in through the identity provider).

Prints the id, the address of the JWK set and the DNS record of the key that signs the organisation's requests in Postal's format (Karta.Webhooks.PostalKey); one is generated when there is none. The organisation is named by its slug or its id.

Makes a key for the provisioning API (Karta.Provisioning.Keys) and prints it once: instance-wide, for an external system that sets customers up, able to read no message. scopes default to ["provisioning"]; ["provisioning:read"] makes a key that only reads.

Re-encrypts the secrets stored in the database under the active vault key (Karta.Vault.Reencrypt), after KARTA_VAULT_KEY has been replaced and the old key listed in KARTA_VAULT_RETIRED_KEYS. Prints how many values of each column were rewritten.

Revokes a provisioning key by its id or its prefix (the 8 characters after kprov_).

Replaces the organisation's key that signs requests in Postal's format with a new one; the old one stays published for a week. Prints the new key's id, JWK set address and DNS record. The organisation is named by its slug or its id.

Functions

local_user(email, opts \\ [])

Sets up local login for the user with this address (created when there is none) and prints a new password for them; their TOTP is set up again at the next sign-in, and their sessions end. Option admin: true makes them an instance administrator. Local login must be turned on (KARTA_LOCAL_LOGIN=true) for the password to be of use.

bin/karta eval 'Karta.Release.local_user("ann@example.com", admin: true)'

make_admin(email)

Makes the user with this address an instance administrator (created when there is none, to sign in through the identity provider).

bin/karta eval 'Karta.Release.make_admin("ann@example.com")'

migrate()

postal_signing_key(organisation)

Prints the id, the address of the JWK set and the DNS record of the key that signs the organisation's requests in Postal's format (Karta.Webhooks.PostalKey); one is generated when there is none. The organisation is named by its slug or its id.

bin/karta eval 'Karta.Release.postal_signing_key("acme")'

provisioning_key(name, scopes \\ ["provisioning"])

Makes a key for the provisioning API (Karta.Provisioning.Keys) and prints it once: instance-wide, for an external system that sets customers up, able to read no message. scopes default to ["provisioning"]; ["provisioning:read"] makes a key that only reads.

bin/karta eval 'Karta.Release.provisioning_key("signup system")'

reencrypt_secrets()

Re-encrypts the secrets stored in the database under the active vault key (Karta.Vault.Reencrypt), after KARTA_VAULT_KEY has been replaced and the old key listed in KARTA_VAULT_RETIRED_KEYS. Prints how many values of each column were rewritten.

revoke_provisioning_key(ref)

Revokes a provisioning key by its id or its prefix (the 8 characters after kprov_).

rollback(repo, version)

rotate_postal_signing_key(organisation)

Replaces the organisation's key that signs requests in Postal's format with a new one; the old one stays published for a week. Prints the new key's id, JWK set address and DNS record. The organisation is named by its slug or its id.

bin/karta eval 'Karta.Release.rotate_postal_signing_key("acme")'