Changes between Initial Version and Version 1 of ServiceDeployment


Ignore:
Timestamp:
11/16/10 18:29:58 (14 years ago)
Author:
Dave Morris
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ServiceDeployment

    v1 v1  
     1= Service deployment =
     2
     3There are several options as to how we deploy our services, ranging from a single large machine hosting all of our services to a distributed system with one service per host.
     4
     5My own view is that one service per host is probably the best option in terms of flexibility, reliability and security.
     6However, right now, I don't think we have enough hard evidence to be able to decide which configuration would be best.
     7In reality it will probably turn out that a mixture of services and hosts will provide the optimum solution, based on the performance, reliability and loading of each of our services.
     8
     9As a result, I would recommend we adopt a flexible approach to service deployment.
     10
     11By using the following simple set of components, we can develop a flexible deployment system that will enable us to adapt our deployment configurations to meet changes in available resources and service requirements.
     12
     13The proposed system would also enable us to deploy test services in a range of different configurations to compare different configurations and evaluate what the actual requirements are for each of our web services.
     14
     15== DNS aliases ==
     16
     17We (BRICCS) own the {{{briccs.org.uk}}} domain name.
     18This means that we can create as many host names or sub-domains that we need based on the {{{briccs.org.uk}}} domain.
     19
     20The first step in making our service deployments portable would be to use DNS aliases for our live services.
     21
     22A DNS alias is simply a registration for an alias that points to another host name.
     23{{{
     24    catissue.briccs.org.uk ---> briccs-3.rcs.le.ac.uk
     25}}}
     26
     27This has already been implemented for the BRICCS infrastructure services :
     28
     29 * Subversion repository {{{svn.briccs.org.uk}}}
     30 * Maven repository {{{mvn.briccs.org.uk}}} http://mvn.briccs.org.uk/
     31 * Install repository {{{data.briccs.org.uk}}} http://data.briccs.org.uk/
     32 * Trac issue tracking and wiki {{{trac.briccs.org.uk}}} http://trac.briccs.org.uk/
     33
     34 * Google Mail for the BRICCS team {{{mail.briccs.org.uk}}} http://mail.briccs.org.uk/
     35 * Google Docs for the BRICCS team {{{docs.briccs.org.uk}}} http://docs.briccs.org.uk/
     36
     37Using human readable DNS aliases for our services not only makes things easier for our end users (catissue.briccs.org.uk is easier to remember and check than briccs-3.rcs.le.ac.uk), it also gives us a degree of flexibility in terms of relocating our services.
     38
     39If we use DNS aliases for our live web services, we would be able to relocate our live CaTissue service from briccs-3 to briccs-1 without causing any side effects for  our end users.
     40All we would need to do is deploy the new service on briccs-1 and update the DNS alias to point to briccs-1 rather than briccs-3.
     41
     42Anyone who was using the alias name {{{catissue.briccs.org.uk}}} would automatically be directed to the new service, without having to update any of their bookmarks.
     43
     44If we don't adopt an alias system, then if we move our live CaTissue service from one machine to another we will have to verify that '''''all''''' of our users have updated '''''all''''' of their browser settings, and that no one has any old bookmarks, emails, notes or user documents that point to the old service.
     45
     46The worst case would be if we migrated our live service to briccs-1, and then re-purposed briccs-3 as a test and development machine.
     47If we later deployed a test version of CaTissuse on briccs-3, there could be cases where a user clicks on a link in an old email or an old copy of a user manual they would not realise that they were now using a test deployment of CaTissue rather than the live service.
     48
     49=== Deployment ===
     50
     51The DNS alias for {{{catissue.briccs.org.uk}}} is already in place, and we can add new ones whenever we need to.
     52
     53 * Using host name http://briccs-3.rcs.le.ac.uk:8080/catissuecore/
     54 * Using DNS alias http://catissue.briccs.org.uk:8080/catissuecore/
     55
     56=== DNS management ===
     57
     58The DNS settings for {{{briccs.org.uk}}} are currently handled by LCN (https://www.lcn.com/), the [[http://en.wikipedia.org/wiki/Domain_name_registrar DNS registrar]] we used to register the domain name.
     59
     60This was the quickest and easiest way to get things up and running.
     61Registering a new domain name through a commercial registrar typically takes less than 60 seconds to fill in the form and click 'Ok'.
     62
     63In the longer term we will probably want to transfer ownership of the DNS name to the university IT services.
     64Transferring the ownership of a registered DNS domain is a fairly simple operation.
     65
     66However, the ability to change the DNS aliases for our services forms part of our disaster recovery plan.
     67For example, if one of our web servers fails we may need to update the DNS alias to point to a new service quickly and easily.
     68
     69If we do decide to transfer the management of the {{{briccs.org.uk}}} domain to the university IT services we should check that we would still be able to make changes to the DNS information quickly and easily,
     70preferably out of normal office hours (see note on DNS caching).
     71
     72=== DNS caching ===
     73
     74Due to the way that the DNS system works, it would be inadvisable to change the DNS aliases for a live service during working hours, while people are actively using the system.
     75
     76DNS information is cached, typically up to 3 hours, both at the client (desktop) and at the network level (e.g. the DNS service at UHL).
     77
     78This means that if we changed a DNS name for a live service at mid-day, there would be a period of time, approximately 12:00 - 15:00, where we could not predict whether a client would get an old (cached copy) or the new setting.
     79
     80If we relied on DNS aliases alone to migrate services between hosts, this could result in some users using the new service and others still using the old service.
     81
     82Best practice is to change a DNS alias overnight, when as few people as possible are using the service, allowing at least 6 hours for the DNS changes to propagate through the system before the majority of users start to use the system.
     83
     84== Virtual hosts ==
     85
     86Both the Apache web server and Tomcat web server support virtual hosts.
     87
     88A virtual host is simply a way of linking a specific host name to a specific service handler :
     89{{{
     90    Requests for hostname [xxx.yyy.zzz] should be handled by [service]
     91}}}
     92
     93This allows us to set up specific handlers on our web servers that handle requests differently based on the server name in the request.
     94
     95For example, we could configure a single web server to handle requests for both a live and and a test system, routing them to the appropriate web application based on the hostname in the request.
     96{{{
     97    Requests for catissue.briccs.org.uk    should be handled by [live-service]
     98    Requests for testservice.briccs.org.uk should be handled by [test-service]
     99}}}
     100
     101
     102=== DNS aliases ===
     103
     104Using web server virtual hosts in combination with DNS aliases gives us much greater flexibility and finer grained control over where how our services are deployed.
     105
     106The previous section on DNS aliases outlined a problem with DNS caching, where changes to a DNS alias may take up to 3 hours to propagate through the system.
     107
     108By configuring the web servers to distinguish between requests for live or test systems based on the host name, we can ensure that even if a user get an out of date DNS record the web server won't let them use a test service by accident.
     109
     110=== Tomcat virtual hosts ===
     111
     112The Tomcat web server embedded in JBoss supports name based virtual hosts.
     113However, using virtual hosts at this level means that we are still tied to the machine that is hosting the Tomcat/JBoss service, and the non-standard port number normally allocated to Tomcat (port 8080).
     114
     115=== Apache virtual hosts ===
     116 
     117A better option is to use an Apache web server as the front end request handler, and use virtual hosts within the Apache service to delegate requests to the appropriate back-end server.
     118
     119Using an Apache web server as the front end to Tomcat/JBoss has a number of advantages:
     120
     121 * Standard port number
     122 * Delegate to local or remote Tomcat/JBoss
     123 * Better control over security of Tomcat/JBoss
     124
     125==== Standard port number ====
     126
     127The Tomcat server is normally deployed using a non-standard port number (port 8080), which means that all of our users have to add the port number in the address.
     128{{{
     129    http://catissue.briccs.org.uk:8080/
     130}}}
     131
     132Although it is possible to configure Tomcat to use the standard web server port, this does cause issues with the Unix permissions and security controls.
     133
     134The Apache web server is designed to use the standard web server network port, and the standard deployment tools for Apache handle the Unix permissions correctly.
     135
     136If we use an Apache web server as the front end request handler, then our services will be available via the standard port number (port 80).
     137
     138This simplifies the URL that our end users have to deal with, because we no longer need to specify the port number.
     139{{{
     140    http://catissue.briccs.org.uk:8080/catissuecore/
     141}}}
     142becomes
     143{{{
     144    http://catissue.briccs.org.uk/catissuecore/
     145}}}
     146 
     147==== Remote delegation ====
     148
     149The Apache module used to delegate requests can be configured to use a Tomcat/JBoss web service on the local machine, or to pass the request to a Tomcat/JBoss service on a different machine.
     150
     151This means that the end user is unaware of where the Tomcat/JBoss service is actually running, enabling us to relocate our live Tomcat/JBoss services with no impact on our end users.
     152
     153It may be useful to deploy all of the components on the same machine:
     154{{{
     155        DNS alias
     156 [catissue.briccs.org.uk]
     157        |
     158        |      +--------------+
     159        \----> |    Apache    |
     160               |  web server  |
     161               |       +--------------+
     162               +-------| virtual host |
     163                       |  AJP proxy   |
     164                       +--------------+
     165                               |
     166                               |       +--------------+
     167                               \---->  | Tomcat/JBoss |
     168                                       |  port 8080   |
     169                                       |      +--------------+
     170                                       +------|  CaTissue    |
     171                                              |   webapp     |
     172                                              +--------------+
     173}}}
     174If we want to upgrade the version of CaTissue, then we can deploy the new version on a new machine, leaving the old service in place.
     175
     176Once we have tested the new deployment, we can change the settings in the Apache web server to delegate requests to the new service.
     177{{{
     178        DNS alias
     179 [catissue.briccs.org.uk]
     180        |
     181        |      +--------------+
     182        \----> |    Apache    |
     183               |  web server  |
     184               |       +--------------+
     185               +-------| virtual host |
     186                       |  AJP proxy   |
     187                       +--------------+
     188                               |
     189                               |       old service deployment
     190                               |
     191                               |       +--------------+
     192                               |       | Tomcat/JBoss |
     193                               |       |  port 8080   |
     194                               |       |      +--------------+
     195                               |       +------| OLD CaTissue |
     196                               |              |   webapp     |
     197                               |              +--------------+
     198                               |
     199                               |
     200                               |       new service deployment
     201                               |
     202                               |       +--------------+
     203                               \---->  | Tomcat/JBoss |
     204                                       |  port 8080   |
     205                                       |      +--------------+
     206                                       +------| NEW CaTissue |
     207                                              |   webapp     |
     208                                              +--------------+
     209}}}
     210Changing the delegation settings in the Apache web server would take effect immediately, and all of our users would be connected to the new service.
     211
     212Note that in this scenario, the old service is left intact.
     213This means that if there are any unexpected problems with the new deployment we can swap back to the old service if we need to.
     214
     215== Recommendations ==
     216
     217If we are considering migrating our live CaTissue service from briccs-3 to briccs-1, then we will need to notify all our users of a change to the URL they should use.
     218
     219In which case, we should take the opportunity to put in place the following components in order to avoid similar problems in the future.
     220
     221 * Use the DNS alias catissue.briccs.org.uk for our live service
     222 * Install an Apache web server as the front end request handler
     223 * Update all our clients to use http://catissue.briccs.org.uk/catissuecore/
     224 
     225Once we have the above components in place, we will have a lot more flexibility as to where and how we deploy our services, without causing any side effects for our end users.
     226