How to specify alternate configuration in multisite

I have a multisite instance & when I try to reset password for an admin user (the only user), I receive the email, but clicking the link just takes me to the home page, not logged in, and no prompt to change the password.

Related: how do I pass a database name to rake admin:create?

RAILS_DB=bob rake admin:create


I think that’s what I thought, but it doesn’t seem to be passing the database.

root@support-multi:/var/www/discourse# RAILS_DB=bob rake admin:create
User with this email already exists! Do you want to reset the password for this email? (Y/n) 

I didn’t name the database ‘bob’, so I’d expect an error here. It seems to be accessing the default database.

yeah we should probably make it explode instead of choose default for invalid db names. What is in multisite.yaml?

     - exec: sudo -u postgres createdb discourse_forum|| exit 0
     - exec:
          stdin: |
            grant all privileges on database discourse_forum to discourse;

          cmd: sudo -u postgres psql discourse_forum
          raise_on_fail: false


     - exec: /bin/bash -c 'sudo -u postgres psql discourse_forum <<< "alter schema public owner to discourse;"'
     - exec: /bin/bash -c 'sudo -u postgres psql discourse_forum <<< "create extension if not exists hstore;"'
     - exec: /bin/bash -c 'sudo -u postgres psql discourse_forum <<< "create extension if not exists pg_trgm;"'
           adapter: postgresql
           database: discourse_forum
           pool: 25
           timeout: 5000
           db_id: 2

You should use RAILS_DB=discourse_instance2 for


We should blow up here for sure rather than going default when a completely different name is given… that is super nutty.


While setting the password via the console has solved my problem, I still wonder whether this is a bug that I can’t set an admin password via email.

edit: I figured it out. The sign-up email was being sent with http. Caddy is redirecting to https, but dropping the rest of the URL.

Anybody see anything obviously wrong in my snippet above? Sidekiq isn’t running for any of the other hosts.

ooks” vs “hooks”?
Obviously your multisite.yml building should probably be under the before_bundle_exec hook.

I’m pretty sure there is only one Sidekiq running for all sites, check the main (first) site

Is your data container separate?

1 Like

ooks was careless pasting.

Data is in the same container (though I would really like to move it to a separate container).

Edit: my current hypothesis is that at some point I had screwed up the db_id numbers for a couple sub-hosts. I’m rebuilding the container with a different name now and don’t see that error. . .

Well, I got the error again with a clean build. My config file is at this gist.

Looks like it might be a bug, though I’m a novice at multisite.

I get a bunch of errors like this:

 Failed to initialize site discourse_instance2
2017-05-10 21:17:15 UTC [20343-1] discourse@discourse_trena ERROR:  relation "site_settings" does not exist at character 36
2017-05-10 21:17:15 UTC [20343-2] discourse@discourse_trena STATEMENT:  SELECT name, data_type, value FROM site_settings
URGENT: ERROR:  relation "site_settings" does not exist
LINE 1: SELECT name, data_type, value FROM site_settings

you have two after_code: sections.


Well, that seems to have fixed those errors, but I still can’t connect to sidekiq.

Did you see this comment?


Oh. Ooops. :blush:

Now I see that those jobs have a current_site_id set.

Edit: 0 have been processed. There are 2502 scheduled.

Scheduled are ones that are “scheduled” to occur at a specific time.

Geez. I have too many tabs open. I was looking at a development instance.

I now understand that there is one sidekiq for all sites. I now see that it’s processed all of its jobs.

Perhaps I should stop using computers today.

Thanks for your help, @DeanMarkTaylor.

If someone deletes or unlists this thread, that’d be OK by me. :slight_smile:


That’s fine but this…

needs to be fixed first cc @sam … that’s real bad behavior


I guess I’ll have to live with my carelessness and dirty laundry for all to see, then. :slight_smile: