|
|
BROWSE
All Titles WordPress Web Services SOA BPEL Web Graphics & Video Web Development RAW Portugues, Espanol, Italiano PHP/MySQL Oracle Open Source Networking & Telephony Moodle Microsoft & .NET Linux Servers Joomla! JBoss Java e-Commerce Drupal CRM Content Management Beginner Guides Architecture and Analysis AJAX Future Titles Recently Published Titles |
Xen Virtualization: Work with MySQL Server, Ruby on Rails, and Subversion
Base Appliance ImageWe will use an Ubuntu Feisty domain image as the base image for creating these appliances. This image should be made as sparse and small as possible, and free of any cruft. A completely stripped down version of Linux with only the bare necessities would be a great start. In this case, we will not need any graphical desktop environments, so we can completely eliminate software packages like the X11 and any window manager like Gnome or KDE. Once we have a base image, we can back it up and then start using it for creating Xen appliances. In this article we will use an Ubuntu Feisty domain as the base image. Once this domain image is ready we are going to update it and clean it up a little bit so it can be our base.
![]() Now we have the base appliance image ready, we will use it to create some Xen appliances. You can make a backup of the original base image and every time you create an appliance you can use a copy as the starting point or template. The images are nothing but domU images, which are customized for running only specific applications. You start them up and run them like ay other Xen guest domains. MySQL Database ServerMySQL is one of the most popular open-source databases in the world. It is a key component of the LAMP architecture – (Linux Apache MySQL and PHP). It is also very easy to get started with MySQL and is one of the key factors driving its adoption across the enterprise. In this section we will create a Xen appliance that will run a MySQL database server and also provide the ability to automatically backup the database on a given schedule. Time for Action – Create our first Xen applianceWe will use our base Ubuntu Feisty domain image, and add MySQL and other needed software to it. Please ensure that you have updated your base image to the latest versions of the repositories and software packages before creating this appliance.
45 5 * * * root /opt/automysqlbackup.sh >/dev/null 2>&1 Now we have a MySQL database server with automatic daily backups as a nice reusable Xen appliance. What just happened?We created our first Xen appliance! It is running the open-source MySQL database server along with an automated backup of the database as per the given schedule. This image is essentially a domU image and it can be uploaded along with its configuration file to a repository somewhere, and can be used by anyone in the enterprise or elsewhere with their Xen server. You can either start up the domain manually as and when you need it or set it up to boot automatically when your xend server starts. Ruby on Rails ApplianceRuby on Rails is one of the hottest web development frameworks around. It is simple to use and you can use all the expressive power of the Ruby language. It provides a great feature set and has really put the Ruby language on the map. Ruby on Rails is gaining rapid adoption across the IT landscape and for a wide variety of web applications. In this section, we are going to create a Rails appliance that contains Ruby, Rails, and the Mongrel cluster for serving the Rails application and nginx web server for the static content. This appliance gives you a great starting point for your explorations into the world of Ruby on Rails and can be an excellent learning resource. Time for Action – Rails on XenWe will use our base Ubuntu Feisty domain image and add Rails and other needed software to it. Please ensure that you have updated your base image to the latest versions of the repositories and software packages before creating this appliance.
$ rails xenbook
Books from Packt
#/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_
# mv ~pchaganti/xenbook /var/www
# mkdir /etc/mongrel_cluster # cd /etc/mongrel_cluster # ln –s /var/www/xenbook/config/mongrel_cluster.yml
# /etc/init.d/nginx stop
user www-data www-data;
# /etc/init.d/nginx start
We have successfully setup our Rails application serving up the Rails pages using a cluster of Mongrels for dynamic data and nginx for super fast static web serving. What just happened?We installed everything needed to run a simple Rails application on our appliance image. We installed Ruby along with its development libraries. These libraries are needed when compiling Ruby extensions. We also installed the compilers and associated packages needed for doing the actual compilations on our image. We installed the RubyGems package. RubyGems are somewhat analogous to the jar files in the Java world and the egg packaging format used in the Python world. They are a simple way to package Ruby extensions and libraries into one downloadable archive. This archive contains metadata describing how to actually lay it down on a target system and how to compile any native extensions if needed. Most of the software libraries and applications in the Ruby world are distributed using this mechanism these days. We installed Rails, Mongrel and mongrel_cluster using their gems. Mongrel is the replacement web server for webrick which is tightly integrated with Rails and is able to serve up Rails application in a much more performant manner. The recommended and scalable way of using Mongrel is to cluster it and use a pack of running Mongrel processes for serving a Rails application. We then finally installed nginx. It is a super fast web server and reverse proxy. It has a very small footprint and is able to serve static items much faster than either Apache or lighttpd. It is fast becoming the favored way to deploy a Rails application with a cluster of Mongrels. We configured everything to work together and voila! We have a Ruby on Rails Xen appliance ready for serving up your Rails applications in a Xen environment! Subversion ApplianceSubversion is an open-source revision control system that was designed to be a simple and efficient alternative to CVS. It is widely used in the open-source community and a lot of high profile projects such as KDE have switched over to it recently. In this section we are going to create a Xen appliance that contains Subversion and Apache. This appliance can be used by your development team or you can use it for playing with and experimenting with Subversion itself. Time for Action – A revision control applianceWe will use our base Ubuntu Feisty domain image and add Subversion and other needed software to it. Please ensure that you have updated your base image to the latest versions of the repositories and software packages before creating this appliance.
# /etc/init.d/apache2 restart
# svn import --username pchaganti xenbook_draft.pdf
What just happened?We created a Xen appliance that provides a Subversion repository that is served by Apache2 using a basic authentication scheme. We strove for simplicity in this appliance and did not try to add and use all of the myriad things that are possible using SVN and Apache2. The idea is to show you how simple it is to get started with using Subversion. You can experiment with Subversion and add functionality that you need and extend this appliance as you go. SummaryIn this article, we explored the use of Xen appliances to provide targeted pieces of functionality in small ready to use packages. They are a simple way to share and reuse your domU images that are customized for providing a certain use. In this article, we created these appliances:
For more information, please visit: www.PacktPub.com/xen-virtualization-open-source-linux-servers/book About The AuthorPrabhakar Chaganti is the CTO of HelixBrain—a unique startup that provides technology services consulting and is also an incubator nurturing some very cool software as service applications that are being built on the Ruby on Rails platform. His interests include Linux, Ruby, Python, Java and Virtualization. He recently won the community choice award for the most innovative virtual appliance in the 2006 VMWare Ultimate Global Virtual Appliance Challenge. Read about his tips on time management...Books from Packt |
BOOK ![]() Xen Virtualization See More BOOK ![]() Mastering OpenLDAP: Configuring, Securing and Integrating Directory Services See More BOOK ![]() Linux Thin Client Networks Design and Deployment See More |
| ||||||||