Poor Man's Provisioning Platform ================================ This is (or will be) a set of simple runtime components for provisioning an OSGi node. The first (and so far only) component included is S3Install. S3Install ========= Modelled on "FileInstall" by Peter Kriens, S3Install manages the bundles installed in an OSGi runtime by continuously scanning a "bucket" on Amazon S3. The effect of this is as follows: 1. If you drop a new bundle JAR into a bucket, then all instances of S3Install monitoring that bucket will install and start that bundle. 2. If you drop an update to an existing bundle JAR into a bucket, then all instances of S3Install monitoring that bucket will update to the new version of the bundle 3. If you remove a bundle JAR from a bucket, then all instances of S3Install monitoring that bucket that previous installed the bundle will uninstall it. S3Install is intended for deploying bundles to one or more Amazon EC2 nodes. Each node should be setup with an OSGi framework and the S3Install bundle. IMPORTANT NOTE: S3Install works by polling the contents of an S3 bucket. IF YOU RUN THIS OUTSIDE AMAZON EC2 IT WILL COST YOU MONEY (albeit a very small amount). Running within EC2 will not incur data transfer charges, as transfers between EC2 and S3 are free, but of course the rental of the EC2 node itself will cost money. Building S3Install ------------------ ant clean bundles Trying out S3Install -------------------- You will need to use your own Amazon Web Services ID and Key. S3Install is configured via the Configuration Admin, so we need to create a file in the `load/` directory called `name.neilbartlett.s3install-<pid>.cfg`. Replace <pid> with an arbitrary identifier -- the number 1 will do for now. The content of the file should be as follows: s3id=your aws ID s3key=your aws Key bucket=your bucket name period=polling period in ms (default is 5000) You can run Equinox and install the S3Install bundle as follows: java -jar runtime/equinox.jar -console osgi> install file:load/s3install.jar Bundle id is 9 osgi> start 9 03-Mar-2009 20:54:30 name.neilbartlett.s3install.S3Scanner run INFO: Scanning bucket neilbartlett.name 03-Mar-2009 20:54:40 name.neilbartlett.s3install.S3Scanner run INFO: Scanning bucket neilbartlett.name ... Now you can try deploying a bundle to S3. A sample bundle was built by the ANT build, you can find it in `load/install-sample.jar`. Copy this into your S3 bucket using your favourite S3 client and you should soon see the bundle installed into your OSGi framework: 03-Mar-2009 21:01:42 name.neilbartlett.s3install.S3Scanner run INFO: INSTALLING BUNDLE: s3:neilbartlett.name/install-sample.jar 03-Mar-2009 21:01:42 name.neilbartlett.s3install.S3Scanner run INFO: Bundle ID is 10 The sample bundle provides a console command that we can test from the OSGi console: osgi> sayHello Hello World! Try updating the class `HelloCommand` to change the message that the command prints. Then rebuild the sample bundle and redeploy it to S3. We should see a message from S3Install; after this we can test whether the message has changed: 03-Mar-2009 21:02:53 name.neilbartlett.s3install.S3Scanner run INFO: UPDATING BUNDLE: s3:neilbartlett.name/install-sample.jar osgi> sayHello Guten Tag! Monitoring Multiple Buckets --------------------------- You can monitor an arbitrary number of S3 buckets simply by creating additional `.cfg` files in the `load/` directory, as long as you change the filename suffix after the hyphen. These files can be created, removed and updated at any time -- S3Install will update itself on the fly.