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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Discourse: create new root email

Discourse: create new root email

Scheduled Pinned Locked Moved Support
9 Posts 2 Posters 1.7k Views 2 Watching
  • 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 Offline
    Q Offline
    qimmiq
    wrote on last edited by
    #1

    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.

    scookeS 1 Reply Last reply
    0
    • Q qimmiq

      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.

      scookeS Offline
      scookeS Offline
      scooke
      wrote on last edited by
      #2

      @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
      0
      • scookeS scooke

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

        Q Offline
        Q Offline
        qimmiq
        wrote on last edited by
        #3

        @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
        0
        • Q qimmiq

          @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 Offline
          Q Offline
          qimmiq
          wrote on last edited by
          #4

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

          scookeS 1 Reply Last reply
          0
          • Q qimmiq

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

            scookeS Offline
            scookeS Offline
            scooke
            wrote on last edited by scooke
            #5

            @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
            0
            • scookeS Offline
              scookeS Offline
              scooke
              wrote on last edited by scooke
              #6

              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
              0
              • scookeS Offline
                scookeS Offline
                scooke
                wrote on last edited by
                #7

                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
                0
                • scookeS scooke

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

                  Q Offline
                  Q Offline
                  qimmiq
                  wrote on last edited by
                  #8

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

                  scookeS 1 Reply Last reply
                  0
                  • Q qimmiq

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

                    scookeS Offline
                    scookeS Offline
                    scooke
                    wrote on last edited by
                    #9

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

                    A life lived in fear is a life half-lived

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Bookmarks
                    • Search