Cannot create admin user #47

Open
opened 2026-03-30 22:12:37 +00:00 by jeppebundsgaard · 4 comments

I think I have done everything correct. But when running:
abra app cmd domain.dk app admin -- username user@email.tld
I get this:

Cannot find user role with that name
No such account
FATA

I have tried to run user generation this way:

abra app cmd domain.dk app bash

RAILS_ENV=production bin/tootctl accounts create user --email user@email.tld --confirmed --role Owner (from https://docs.joinmastodon.org/admin/setup/)
But I get:

Mastodon now requires that these variables are set:

  • ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY
  • ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT
  • ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY

Run bin/rails db:encryption:init to generate new secrets and then assign the environment variables.
Do not change the secrets once they are set, as doing so may cause data loss and other issues that will be difficult or impossible to recover from.

I don't know how to set these variables.

Any suggestions?

I think I have done everything correct. But when running: `abra app cmd domain.dk app admin -- username user@email.tld` I get this: > Cannot find user role with that name > No such account > FATA > I have tried to run user generation this way: `abra app cmd domain.dk app bash` `RAILS_ENV=production bin/tootctl accounts create user --email user@email.tld --confirmed --role Owner` (from https://docs.joinmastodon.org/admin/setup/) But I get: > Mastodon now requires that these variables are set: > > - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY > - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT > - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY > > Run `bin/rails db:encryption:init` to generate new secrets and then assign the environment variables. > Do not change the secrets once they are set, as doing so may cause data loss and other issues that will be difficult or impossible to recover from. I don't know how to set these variables. Any suggestions?
Owner

@jeppebundsgaard

Hmmmmm, I assume you're getting No such account because you don't have a user created with the email user@email.tld? However, perhaps, I'm missing something.

The reason you're seeing those env vars errors is because when you run abra app cmd ... this gets injected into the environment:

abra.sh Lines 37 to 49 in 414f5acc71
environment() {
# for sidekiq service bundle exec env var threading
file_env "DB_PASS"
file_env "OTP_SECRET"
file_env "SECRET_KEY_BASE"
file_env "VAPID_PRIVATE_KEY"
file_env "AWS_SECRET_ACCESS_KEY"
file_env "ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY"
file_env "ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"
file_env "ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY"
declare -x RAILS_ENV=production
}

I haven't run this recipe in ages but I'd probably just cat this file once I abra app bash in.

compose.yml Line 26 in 414f5acc71
target: /usr/local/bin/entrypoint.sh

And then copy/pasta the file_env machinery so I can expose all those env vars manually in my shell session. Annnnd finally run the command. Which will perhaps give you the same error 😛

Good luck!

@jeppebundsgaard Hmmmmm, I assume you're getting `No such account` because you don't have a user created with the email `user@email.tld`? However, perhaps, I'm missing something. The reason you're seeing those env vars errors is because when you run `abra app cmd ...` this gets injected into the environment: https://git.coopcloud.tech/coop-cloud/mastodon/src/commit/414f5acc71b2bb52779b45c33b080f4560a94bb2/abra.sh#L37-L49 I haven't run this recipe in ages but I'd probably just cat this file once I `abra app bash` in. https://git.coopcloud.tech/coop-cloud/mastodon/src/commit/414f5acc71b2bb52779b45c33b080f4560a94bb2/compose.yml#L26 And then copy/pasta the `file_env` machinery so I can expose all those env vars manually in my shell session. Annnnd finally run the command. Which will perhaps give you the same error 😛 Good luck!

I learned a lot from your answer, thanks!
abra calls the exact command I tried from bash, and the results are the same.

But it still doesn't work. It seems from "Cannot find user role with that name" that the user roles normally shipped with Mastodon are not enabled: https://docs.joinmastodon.org/admin/roles/.

But what do I do now?

I learned a lot from your answer, thanks! `abra` calls the exact command I tried from bash, and the results are the same. But it still doesn't work. It seems from "Cannot find user role with that name" that the user roles normally shipped with Mastodon are not enabled: https://docs.joinmastodon.org/admin/roles/. But what do I do now?
Owner

@jeppebundsgaard any help? https://github.com/mastodon/mastodon/issues/18813

I think you're in a "mastodon is the problem" zone and not a "coop cloud is the problem" zone now 🙃

@jeppebundsgaard any help? https://github.com/mastodon/mastodon/issues/18813 I think you're in a "mastodon is the problem" zone and not a "coop cloud is the problem" zone now 🙃

@jeppebundsgaard any help? https://github.com/mastodon/mastodon/issues/18813

I think you're in a "mastodon is the problem" zone and not a "coop cloud is the problem" zone now 🙃

I looked into the issue, but it seems to be solved years ago. The command in abra.sh uses Owner with a capital O, as it should.

I managed to use the suggestion in the issue to create a user.

RAILS_ENV=production bundle exec bin/tootctl accounts create myusername --email name@email
and then
RAILS_ENV=production bin/tootctl account approve myusername

So now I have an approved user, but it is not Owner or Admin, because those roles don't exist.

I guess you are right - this is Mastodon somehow. I'll see what I can find.

> @jeppebundsgaard any help? https://github.com/mastodon/mastodon/issues/18813 > > I think you're in a "mastodon is the problem" zone and not a "coop cloud is the problem" zone now 🙃 I looked into the issue, but it seems to be solved years ago. The command in abra.sh uses Owner with a capital O, as it should. I managed to use the suggestion in the issue to create a user. `RAILS_ENV=production bundle exec bin/tootctl accounts create myusername --email name@email` and then `RAILS_ENV=production bin/tootctl account approve myusername` So now I have an approved user, but it is not Owner or Admin, because those roles don't exist. I guess you are right - this is Mastodon somehow. I'll see what I can find.
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coop-cloud/mastodon#47
No description provided.