wiki/amazon-ec2.md
... ...
@@ -277,6 +277,28 @@ Amazon ELB is designed to handle unlimited concurrent requests per second with
277 277
278 278
To launch a local MongoDB instance on the default port, enter a command such as `mkdir /home/sailing/mongodb; /opt/mongodb-linux-x86_64-1.8.1/bin/mongod --dbpath /home/sailing/mongodb`. To make sure the process survives log-off, you may want to launch it in a tmux session. See above for how to create a tmux session. In an existing tmux session, a new window can be created using `Ctrl-a c`.
279 279
280
+### Upgrade the Sailing Analytics App AMI image
281
+
282
+There are a number of use cases that suggest an upgrade of the AMI that we use to start new SAP Sailing Analytics instances. One can be that we want to add or modify the set of SSH keys authorized for access to the root and sailing accounts. Another can be that we would like to upgrade the git contents under `~sailing/code` for an update to the `/etc/init.d/sailing` or the `/home/sailing/code/java/target/refreshInstance.sh` script that is central to the automated launch process of a new instance. Another use case can be applying an upgrade to the underlying operating system (currently CentOS).
283
+
284
+Follow these steps to upgrade the AMI:
285
+
286
+* Launch a new instance based on the existing AMI
287
+* Log in as user `root`
288
+* Run `yum update` to update the operating system
289
+* Remove any obsolete logs from `/home/sailing/servers/server/logs`
290
+* Update the git contents (essential for up-to-date versions of `/etc/init.d/sailing` which links to the git, and the `refreshInstance.sh` script used during automatic instance launch) and clean any build artifacts by doing <pre>
291
+ su - sailing
292
+ cd code
293
+ mvn clean
294
+ git fetch
295
+ git merge origin/master</pre>
296
+* Check the sizes of the mounted partitions by doing `df; swapon -s`. These will come in handy after creating the new AMI in order to tag the new volume snapshots accordingly
297
+* Update any keys in `/root/.ssh/authorized_keys` and `/home/sailing/.ssh/authorized_keys`
298
+* In the EC2 administration console go to the "Instances" tab, select your running instance and from the "Actions" drop-down select "Create Image". Give the image the name "SAP Sailing Analytics App x.y" where "x.y" is the updated version number of the image. Just make sure it's greater than the previous one. If you feel like it, you may provide a short description telling the most important features of the image.
299
+* Once the image creation has completed, go to the Snapshots list in the "Elastic Block Store" category and name the new snapshots appropriately. Now the information about the device sizes obtained earlier from the `df` and `swapon` commands will help you to identify which snapshot is which. Usually, the three snapshots would be something like AMI Analytics Home x.y, AMI Analytics System x.y and AMI Analytics Swap x.y with "x.y" being the version number matching that of your image.
300
+* Now you can remove any earlier Sailing Server AMI version and the corresponding snapshots.
301
+
280 302
## Migration Checklist
281 303
282 304
### Before switching sapsailing.com to the EC2 webserver