ubergeek77 / Lemmy-Easy-Deploy

Deploy Lemmy the easy way!
MIT License
133 stars 14 forks source link

[Help] How to run multiple of these? #75

Closed RonSijm closed 11 months ago

RonSijm commented 11 months ago

Hey there, I'm quite a noob when it comes to docker, so this might be an easy question, but I was wondering how to run multiples this repo at once?

My use-case: I'm building a custom front-end / service agent for Lemmy, and part of that is a multi-account / multi-instance container. So for testing purposes I'm running my own Lemmy backend using this project. So for testing purposes I'd like to simulate running 2 different instances, so that I can check that you can be logged in to multiple instances at the same time, and use multiple instances simultaneously seamlessly...

I don't want to use real instances, because my tests include all kinda CRUD operations for posts and comments, and I don't want to pollute real instances

Sharing resources is fine, like having multiple schemes in the same postgress database for example, or using the same asonix/pictrs container.

What would I have to change in the deploy scripts to run a second instance side-by-side with the default config based instance? Thanks

ubergeek77 commented 11 months ago

Hello! Thank you for your interest in the project!

I am very sorry to disappoint, but unfortunately, your use case is highly specific and sadly not supported.

This project is for beginners, and aims to help users deploy the most typical "out of the box" setup. That basically means, it will set itself up on a server where no other webservers are running, and with no proxy servers running in front of it (apart from Cloudflare).

Your use case is pretty advanced, since not only are you running a front-end SSO proxy for Lemmy, you also want to run multiple Lemmy instances on the same machine. However, Lemmy is extremely particular about hostnames, and this project does not account for the possibility of multiple servers running at once. Lemmy needs to be accessed from a specific hostname that you define during setup, and if you were to access from a different one (which sounds likely here), weird stuff would happen.

I suppose you could masquerade the hostname as part of the incoming request, but that sort of highly specialized deployment is sadly out of scope for this project.

For users like yourself, I do let you override virtually everything via Advanced Configuration, but please note that I cannot provide specific guidance or support for this feature; everyone has lots of custom things they would like to do, but as just one person, I sadly don't have the resources to walk everyone through their advanced setups :(

To at least point you in the right direction, you might have success in writing your own custom Caddyfile that can handle two different Lemmy hostnames, and you might get away with making two copies of the lemmy* services and nothing else. However, you will need to make extensive modifications to the main script in order to support this, including the service checker at the end, and any lines that make assumptions on volume names.

I highly recommend that you simply provision two distinct servers with two distinct IPs, then point your SSO server to each unique host individually. That will be a much more reliable approach. Remember that the "Host" header is important when sending requests to this Lemmy deployment.

Good luck!