all-in-one/multiple-instances.md
Simon L c447a4defc some small improvements to docker-rootles and multiple-instances docs
Signed-off-by: Simon L <szaimen@e.mail.de>
2023-09-28 12:24:07 +02:00

3.5 KiB

Multiple AIO instances

It is possible to run multiple instances of AIO on one server.

There are two ways to achieve this: The normal way is creating multiple VMs, installing AIO in reverse proxy mode in each of them and having one reverse proxy in front of them that points to each VM (you also need to use a different TALK_PORT for each of them). The second and more advanced way is creating multiple users on the server and using docker rootless for each of them in order to install multiple instances on the same server.

Below is described more in detail how the the second way works.

Run multiple AIO instances on the same server with docker rootless

  1. Create as many linux users as you need first. The easiest way is to use sudo adduser and follow the setup for that. Make sure to create a strong unique password for each of them and write it down!
  2. Log in as each of the users by opening a new SSH connection as the user and install docker rootless for each of them by following step 0-1 and 3-4 of the docker rootless documentation (you can skip step 2 in this case).
  3. Then install AIO in reverse proxy mode by using the command that is descriebed in step 2 and 3 of the reverse proxy documentation but use a different APACHE_PORT and TALK_PORT for each instance as otherwise it will bug out. Also make sure to adjust the docker socket and WATCHTOWER_DOCKER_SOCKET_PATH correctly for each of them by following step 6 of the docker rootless documentation. Additionally, modify --publish 8080:8080 to a different port for each container, e.g. 8081:8080 as otherwise it will not work.
    ⚠️ Please note: If you want to adjust the NEXTCLOUD_DATADIR, make sure to apply the correct permissions to the chosen path as documented at the bottom of the docker rootless documentation. Also for the built-in backup to work, the target path needs to have the correct permissions as documented there, too.
  4. Now install your webserver of choice on the host system. It is recommended to use caddy for this as it is by far the easiest solution. You can do so by following https://caddyserver.com/docs/install#debian-ubuntu-raspbian or below. (It needs to be installed directly on the host or on a different server in the same network).
  5. Next create your Caddyfile with multiple entries and domains for the different instances like described in step 1 of the reverse proxy documentation. Obviously each domain needs to point correctly to the chosen APACHE_PORT that you've configured before. Then start Caddy which should automatically get the needed certificates for you if your domains are configured correctly and ports 80 and 443 are forwarded to your server.
  6. Now open each of the AIO interfaces by opening https://ip.address.of.this.server:8080 or e.g. https://ip.address.of.this.server:8081 or as chosen during step 3 of this documentation.
  7. Finally type in the domain that you've configured for each of the instances during step 5 of this documentation and you are done.
  8. Please also do not forget to open/forward each chosen TALK_PORT UPD and TCP in your firewall/router as otherwise Talk will not work correctly!

Now everything should be set up correctly and you should have created multiple working instances of AIO on the same server!