Discourse: create new root email
Trying to change the default email for Discourse per instructions at https://docs.cloudron.io/apps/discourse/#changing-root-account-email. But when I enter the suggested command on the CLI:
sudo -E -u cloudron bundle exec script/rails console
sudo: unknown user: cloudron
sudo: unable to initialize policy plugin
sudo rails console
sudo: rails: command not found
It should go without saying that I don't really know what I'm doing. Any help would be greatly appreciated! Thanks.
@scooke Ahh! Thanks.
Progress, but not success.
root@211e24ef-c9b0-45cb-891e-2edddc692bde:/app/code# sudo -E -u cloudron bundle exec script/rails console
/rootis not writable.
Bundler will use `/tmp/bundler20210702-197-1buhzyh197' as your home directory temporarily.
Loading production environment (Rails 22.214.171.124)
bundler: failed to load command: script/rails (script/rails)
Then a lot of traceback, ending in:
/usr/local/lib/ruby/2.7.0/irb/ext/save-history.rb:98:in `stat': Permission denied @ rb_file_s_stat - /root/.irb_history (Errno::EACCES)
What next? Thanks very much.
@qimmiq Maybe I should just use NodeBB instead ...
scooke last edited by scooke
@qimmiq Did you run through the entire Discourse setup BEFORE trying to change the admin email stuff? I just installed Discourse, and before even logging in to the actual site I tried the same commands, and they failed too. So I went to the site, logged in, and discovered there is still more Setup steps. I'm doing those right now. One of them, https://discourse.example.com/wizard/steps/privacy, asked for an admin email address and whether users could sign up, and whether the app was public or private. I've chosen the most open options. I wonder if the failure we've seen happens because these Setup steps weren't done?
scooke last edited by scooke
Well, having installed it, and then running through the Setup steps, and then trying
sudo -E -u cloudron bundle exec script/rails console, it failed too. But it seemed like a permission error, so I reran it with
sudo -E -u root bundle exec script/rails console- I changed
root, and now it ran.
sudo -E -u root bundle exec script/rails consolestarted, and I copied and pasted, line by line, the following, changing the
YOUR_NEW_EMAIL_ADDRESSto my new email address. Each of those lines below I copied into the prompt. That is, the space after the >. IN the gray box, each line that starts with
irb(main):001:0>is a prompt, and I pasted each portion of those lines into that prompt space. I hope that makes sense.
For me, the Help at https://docs.cloudron.io/apps/discourse/#changing-root-account-email didn't make it clear enough that you don't copy and paste the entire block, but it looks like that since they've made the entire gray block copy-able:
u = User.find_by_username("root") (This I pasted after the line
u.email = "email@example.com" (This was pasted after the line
irb(main):002:0>, you can see how the counter goes up 1 each time, and etc.)
exitat the final prompt. And it closed.
I refreshed the Discourse site and voila, the new email address is present and visible!
Long story short: Change the user in
sudo -E -u cloudron bundle exec script/rails consolefrom
@scooke Thanks much. I followed your steps and the email was changed. It didn't like u.activate. Said the email was already taken ... but the change was made.
@qimmiq Great! Imma gonna uninstall that Discourse ram hog now!