Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Discourse: create new root email

    Support
    2
    9
    384
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      qimmiq last edited by

      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 plugin

      Also 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.

      scooke 1 Reply Last reply Reply Quote 0
      • scooke
        scooke @qimmiq last edited by

        @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.

        A life lived in fear is a life half-lived

        Q 1 Reply Last reply Reply Quote 0
        • Q
          qimmiq @scooke last edited by

          @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:

          /root is 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.

          Q 1 Reply Last reply Reply Quote 0
          • Q
            qimmiq @qimmiq last edited by

            @qimmiq Maybe I should just use NodeBB instead ...

            scooke 1 Reply Last reply Reply Quote 0
            • scooke
              scooke @qimmiq 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?

              A life lived in fear is a life half-lived

              1 Reply Last reply Reply Quote 0
              • scooke
                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 cloudron to root, and now it ran.
                sudo -E -u root bundle exec script/rails console started, and I copied and pasted, line by line, the following, changing the YOUR_NEW_EMAIL_ADDRESS to 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 irb(main):001:0>)
                u.email = "mynew@email.com" (This was pasted after the line irb(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 exit at the final prompt. And it closed.

                I refreshed the Discourse site and voila, the new email address is present and visible!

                A life lived in fear is a life half-lived

                1 Reply Last reply Reply Quote 0
                • scooke
                  scooke last edited by

                  Long story short: Change the user in sudo -E -u cloudron bundle exec script/rails console from cloudron to root.

                  A life lived in fear is a life half-lived

                  Q 1 Reply Last reply Reply Quote 0
                  • Q
                    qimmiq @scooke last edited by

                    @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.

                    scooke 1 Reply Last reply Reply Quote 0
                    • scooke
                      scooke @qimmiq last edited by

                      @qimmiq Great! Imma gonna uninstall that Discourse ram hog now!

                      A life lived in fear is a life half-lived

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB