8741853a558b247e628bcf5de59ccdb7e7d043e7
wiki/info/landscape/amazon-ec2.md
| ... | ... | @@ -268,15 +268,20 @@ To still get the usual logging and URL re-writing features, replicas need to run |
| 268 | 268 | |
| 269 | 269 | Here are the steps to create a load balanced setup, assuming there is already an "Application" load balancer defined in the region(s) where you need them: |
| 270 | 270 | |
| 271 | +- Add a master+replica target group for the master and its replicas that external users will be directed to, using HTTP port 80 as the protocol settings. Note: as this target group will also be used for the HTTPS listener, "SSL offloading" will take place here. The re-directing from HTTP to HTTPS that shall occur when the user hits the server with an HTTP request will happen in the central instance's Apache server if and only if the `X-Forwarded-Proto` is `http` (https://stackoverflow.com/questions/26620670/apache-httpx-forwarded-proto-in-htaccess-is-causing-redirect-loop-in-dev-envir explains how a. See also http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html#x-forwarded-proto.) |
|
| 272 | +- Add a rule to the HTTPS listener for the hostname ${SERVER_NAME}.sapsailing.com that forwards traffic to the master+replica target group just created. |
|
| 271 | 273 | - Create a master instance holding all data (see http://wiki.sapsailing.com/wiki/amazon-ec2#Setting-up-Master-and-Replica) |
| 272 | -- When using the Race Committee App (RCApp), try to make sure the app is configured to send its data to the master instance and not the ELB (otherwise, write requests may end up at replicas which then have to reverse-replicate these to the master which is as of this writing (2014-12-18) an EXPERIMENTAL feature). You may want to configure a separate URL for the master server for this purpose, so you don't have to re-configure the RCApp devices when switching to a different master server. |
|
| 273 | 274 | - Create `n` instances that are configured to connect to the master server, automatically launching replication by using one of the `*...-replica-...*` environment from http://releases.sapsailing.com/environments. |
| 274 | -- Add a target group for the master and its replicas that external users will be directed to, using HTTP port 80 as the protocol settings. Note: as this target group will also be used for the HTTPS listener, "SSL offloading" will take place here. The re-directing from HTTP to HTTPS that shall occur when the user hits the server with an HTTP request will happen in the instance's Apache server if and only if the `X-Forwarded-Proto` is `http`. See also http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html#x-forwarded-proto. |
|
| 275 | -- Add master and replicas as targets into this group. Create a second target group that only contains the master server. |
|
| 275 | +- Add master and replicas as targets into the master+replica target group. |
|
| 276 | +- Create a second master-only target group that only contains the master server. |
|
| 277 | +- Add a rule to the HTTPS listener for the hostname ${SERVER_NAME}-master.sapsailing.com that forwards traffic to the master-only target group just created. |
|
| 278 | +- Add the master to the master-only target group. |
|
| 276 | 279 | - For both target groups configure the health checks, choosing HTTP as the protocol, using the default "traffic port" and setting the path to /index.html. Lower the interval to 10s and the "Healthy threshold" to 2 to ensure that servers are quickly recognized after adding them to the ELB. With the default settings (30 seconds interval, healthy threshold 10) this would last up to 5 minutes. |
| 277 | -- Add a rule to both listeners (http + https) that filter for the sub-domain you would like and that forwards to the target group containing master and replicas. Add another rule to both listeners that filters for the <your-sub-domain>-master.sapsailing.com sub-domain and that forwards to the target group containing only the master instance. |
|
| 280 | +- When using the Race Committee App (RCApp), make sure the app is configured to send its data to the ${SERVER_NAME}-master.sapsailing.com URL (otherwise, write requests may end up at replicas which then have to reverse-replicate these to the master which adds significant overhead). |
|
| 278 | 281 | |
| 279 | -It is important to understand that it wouldn't help to let all traffic run through our central Apache httpd server which usually acts as a reverse proxy with comprehensive URL rewriting rules and macros. This would make the Apache server the bandwidth bottleneck. Instead, the event traffic needs to go straight to the ELB which requires the event DNS domain name to be mapped to the ELB's host name. You need to set this up in the "Route 53" DNS server which you find in the Amazon Services drop-down. |
|
| 282 | +It is important to understand that it wouldn't help to let all traffic run through our central Apache httpd server which usually acts as a reverse proxy with comprehensive URL rewriting rules and macros. This would make the Apache server the bandwidth bottleneck. Instead, the event traffic needs to go straight to the ELB. This is established by the *.sapsailing.com DNS entry pointing to the Application ELB which then applies its filter rules to dispatch to the URL-specific target groups. Other than adding the hostname filter rules in the ELB as described above, no interaction with the Route 53 DNS is generally needed. Neither is it necessary to manually modify any 001-events.conf Apache configuration file. |
|
| 283 | + |
|
| 284 | +For testing purposes, however, it may be useful to still have some documentation around that explains how to do the Route 53 DNS setup manually. Remember: this shouldn't be needed for usual operations! |
|
| 280 | 285 | |
| 281 | 286 | <img src="/wiki/images/amazon/Route53_1.png" /> |
| 282 | 287 |