Backup restore after migration, no admin account creation email

AI-generated summary

Backup Restore Issue After Migration

After migrating a Drupal forum to Discourse and restoring a backup on a fresh instance, rahim123 encountered an issue where the admin account creation email was not sent. This prevented account activation. To work around the issue, rahim123 used ./launcher enter app and rake admin:create to create an admin account, and then enabled emails for all users.

PFaffman suggested that the import script may not have created an admin account and that adding the user to developer_emails could resolve the issue. rahim123 confirmed that the Drupal admin user received Discourse admin status after activating a temporary admin account.

PFaffman suspects that a user isn’t considered staff until their account is activated and recommends using Google auth and adding desired users to DEVELOPER_EMAILS to ensure they can log in after migration.

Hi there, I’ve now done 2 test installations with the backup from my Drupal migration, which I restored on fresh Discourse instances in a different VPS with correctly configured FQDN and working email. The importer instance was just using the IP address of the VPS, and it didn’t have email configured. I’m not sure if that has anything to do with this issue, but in both my backup restore tests after the restore is complete and it brings me to the admin account creation page, I can’t activate the account because it doesn’t send the email. I was able to work around this with:   ./launcher enter app  ,   rake admin:create  . After that I can login to the web app and successfully run email tests, and if I enable emails for all users then the other user accounts can successfully receive the forgotten password reset email. So this appears to be a bug with the default setting after restore of no emails to non-staff. I guess it should consider the email addresses defined as admin users to be staff even before their accounts are validated.

That suggests that the import script didn’t create an admin account. If you just log in and/or create an account using the developer_email address, you’ll be OK.

That’s likely because restoring the backup turned off email for non-staff and that user isn’t staff.

Maybe? It’s certainly a chicken-egg issue with a new site and a migration. I think if you add your user to developer_emails then it’ll work.

The other thing you can do is add something like this to your script:

   User.create(username: 'pat-the-admin', email: 'pat@user.com',password: 'very-safe-123', active: true, name: "Pat User")     unless User.find_by_email('pat@user.com`)

Thanks for the reply Jay. Yeah, that’s what appears happened. And yet somehow after using the console to activate my temporary new admin account and checking the users list I saw that my previous Drupal username that had Drupal admin permissions automatically received Discourse admin status.

In my app.yml I have:
DISCOURSE_DEVELOPER_EMAILS: 'new-discourse-user@email.com,old-drupal-user@email.com'

Yeah. I suspect that a user isn’t staff until the account is activated. What I usually do is use a Google auth on my import sites and make sure that the people I want to be able to log in are in DEVELOPER_EMAILS and have a gmail address.