Questions before running a second standalone instance


(Quenten) #1

Hello guys,
What should I change in the app.yml in order for my second instance , to not override data of the first instance ?

How is the database named ? is it always the same or random ?
I read that the database is external to container, does it mean it’s on the actual server? If so, will my second instance override the first’s database ? or it will use another name ?

Thank you.


(Matt Palmer) #2

The name of the file (and hence the name you give to launcher). That is the resulting name of the container which is run, the directory in which the persistent data for the application is stored, and so forth.

The database name defaults to discourse, but you can change that by adding the following in the params section of the .yml file you create:

db_name: something_else

So it’d look like this:

params:
  db_name: something_else

You can either run the database in the same container as the web application, or you can run the database in a separate container or on the server itself. The standalone.yml template in the samples directory is an all-in-one setup, while the combination of the web_only.yml and data.yml templates will give you separate containers for the web application and datastores. You could also configure the web_only.yml to connect to existing, standalone PostgreSQL and Redis servers, if you felt so inclined.

The second instance will use another name, as long as you configure it to do so, as described previously.


(Quenten) #3

Thanks a lot.
I added a new yml file for my new standalone, I rewrote the database name param, then what ? Should I bootstrap the new container ? bare with me please.


(Matt Palmer) #4

Yep, a new container means another round of bootstrapping. You should specify the name of the new container definition to the launcher command, so it knows which container you want to work on, and the name is taken from the filename of the new yml file. So, if you named the file containers/my_second_forum.yml, you would run:

./launcher bootstrap my_second_forum

The same applies to any other launcher commands in the future, such as ./launcher start my_second_forum and ./launcher rebuild my_second_forum.


(Quenten) #5

Thanks. Any modifications to do to ports and volumes ?


(Quenten) #6

The new container still uses discourse as database…


(Sam Saffron) #7

Containers are standalone unless you run a seperate data container, you can have 10 on the same box that have a database called discourse


(Quenten) #8

So creating a new container.yml would create a fresh installation of discourse?


(Sam Saffron) #9

Yes, provided it uses a different shared volume path


(Quenten) #10

Can you elaborate on the volume path setting?

What I tried:

I had an app running with app.yml

I added a new container : app2.yml
./launcher bootstrap app2 && ./launcher start app2

When I go to the port specified to app2 , I see app.yml instance.
What bugs me is that I’m binding let’s say host’s port 85 to docker’s port 80 which is already used by app.yml.
Is that the reason why I’m seeing the app.yml instance on app2 port ?


(Sam Saffron) #11

Have a look at the volumes section in the yml file, it informs docker where to mount folders on the host inside the container.


(Quenten) #12

I got that, in app.yml it was like this:

volumes:
      - volume:
          host: /var/discourse/shared/standalone
          guest: /shared
      - volume:
          host: /var/discourse/shared/standalone/log/var-log
          guest: /var/log

in app2.yml I’m having:

volumes:
      - volume:
          host: /var/discourse/shared/standalone2
          guest: /shared
      - volume:
          host: /var/discourse/shared/standalone2/log/var-log
          guest: /var/log

are the folder meant to be created manually or left to the container to create them ?


(Sam Saffron) #14

Docker will create the folder


(Quenten) #15

It worked. I cried. Seriously this was killing me.