Automating infrastructure is not a new thing, but doing so with the ease of setting up paas is still in its infancy. As an interesting solution to this, Cannonical has recently come out with a PAAS tool Juju that can easily setup, configure, provision, include and change master/slaves, provide continuous integration environment among other things. This tool has not come out from wild, but is currently in use: Juju and MaaS are the default deployers for Openstack. So all large Openstack deployments that are currently happening on Ubuntu use Juju and MaaS. Additionally Ubuntu One and other Ubuntu cloud services are all running on top of Juju.
Juju might sound similar to Puppet or Chef, but rather than just providing a server, this provides various services. Internal to each juju are different charms that call various programs and provide the infrastructure to the juju. The charms App Store contains charms on various services which can be used in the juju to solve a particular task. There are currently hundreds of different charms available - from databases to php/ruby/python servers to nosql and hadoop instances and a growing community of developers who customize and release their own customized charms.
One feature that is worth mentioning is the ability to create a traditional Paas such as CloudFoundary as a charm to run over juju.
For instance, here's the procedure to boot off a rails sever:
juju deploy rails myapp --config sample-app.yml
(This yml file contains the url to the github repository containing the charm)
juju deploy haproxy
juju add-relation haproxy myapp
Now the database can be created:
juju deploy postgresql
juju add-relation postgresql:db myapp
then migrate the database
juju ssh myapp/0 run rake db:migrate
Finally expose the proxy
juju expose haproxy
and view the status, which should provide you with the public url
juju status haproxy
The coolest feature now is to add/remove servers horizontally through gui or through command as:
juju add-unit myapp
juju remove-unit myapp
Currently, there is also a charm-championship taking place that encourages developers to take part in developing customized charms for various themes.
So what are you waiting for?
Jump right in at https://jujucharms.com to see it in action.
Musings on computers and software as I continue learning and sharing software development knowledge.
Showing posts with label cloud deployment. Show all posts
Showing posts with label cloud deployment. Show all posts
Friday, September 27, 2013
Wednesday, July 31, 2013
Performing cron jobs in rails through clockwork
The Clockwork Gem allows us to run cron jobs in a ruby application. Since I was using this today, its documentation is a bit of a blocker. The github wiki gives the following example:
As this application is to be deployed over heroku, we need to have 2 dynos, one for the rails and another for the extra task. We define this through Procfile file present at rails root with the following contents:
require 'clockwork'
include Clockwork
handler do |job|
puts "Running #{job}"
end
every(10.seconds, 'frequent.job')
every(3.minutes, 'less.frequent.job')
every(1.hour, 'hourly.job')
every(1.day, 'midnight.job', :at => '00:00')
However, I needed to run custom tasks, which is not mentioned there. Here's how I did the necessary workrequire_relative "../config/environment"
require_relative "../config/boot"
require 'clockwork'
include Clockwork
handler do |job|
puts "running the scheduled job #{job}."
end
every(30.seconds, 'test job execution'){Module::Class.new.method_to_call}
I added the require_relative calls to environment.rb & boot.rb to load the rails framework from this clock.rb file, which is placed in lib folder. This example is calling a custom module placed in the lib folder in the same rails app.As this application is to be deployed over heroku, we need to have 2 dynos, one for the rails and another for the extra task. We define this through Procfile file present at rails root with the following contents:
web bundle exec unicorn -p $PORT -c ./config/unicorn.rb
clock bundle exec clockwork app/lib/clock.rb
Which does the necessary things for me at heroku. To run long running tasks, you may want to use delayed jobs, but it will involve another dyno for management so I left it in this solution.
Labels:
clockwork gem,
cloud deployment,
cronjob,
heroku,
rails,
rails4
Tuesday, July 31, 2012
VM management with Vagrant
Setting up a virtualized environment on your own machine is always a headache inducing and risky setup. However, with virtualbox, one can use the vms without changing the OS internals (such as in Xen). The chief disadvantage of using virtualbox directly is that the virtual machine quickly escalates to a huge scale, and if you are cloning/ distributing your virtual machine, it easily becomes a hassle involving both the VM and its virtual hard disk.
However, with Vagrant, one can quickly create, configure and delete virtual machines, similar to a professional cloud environment like Amazon.
According to their documentation; ' Vagrant gives you the tools to build unique development environments for each project once and then easily tear them down and rebuild them only when they’re needed so you can save time and frustration.'. The documentation starts with a 5 minute tutorial that demonstrates how easy it is to setup, connect and configure different VM instances.
The configuration is handled by a vargant file, which is a ruby DSL.For the GUI inclined people, Vagrant can also be configured by different provisioners like Puppet or Chef. Thus, developers and project managers can quickly configure and setup environments for different projects.
By easily enabling the developer to directly configure the VM, the development process can be streamlined, in principle with the DevOpts movement.
However, with Vagrant, one can quickly create, configure and delete virtual machines, similar to a professional cloud environment like Amazon.
According to their documentation; ' Vagrant gives you the tools to build unique development environments for each project once and then easily tear them down and rebuild them only when they’re needed so you can save time and frustration.'. The documentation starts with a 5 minute tutorial that demonstrates how easy it is to setup, connect and configure different VM instances.
The configuration is handled by a vargant file, which is a ruby DSL.For the GUI inclined people, Vagrant can also be configured by different provisioners like Puppet or Chef. Thus, developers and project managers can quickly configure and setup environments for different projects.
By easily enabling the developer to directly configure the VM, the development process can be streamlined, in principle with the DevOpts movement.
Labels:
cloud,
cloud deployment,
Devopts,
Vagrant,
virtualization
Thursday, June 28, 2012
Appharbor: Heroku's cousin for .NET ?
These days, I am exploring appharbor, the PAAS for .net based runtime, which was reviewed in Thoughtworks tech radar publication recently.
My initial experiences have been good while working with the service and utilizing various addons, most of which are free to use for limited uses.
Setting up the application was easy and I used one of their example to play around and learn at the same time.
Check my application out for more details.
https://github.com/SumitBisht/MvcMongoDbTestApplication
My initial experiences have been good while working with the service and utilizing various addons, most of which are free to use for limited uses.
Setting up the application was easy and I used one of their example to play around and learn at the same time.
Check my application out for more details.
https://github.com/SumitBisht/MvcMongoDbTestApplication
Labels:
.net cloud development,
appharbor,
cloud deployment
Subscribe to:
Posts (Atom)