Roots Discourse

Multiple work nodes per site (2-3 separate web workers & 1 mysql node)


#1

What is the best practice of handling web workers per site/domain in a Trellis project?
Ideally I’d have multiple IPs per site, and a single deploy/provision command per site. Is this doable?
I’m planning to move the memcached to mysql node. Is this a supported move path (yaml wise)?
Also, if anyone cares to share their experience with Load Balancing a Trellis project please do (I’m currently aware of memcache and sticky sessions problems).
Has anyone tried Cloud Flare’s Load balancer?


#2

It seems that Trellis is well prepared for this scenario.
It allows multiple host entries(worker, database node per IP) in the hosts/production file, and they all will be provisioned/deployed to with a single cli command.
There were a couple of gotchas in my case (2 workers, 1 data[mysql, nfs uploads share, memcached]), I had to:

  1. change the memcached role, from localhost to the IP of the data server.
  2. change the IP of the mysql node, also use db_user_host to allow access to mysql from the worker nodes
  3. grant permission to the mysql user used on workers
  4. setup rw nfs share for uploads(this is made easier by the fact that all users and groups are shared among the three trellis nodes)
  5. setup security.yml to allow traffic on all required ports(memcached, mysql, nfs), only by white-listed IP’s

The first run requires commenting out this line in mariadb tasks.yml:
#when: not sites_using_remote_db | count
…to allow database admin tasks
Subsequent runs should uncomment this line, as it will make the run fail on workers(database is remote), and stop processing further tasks in the run.