How to set up mobilizon for multiple domains on one server

On my server I am hosting multiple websites. For one of those websites a mobilizon instance has been set up and is actively being used.

Now I would like to set up mobilizon instances for some of the other hosted domains on this server. I feel this should be possible, but in the documentation I cannot find any useful information on how to realize this.
Is there some sort of manual or help available on how to set this up?

I am using lighttpd as webserver, with virtual hosts for the websites and it is also the proxy server for mobilizon. For the record, this is the configuration to set up the proxy for mobilizon on lighttpd:
configuration filename: 10-proxy.conf

server.modules   += ( "mod_proxy" )

## Check for certificate refresh, do not use proxy for certificates
$HTTP["url"] !~ "^/.well-known/" {
# we're not refreshing certificates, continue with proxy
  $HTTP["host"] == "domainname.tld" {
  proxy.server = ( "" => (
                           ( "host" => "127.0.0.1",
                             "port" => 4000
                           )
                         )
                 )
  }
}

Adding multiple proxies is as simple as adding a new $HTTP[« host »]== section, using different domain names and using another port.

What I would like to know is how to configure the database and the mobilizon configuration to achieve using mobilizon with different content and users on multiple domains on the same server.

In config.exs, you’ll see that an instance can be configured with environment variables : MOBILIZON_DATABASE_PASSWORD, MOBILIZON_DATABASE_USERNAME, MOBILIZON_DATABASE_DBNAME, MOBILIZON_DATABASE_HOST.

So you can configure each instance to use the same host but different dbname, user and pass.

Thank you for your answer!
So I only need one config.exs for multiple instances?
Do I need to give each instance it’s own port on the reverse proxy, or can they all use the same port and is it only the database connection that makes the difference?

So I only need one config.exs for multiple instances?

Yes but you need to « variablelize » it. Have a look at config/docker.exs · main · Framasoft / Mobilizon · GitLab

each instance it’s own port on the reverse proxy

Yes you do. For example, first instance listen on 4000, second on 4001, etc. If you « variablelize » as describe above, you can use « MOBILIZON_INSTANCE_PORT » environment variable to adjuste the listening port.

Then it is a matter of configuring the reverse proxy to map a domain (vhost) to the right upstream backend using the right port.

Many Thanks

I will give it a try!

I can see this working using a docker install (one for each instance), which i do not have, neither want to use. I still am confused on how to do this (if at all possible) with the release version.

Docker is not mandatory to do this. Docker has to do this because the image are imutable so you can’t change the config file so the configuration has to rely on environment variables which you set when you create the container.

By adapting the configuration of the instance launched by systemd, same can be achieve.

Is it safe to use this

cd /opt/mobilizon
sudo -u mobilizon ./bin/mobilizon_ctl instance gen  --output /etc/mobilizon/config_1.exs --output-psql /tmp/setup_db.psql

to generate new databases? It should not impact the running instance I presume, as long as I use a different --output value from the already running instance and a different database name. Which should also generate a config_1.exs file containing the right values to populate the Environment= part in the systemd service for the new instance.

To me, yes it is safe, it just generate output files from template, nothing is run.

Progress update:
created a test environment on an old laptop and installed Mobilizon (release) on that, following the instructions on the mobilizon documentation site.
This works out fine, mobilizon is up and running, I can connect to it and it shows the default mobilizon page as expected.

Now I created a new instance using
/.bin/mobilizon_ctl instance gen
using different database settings (except for database_host) generating a config file and database, this works fine.
Then I run into a problem using this command:
/.bin/mobilizon_ctl migrate
It only works for the first database and completely ignores the new database for the newly created instance, rendering it unusable. How can I make this work?
Is there any way to specify which database to migrate?