CirclesUBI / infrastructure-provisioning

Infrastructure and Services for Circles
GNU Affero General Public License v3.0
5 stars 2 forks source link

Slow RocketChat uploads w multiple instances #12

Closed edzillion closed 6 years ago

edzillion commented 6 years ago

The problem is perfectly explained here:

https://github.com/RocketChat/Rocket.Chat/issues/7524

Need to update the INSTANCE_IP env var etc, as described here:

https://rocket.chat/docs/installation/manual-installation/multiple-instances-to-improve-performance/

edzillion commented 6 years ago

so I added an aws_app_cookie_policy which is supposed to enable 'sticky sessions' (basically means that the browser will keep targeting the same instance when uploading etc). It's not obvious whether you need one for each port (80 and 443) so I added both:


resource "aws_app_cookie_stickiness_policy" "rocketchat_http" {
  depends_on = ["aws_alb.rocketchat"]
  name          = "rocketchat-http-cookie-policy"
  load_balancer = "${aws_alb.rocketchat.name}"
  lb_port       = 80
  cookie_name   = "RocketchatCookie80"
}

resource "aws_app_cookie_stickiness_policy" "rocketchat_https" {
  depends_on = ["aws_alb.rocketchat"]
  name          = "rocketchat-https-cookie-policy"
  load_balancer = "${aws_alb.rocketchat.name}"
  lb_port       = 443
  cookie_name   = "RocketchatCookie443"
}

I added the depends_on attrib becase I am getting this error but it didn't help:

Error: Error applying plan:

2 error(s) occurred:

* aws_app_cookie_stickiness_policy.rocketchat_http: 1 error(s) occurred:

* aws_app_cookie_stickiness_policy.rocketchat_http: Error creating AppCookieStickinessPolicy: LoadBalancerNotFound: There is no ACTIVE Load Balancer named 'rocketchat-alb'
        status code: 400, request id: 4b19e108-aac0-11e8-aaf2-e53476dda4b2
* aws_app_cookie_stickiness_policy.rocketchat_https: 1 error(s) occurred:

* aws_app_cookie_stickiness_policy.rocketchat_https: Error creating AppCookieStickinessPolicy: LoadBalancerNotFound: There is no ACTIVE Load Balancer named 'rocketchat-alb'
        status code: 400, request id: 4b19b9ae-aac0-11e8-9548-4327547d8605
edzillion commented 6 years ago

I had it wrong. I needed to add the cookie policy to the aws_alb_target_group

  stickiness {
    type = "lb_cookie"
  }

left the cookie renew time at the default 1 day for the moment