Multi-Domain with two docker containers


#1

I am interested in running two instances of discourse from one server. I have a single docker container set up and running well. Now I’d like to add another one.

I have read Discourse Meta
and Multisite configuration with Docker

However, I do not want to use multisite (I prefer the portability of having two separate containers, even if it uses more RAM).

My setup uses an nginx proxy on the host and the current discourse install is being served on port 20081.

How do I run a completely separate docker container on port 20082?
I have tried updating the config with the new port and building but it replaced the other config rather than starting a new container.


(Felix Freiberger) #2

Don’t update the config – copy it, and edit the copy.
Do change the paths of the shared volumes, so the copy uses a separate database.

Each configuration file should correspond to one container.


#3

Thanks for the tips, that’s put me on the track. However I’m still having some issues as I think the container names are overlapping.

What I have done:

  • left my current discourse container running (I figure if I have this right than the other container should be able to continue running) - I don’t want to share any resources (separate postgres databases).
  • cloned a discourse repo to a new folder (/opt/discourse_new)
  • edited the ./containers/app.yml file, changed the following values (and added email settings)
expose:
  - "20081:80"   # fwd host port 20081 to container port 80 (http)
  
  DISCOURSE_HOSTNAME: forum.mynewtld.net
  
  DISCOURSE_DEVELOPER_EMAILS: 'admin@mynewtld.net'

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone_newsite
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log_newsite
      guest: /var/log

Then I ran ./launcher bootstrap app

However it fails out when it tries to stop postgres

Pups::ExecError: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 failed with return #<Process::Status: pid 20 exit 1>

Is there a way to tell discourse to create a new postgresql instance rather than reusing or disturbing the previous one?


(Rafael dos Santos Silva) #4

Remane app.yml to new_site.yml.

You don’t need a copy of /var/discourse just two different yml files. That’s why launcher always take this parameter, as in ./launcher bootstrapp app will be ./launcher bootstrap new_site


#5

thanks, that worked well.

I really appreciate the pointers!