Recently, I did a blog discussing how to deploy a Jenkins server using Stackato, running on Eucalyptus. At the end of that blog, I mentioned how the Eucalyptus Community Cloud (ECC) could be used for testing out the Stackato Microcloud image on Eucalyptus. The previous blog – I felt – was more for DevOps administrators who had access to their own on-premise Eucalyptus clouds. The inspiration of this blog comes from the blog on ActiveBlog entitled “Deploy & Scale Drupal on Any Cloud with Stackato” to show love to Web Developers, and show the power of Amazon’s Route 53.
Test Drive Pre-Reqs
The prerequisites for this blog are the same that are mentioned in my previous blog regarding using Stackato on Eucalyptus (for the Eucalyptus pre-reqs, make sure the ECC is being used). In addition to the prerequisites mentioned above, the following is needed:
After the prerequisites have been met, its time to setup the Drupal environment.
Test Drive Engage!
Since the ECC is being used, there is no need to worry about bundling, uploading and registering the Stackato image. The Stackato image used for this blog is as follows:
IMAGE emi-859B3D5C stackato_v2.6.6/stackato-cloudinit.manifest.xml
150820662310 available public x86_64 machine eki-6FBE3D2D eri-67463B77 instance-store
Next, lets make sure the user has an elastic IP that will be used in AWS Route 53, and a security group to allow proper network traffic to the instance. Do the following:
- Make sure the user credentials are sourced correctly, and euca2ools is installed correctly.
- Grab an elastic IP using euca-allocate-address (in this example 126.96.36.199 was allocated):
# euca-allocate-address ADDRESS 188.8.131.52
- If the user already doesn’t have a keypair, create a keypair for the user by using euca-create-keypair, and make sure the permission of the file is 0600:
# euca-create-keypair hspencer-stackato > hspencer-stackato.priv # chmod 0600 hspencer-stackato.priv
- Create a security group for the instance to use:
# euca-create-group stackato-test -d "Test Security Group for Stackato PaaS" GROUP stackato-test Test Security Group for Stackato PaaS
- Authorize ping, ssh, http, and https ports:
# euca-authorize -P icmp -t -1:-1 -s 0.0.0.0/0 stackato-test GROUP stackato-test PERMISSION stackato-test ALLOWS icmp -1 -1 FROM CIDR 0.0.0.0/0 # euca-authorize -P tcp -p 22 -s 0.0.0.0/0 stackato-test GROUP stackato-test PERMISSION stackato-test ALLOWS tcp 22 22 FROM CIDR 0.0.0.0/0 # euca-authorize -P tcp -p 80 -s 0.0.0.0/0 stackato-test GROUP stackato-test PERMISSION stackato-test ALLOWS tcp 80 80 FROM CIDR 0.0.0.0/0 # euca-authorize -P tcp -p 443 -s 0.0.0.0/0 stackato-test GROUP stackato-test PERMISSION stackato-test ALLOWS tcp 443 443 FROM CIDR 0.0.0.0/0
- Now, launch the instance, specifying the keypair name to use, and a VM type. On the ECC, only m1.xlarge and c1.xlarge meet the requirements of launching the Stackato image:
# euca-run-instances -k hspencer-stackato -t c1.xlarge emi-859B3D5C -g stackato-test RESERVATION r-66EE4030 628376682871 stackato-test INSTANCE i-E85843C4 emi-859B3D5C euca-0-0-0-0.eucalyptus.ecc.eucalyptus.com euca-0-0-0-0.eucalyptus.internal pending hspencer-stackato 0 c1.xlarge 2013-02-24T19:40:35.516Z partner01 eki-6FBE3D2D eri-67463B77 monitoring-disabled 0.0.0.0 0.0.0.0 instance-store
- Once the instance gets to a running state, associate the elastic IP that the user owns to the instance:
# euca-describe-instances RESERVATION r-66EE4030 628376682871 stackato-test INSTANCE i-E85843C4 emi-859B3D5C euca-173-205-188-106.eucalyptus.ecc.eucalyptus.com euca-10-9-190-24.eucalyptus.internal running hspencer-stackato 0 c1.xlarge 2013-02-24T19:40:35.516Z partner01 eki-6FBE3D2D eri-67463B77 monitoring-disabled 184.108.40.206 10.9.190.24 instance-store # euca-associate-address -i i-E85843C4 220.127.116.11 ADDRESS 18.104.22.168 i-E85843C4 # euca-describe-instances RESERVATION r-66EE4030 628376682871 stackato-test INSTANCE i-E85843C4 emi-859B3D5C euca-173-205-188-105.eucalyptus.ecc.eucalyptus.com euca-10-9-190-24.eucalyptus.internal running hspencer-stackato 0 c1.xlarge 2013-02-24T19:40:35.516Z partner01 eki-6FBE3D2D eri-67463B77 monitoring-disabled 22.214.171.124 10.9.190.24 instance-store
- Log into the AWS management console, select Route 53, and setup the A and CNAME records in your domain as mentioned here under the Stackato Documentation regarding detailed DNS configuration. In this example, the DNS name associated with the elastic IP 126.96.36.199 is stackato-dev.mindspew-age.com.
- Next ssh into the instance, and proceed to follow the steps for setting up the Stackato instance that is mentioned in my previous blog under the section Configuration of the Stackato Instance. Make sure the DNS name setup in AWS Route 53 is used with “kato rename public-DNS-name” and “kato setup core api.public-DNS-name” configuration steps.
- After the instance is configured, just open up the browser and go to the DNS name set up for the Stackato instance in AWS Route 53, as mentioned in the Stackato Documentation regarding configuration via the Management Console.
- Once logged into the Stackato Management Console, select “App Store” in the lefthand menu and select “Drupal” to install
- After Drupal has installed, start the application. Once it has started successfully, select the URL that shows up in the right-hand menu box. The Drupal log-in page will appear in your browser
Thats it! Now Drupal is ready for any web developer to test out on the ECC. If there is any questions/comments/suggestions, please feel free to leave comments. Enjoy!
An extendable open source continuous integration server.
The Enterprise Private PaaS that makes it easy to deploy, manage, and monitor applications on any cloud.
The Ubuntu package that handles early initialization of a cloud instance. It is installed in the Ubuntu Cloud Images and also in the official Ubuntu images available on EC2.
Allows you to build production-ready, AWS-compatible private and hybrid clouds by leveraging your existing virtualized infrastructure to create on-demand cloud resource pools.
What happens when you combine all three of these tools? A potent combination for continuous integration on a easy-to-configure PaaS and an on-premise, AWS-compatible IaaS. With this combination, developers can take advantage of easy configuration that Stackato brings to the table, running on top of Eucalyptus – bringing an AWS-like cloud environment into your datacenter.
This blog entry will discuss the steps that I took to get Jenkins installed on a Stackato instance store-backed instance running on Eucalyptus. But before I get started, I would like to thank the folks from ActiveState for all their guidance. Their support staff is really top notch, and very helpful. Check them out in #stackato on freenode.net. They can also be checked out on Twitter at @ActiveState. Now on to the dirty work…..
The Recipe for Success
The Stackato Microcloud Image and Cloud-Init
To begin, the following is needed:
- A running Eucalyptus cloud
- User credentials and proper Eucalyptus IAM policies to allow uploading of images and launching instances. (If there is more information needed here, please check out the Managing Access section in Eucalyptus 3.2 Administrator’s Guide.)
- the Stackato Mircocloud VM for KVM
- A Linux desktop with euca2ools installed.
After downloading the Stackato VM for KVM and unzipping the file, we will need to pull out the root file system, the kernel and ramdisk. These will be uploaded, bundled and registered as the EMI, EKI, and ERI. To extract the root filesystem, do the following:
- Use parted to locate the root filesystem as follows:
# parted stackato-img-kvm-v2.6.6.img GNU Parted 2.1 Using /root/images/Stackato-VM/stackato-img-kvm-v2.6.6.img Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) U Unit? [compact]? b (parted) p Model: (file) Disk /root/images/Stackato-VM/stackato-img-kvm-v2.6.6.img: 10737418240B Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 1048576B 200278015B 199229440B primary ext3 boot 3 200278016B 1237319679B 1037041664B primary linux-swap(v1) 2 1237319680B 10736369663B 9499049984B primary ext4 (parted) quit
- In this example, the root filesystem is partition 2. The value for “Start” and “Size” will need to be used. Next, run dd to extract the root filesystem:
dd if=stackato-img-kvm-v2.6.6.img of=stackato-rootfs.img bs=1 skip=1237319680 count=9499049984
- Once it has completed, mount stackato-rootfs.img to the loopback device:
mount -o loop stackato-rootfs.img /mnt/
- Copy out initrd.img-3.2.0-27-virtual and vmlinuz-3.2.0-27-virtual from /mnt/boot.
- In /mnt/etc/fstab, replace the UUID entry with LABEL. The LABEL will look simliar to the following:
LABEL=cloudimg-rootfs / ext4 defaults 1 1
- Chroot to /mnt – there may be a need to do a mount -o bind for sys, dev, and proc.
- Run “dpkg-reconfigure cloud-init”, and make sure that the EC2 Data Source is selected.
- Unmount stackato-rootfs.img (if sys, dev, and proc were mounted, unmount them before unmounting stackato-rootfs.img). After it has been unmounted, run tune2fs to change the label of the image:
tune2fs -L cloudimg-rootfs stackato-rootfs.img
After following these steps, the following should be available:
- initrd.img-3.2.0-27-virtual – to be bundled, uploaded and registered as the ERI
- vmlinuz-3.2.0-27-virtual – to be bundled, uploaded and registered as the EKI
- stackato-rootfs.img – to be bundled, uploaded and registered as the EMI
Launching the Stackato Image
Now its time to launch the Stackato image on Eucalyptus. Since cloud-init has the enabled EC2 data source now, when the image is launched, the instance will grab ssh keys, and mount the ephemeral storage. Also, additional configuration can be passed using the user-data file option. More information regarding this can be found on Stackato’s documentation in reference to using cloud-init. Key thing to remember here is that the minimum RAM requirement for the Stackato image is 2 gigs. Make sure the VM type used for launching the Stackato image has at least 2 gigs of RAM or more. In this example, the image ID is emi-DAB23A8A. The ramdisk and kernel are registered as eri-9B453C09 and eki-ADF640B0. The VM type c1.xlarge is used, which has 4 CPU, 4096 MB of RAM, and 50 Gigs of disk space.
euca-run-instances -k admin emi-DAB23A8A -t c1.xlarge --kernel eki-ADF640B0 --ramdisk eri-9B453C09
Use euca-describe-instances to check to see when the instance reaches a running state:
euca-describe-instances i-100444EF RESERVATION r-CC69438B 345590850920 default INSTANCE i-100444EF emi-DAB23A8A euca-192-168-55-104.wu-tang.euca-hasp.eucalyptus-systems.com euca-10-106-101-17.wu-tang.internal running admin 0 c1.xlarge 2013-02-23T00:34:07.436Z enter-the-wu eki-ADF640B0 eri-9B453C09 monitoring-disabled 192.168.55.104 10.106.101.17 instance-store
The key thing for running a Stackato instance is setting up the correct DNS entries. For more information regarding setting up DNS with regards to a Stackato instance, please read the Detail Configuration section on DNS in the Stackato online documentation. For this example, instead of using an external DNS service using a tool like nsupdate, to configure the A record and CNAME records, we will use xip.io. xip.io is a magic domain name that provides wildcard DNS for any IP address. Next, its time to configure the Stackato instance.
Configuration of the Stackato Instance
To configure the Stackato instance, do the following:
- SSH into the instance.
ssh -i creds/admin.priv email@example.com
- Make note of the ip address associated with eth0 and the netmask using ifconfig. Also note the gateway IP by using the route command.
- Run “kato op static_ip” to configure the static IP address for eth0. Make sure and add 127.0.0.1 as the first entry as part of the nameservers, and add “containers.” as the first entry under the search domains.
- Run “kato rename public DNS name “, where public DNS name includes the public IP of the instance, using xip.io (e.g. 192.168.55.104.xip.io)
- Run “kato disable mdns”, then run “sudo reboot” to reboot the instance.
- Once the instance has come back up, ssh into the instance, and run the following command ”kato setup core api.public DNS name” where public DNS name is the same value used for the “kato rename” step (e.g. 192.168.55.104.xip.io).
- Next, edit /etc/resolv.conf and make sure that the value for the search option is “containers.”, and the first entry for the nameservers is 127.0.0.1.
- Finally, run “kato enable –all-but mdns”
Thats it! Now go to the public DNS name that was used in your favorite browser. For this example, 192.168.55.104.xip.io was used. The following landing page should look similar to what you see here in the Stackato documentation regarding accessing the instance through the management console.
Setting Up Jenkins
After setting up the admin account, navigate to the “App Store” on the lefthand menu. Once selected, navigate to find the Jenkins application:
After selecting to install Jenkins, select “Yes” to install. After the installation takes place, select “Applications” in the left hand menu. From there, select the Jenkins application, and select “Start” (its the green arrow to the right of the application window). Once it has started, you will see the following:
Now Jenkins is ready to be used.
If anyone wants to test this out on Eucalyptus but doesn’t have access to their own Eucalyptus cloud, fear not, the Eucalyptus Community Cloud has the Stackato image available. After applying to get access to the Community Cloud, follow the steps above. The image for Stackato is as follows:
IMAGE emi-859B3D5C stackato_v2.6.6/stackato-cloudinit.manifest.xml 150820662310 available public x86_64 machine eki-6FBE3D2D eri-67463B77 instance-store
And as always, this image and steps can be used on AWS EC2 as well.
Let me know if there are any questions. Feedback is always welcome. Enjoy!
Euca2ools 3 – Making it easier to work in a hybrid cloud environment with Eucalyptus and AWS
Originally posted on /dev/zero:
Version 3 of euca2ools, slated for release in just a couple months, gives the command line suite a much-needed refresh that makes it both easier to write and easier to use. Most of the innovation here involves changes to the platform upon which it is built. I will cover those changes from a developer’s perspective in future blog posts, but today I’m going to focus on what euca2ools 3 brings to the table for developers and other users alike. While there are too many small improvements to possibly cover them all, euca2ools 3 at last brings a few of the niceties power users have come to expect from their command line tools to cloud management.
A configuration file
Yes, you read that right: a configuration file. Both euca2ools and the command line tools provided by AWS themselves have astonishingly limited support for configuration, forcing people to resort to writing a separate shell script for each combination of users and clouds one might possibly want to access and then use them in place of one.
Nice write-up on first time experience writing an Ansible module. Good stuff!
Originally posted on Take that to the bank and cash it!:
As is probably quite evident, I’ve recently been using Ansible to deploy workloads into EC2 and Eucalyptus. One of the ideas behind this is the convenience of being able to leverage the common API to achieve a hybrid deployment scenario. Thanks to various folk (names mentioned in previous posts) we have a solid ec2 boto-based Python module for instance launching. One thing I wanted to do when spinning up instances and configuring a workload was to add some persistent storage for the application. To do this I had to create and attach a volume as a manual step or run a local_action against euca2ools. I figured I could try to write my own module to practice a bit more python (specifically boto). The result is something terribly (perhaps in more ways that one?) simple but I think this is a testament to just how easy it is to write modules for Ansible (p.s it doesn’t need to be Python)
The resulting doc bits are here: http://ansible.cc/docs/modules.html#ec2-vol whilst the code lives here: https://github.com/ansible/ansible/blob/devel/library/ec2_vol
In a future post I’ll write a little bit about how it works, hopefully this can inspire other folks to try writing some additional EC2 modules for Ansible
Just read this latest blog from Brian Thomason, Engineer at Eucalyptus System, Inc. He leads us to the promise land on how to create your own debian packages for Eucalyptus 3.2.
Who knows, maybe he will follow up with a blog discussing how to use Walrus buckets to serve up the APT repository – similar to what can done with Amazon S3. Make sure and visit Brian’s blog entry. Any feedback will be greatly appreciated! Keep up the good work Brian!
More Ansible Love with AWS and Eucalyptus!
Originally posted on Take that to the bank and cash it!:
My previous post talked a little bit about new functionality from (new and updated) ec2-related modules in the Ansible 1.0 release. In this post I’ll go through the practical example of launching multiple instances with the ec2 module and then configuring them with a workload. In this case the workload will be the Eucalyptus User Console
For those who are unfamiliar with ansible, check out the online documentation here. The documentation itself is in a pretty good order for newcomers, so make sure to take it step by step to get the most out of it. Once you’ve finished you’ll then come to realise how flexible it is but hopefully also how *easy* it is.
To launch my instances and then configure them, I’m going to use a playbook. For want of a better explanation a playbook is a yaml formatted file containing a series of tasks which orchestrate a configuration or deployment process. The playbook can contain multiple plays, these are separate sections of the playbook (perhaps for logical reasons) which target specific hosts or groups of hosts.
Good AWS + Eucalyptus Love with Ansible!
Originally posted on Take that to the bank and cash it!:
You may be forgiven for thinking that a version 1.0 software release indicates some sort of significant milestone for the lifecycle of a project. Perhaps in many cases it does but with Ansible, not so much. Michael DeHaan articulates it much better than I could in this post to the project mailing list. My personal experience from using Ansible since v0.8 is that each release delivers consistency, quality and increased flexibility. It’s great to see fast releases delivering something which is incrementally more useful and enjoyable to use. There’s always new handy stuff in each release.
For those using AWS and Eucalyptus, Ansible 1.0 is a perfect example of incremental AWSomeness (geddit?!). Along with a host of other improvements it delivers the following for AWS/Eucalyptus users:
- An updated ec2 module; ported to boto by our very own tgerla and now with the capability to launch multiple instances. It works a treat and now you can deploy many instances and configure them all with simple plays. This brings direct dependencies of boto and m2crypt but looses the dependency of euca2ools. Huge thanks to skvidal here for his counsel.
- A new ec2_facts module written by silviud, this pulls the same information that facter would from an instance (basically all the metadata). Advantage being re-use of the facts in a playbook and of course not requiring facter and its ruby dependencies to be installed in the instance.
Better still, ec2-related stuff in Ansible is becoming even more popular. Just recently the module was again updated to support tagging (although this won’t be out-of-the-box until 1.1)!