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 I get: sudo: unknown user: cloudron 
 sudo: unable to initialize policy pluginAlso tried sudo rails console And got: 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. 
- 
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 I get: sudo: unknown user: cloudron 
 sudo: unable to initialize policy pluginAlso tried sudo rails console And got: 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. 
- 
@qimmiq Make sure you are using the CLI of the app in question from within Cloudron, per https://docs.cloudron.io/apps/#web-terminal. This isn't from the usual ssh-ing in with your Terminal on your local machine. @scooke Ahh! Thanks. Progress, but not success. root@211e24ef-c9b0-45cb-891e-2edddc692bde:/app/code# sudo -E -u cloudron bundle exec script/rails console Produced: /rootis not writable.
 Bundler will use `/tmp/bundler20210702-197-1buhzyh197' as your home directory temporarily.
 Loading production environment (Rails 6.1.3.2)
 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. 
- 
@scooke Ahh! Thanks. Progress, but not success. root@211e24ef-c9b0-45cb-891e-2edddc692bde:/app/code# sudo -E -u cloudron bundle exec script/rails console Produced: /rootis not writable.
 Bundler will use `/tmp/bundler20210702-197-1buhzyh197' as your home directory temporarily.
 Loading production environment (Rails 6.1.3.2)
 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 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? 
- 
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 withsudo -E -u root bundle exec script/rails console- I changedcloudrontoroot, and now it ran.
 sudo -E -u root bundle exec script/rails consolestarted, and I copied and pasted, line by line, the following, changing theYOUR_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 withirb(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 irb(main):001:0>)
 u.email = "mynew@email.com" (This was pasted after the lineirb(main):002:0>, you can see how the counter goes up 1 each time, and etc.)
 u.email_tokens.create(email: u.email)
 u.activate
 u.save!then typed 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 consolefromcloudrontoroot.
- 
@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. 
 
