WebUI clustering

Hi,

We have deployed LibreNMS on a swarm cluster using the official librenms image.

There are about 6 pollers instances working indepently of cron, web ui, rrdcached, memcached, etc.

We use traefik as ingress proxy and would like to fire another instance of web UI to distribute load.

The problem is Laravel’s session handling. We have shared the /opt/librenms/framework/sessions over NFS to get access to session from all instances across the cluster. When we do that, the web ui starts becoming slow responding. On the other hand, running just one instance with session filesystem as a local docker volume everything goes right.

Is there a way to do that? I’ve seen that Laravel supports memcached as session driver, but need a PECL extension to do that.

Thanks!

1 Like

Why not just change the session driver? https://laravel.com/docs/5.0/session#session-drivers

The redis connection is predefined, so you could just set .env variables for it.
To use memcached, you would have to edit the config/database.php file to add a new connection for memcached as it isn’t there right now. However, you could easily add that upstream so you can just use env variables for that too.

Update, nevermind it is there (cache.php):

SESSION_DRIVER=memcached
SESSION_CONNECTION=memcached
MEMCACHED_HOST=memcache-server.yep.net
MEMCACHED_USERNAME=ircache
MEMCACHED_PASSWORD=super-secret

see config/session.php and config/cache.php for more you may want to set.

I’m using a container.

How can I check if I passed variables correctly to laravel configuration?
I’m doing it with compose file inside “environment” setting, but can’t see if it is ok inside laravel.

If you set them in the container they should be passed through. I would manually go in and get the settings right in the .env file, then once you verify the settings are correct, you can set them on the container as they should be.

I’m also trying to achieve basically the same thing as you but I have some hurdles with adding more pooler into the cluster.

Would you mind sharing the docker stack yml please? After the required sanitization :slight_smile: