Multisite (with 2 app containers) - restart of one container restores CSS but breaks it for the other


(Dave Lane) #1

I wrote up a description of our multisite configuration - a shared data container (data - one DB for each Discourse instance), and two app containers (web1 and web2), one for each Discourse instance.

I’ve had problems with aggregated CSS all along, but had both systems running reliably as 1.5.0beta6 (I ensured that each app instance had its own “shared” dir, so “shared1” for web1, and “shared2” for web2 - the data container stayed with the default “shared”).

After rebuilding all three containers to complete an upgrade to 1.5.0beta7, however, I saw a return of a problem I’ve had previous to beta6: every time I restart one app container (e.g. ./launcher restart web1), the other containers CSS (main and admin) starts to return a 404 (i.e. the site functions, but without CSS being applied). I also note that the __ws=[sitename] variable seems to be incorrect for both sites (the CSS for the site has and has

Any thoughts on why this might be happening?

(Update: 2016-01-11 Ahh! Fixed it - see my comment below! tl;dr: you need one Redis instance per Discourse instance)

(Dave Lane) #2

Further insight - I’ve found that if I do the following, things (at least for the moment) work!

./launcher stop web1
./launcher restart web2
./launcher start web1

Then the __ws= variables are set correctly!

(Sam Saffron) #3

My guess, both instances are talking to the same redis.

(Dave Lane) #4

That sounds right, Sam, thanks for your insight :slight_smile: - is it possible to enforce a separate redis for each site or somehow disambiguate them? Do I need to move the redis into the web app container?

(Sam Saffron) #5

of course you have ENV vars to control redis port so just run 2 redis containers

(Dave Lane) #6

Ok - back to work after the holidays and I think I have fixed this as follows.

I have two Discourse instances running on a total of 4 Docker containers.

I have

  1. web1 (first discourse instance,
  2. web2 (second discourse instance,
  3. data (providing postgres for web1 and web2, and redis for web1 only!)
  4. redis2 (providing redis only for web2)

To achieve this (via substantial trial and error), I created a new redis2.yml containing

- "templates/redis.template.yml"
- "templates/sshd.template.yml"

- ""


# ensure locale exists in container, you may need to install it

- volume:
    host: /home/www/discourse/shared2/data
    guest: /shared
- volume:
    host: /home/www/discourse/shared2/data/log/var-log
    guest: /var/log

# TODO: SOME_SECRET to a password for the discourse user

and ran ./launcher bootstrap redis2; ./launcher start redis2

Then I altered my web2.yml to set DISCOURSE_REDIS_HOST: redis2 rather than “data” and I also added a few lines to the configuration under the links: section so that web2 knows where to find redis2 (this is another -link below my existing -link for the “data” container):

- link:
     name: redis2
     alias: redis2

and ran ./launcher rebuild web2 and everything subsequently seems to work. :slightly_smiling: