Showing posts with label Hosting. Show all posts
Showing posts with label Hosting. Show all posts

Tuesday, October 30, 2012

BitNami JRuby Stack 1.7.0 released! Run Your JRuby App in the Cloud

A week ago, JRuby 1.7.0 was released. We have been anxiously awaiting this release and have updated the BitNami JRuby Stack to include this new version. We have also updated other major components of the Stack, including Tomcat 7 and Java 7, rails 3, bundler and other useful gems. As with all BitNami Stacks, you can get the latest JRuby Stack for free as a native installer, virtual appliance or AMI for the Amazon cloud.

The BitNami JRuby Stack now defaults to 1.9 mode, but it is both Ruby 1.8 & Ruby 1.9 compatible and both versions of Ruby are bundled in a single install. JRuby 1.7 is the first release to support the new “invokedynamic” feature of the JVM. For more details, see the JRuby Release notes.

Let's take a quick look at the latest JRuby release. For that, we will launch a BitNami JRuby Stack AMI. Later, we can use this same AMI to host our application in production in the cloud. To follow along, you will need an Amazon account to access the Amazon Web Services (AWS) Console. Instructions on how to create your account can be found here (note that Amazon offers a free tier which provides you with a free micro instance for a year). Once you login to the AWS Console, go to the EC2 tab and launch a new Instance. You can locate the BitNami JRuby Stack image by searching in the Community AMIs tab for "jrubystack-1.7.0-0", which is the latest version at the time of this writing.


Another option is to launch your AMI directly from the BitNami website. Select your preferred region (United States, Europe or Asia) from the drop down menu and the architecture (32 or 64 bits) and click on the appropriate link as shown in the image below.


Then, you can set different parameters from the AWS Console, such as: availability zone, ssh key, the image type (micro, small, medium, etc) and the security group. Once the machine is started, access it by typing the public DNS name in a browser. You should see something similar to the screenshot below.


The next step involves connecting to the machine. You can download the private SSH key from your Amazon account. If you want to connect to the machine from Windows using the popular tool Putty, you will need to convert your private key to the .PPK format. Take a look at this tutorial if you are not sure how to perform this conversion.

On Linux or OS X, you can open a Terminal and run the following command:

$ ssh -i /path/to/your/private/key.pem bitnami@ec2-xx-xx-xx-amazonaws.com

You will see a welcome message similar to:


Below we will follow some of the steps in this guide.

The installation directory of BitNami JRuby in the AMI (and also in the virtual machines) is /opt/bitnami and you will need to login as root.

bitnami@ip-xx-xx-xx-xx:~$ sudo su
root@ip-xx-xx-xx-xx:/home/bitnami# cd /opt/bitnami
root@ip-xx-xx-xx-xx:/opt/bitnami# ./jrubyconsole


Now that we have loaded the BitNami environment, we can start using JRuby. Let's check the current version.

bash-4.2# jruby -v
jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [linux-amd64]


As you can see, JRuby is running in 1.9 mode which is the default for JRuby 1.7.

If you want to use Ruby 1.8 mode, you can add JRUBY_OPTS=--1.8 environment variable (you can find more details in the guide).

To launch Ruby applications with JRuby you can execute the following:

jruby -S command-name

or

jruby command-name

The switch -S indicates JRuby that should run following command from its binary directory (jruby/bin). For instance:

bash-4.2# jruby -S gem list

*** LOCAL GEMS ***

actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
ActiveRecord-JDBC (0.5)
activerecord-jdbc-adapter (1.2.2)
activerecord-jdbcmysql-adapter (1.2.2)
activerecord-jdbcsqlite3-adapter (1.2.2)
activeresource (3.2.8)
activesupport (3.2.8)
allison (2.0.3)
ansi (1.4.3)
arel (3.0.2)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0)
bundler (1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
echoe (4.6.3)
erubis (2.7.0)
execjs (1.4.0)
highline (1.6.15)
hike (1.2.1)
hpricot (0.8.6 java)
i18n (0.6.0)
jdbc-mysql (5.1.13)
jdbc-sqlite3 (3.7.2)
journey (1.0.4)
jquery-rails (2.0.2)
jruby-jars (1.6.6)
jruby-openssl (0.7.6.1)
jruby-rack (1.1.3)
json (1.7.5 java)
json_pure (1.7.5)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
mustache (0.99.4)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
ronn (0.7.3)
rubyforge (2.0.4)
rubyzip (0.9.6.1)
sass (3.1.20)
sass-rails (3.2.5)
sprockets (2.4.5, 2.1.3)
therubyrhino (1.73.1)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
turn (0.9.6)
tzinfo (0.3.33)
uglifier (1.2.6)
warbler (1.3.2)


However, if you want to run the scripts of your application, you will not use the -S switch. In this case, JRuby will look for the script in your actual directory. You can find a demo project in /opt/bitnami/projects/jrubystack.

bash-4.2# cd projects/jrubystack/
bash-4.2# jruby script/rails -h
Usage: rails COMMAND [ARGS]

The most common rails commands are:
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
new Create a new Rails application. "rails new my_app" creates a
new application called MyApp in "./my_app"

In addition to those, there are:
application Generate the Rails application code
destroy Undo code generated with "generate" (short-cut alias: "d")
benchmarker See how fast a piece of code runs
profiler Get profile information from a piece of code
plugin Install a plugin
runner Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.

bash-4.2# jruby script/rails server -p 80
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:80
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-10-29 16:59:58] INFO WEBrick 1.3.1
[2012-10-29 16:59:58] INFO ruby 1.9.3 (2012-10-22) [java]
[2012-10-29 16:59:58] INFO WEBrick::HTTPServer#start: pid=2156 port=80


Note that we are launching the development server in port 80. This is because, by default, port 3000 (the default for rails server) will not be accessible in the AMI if you didn't enable it in the security group (which for security reasons is good).

Once you have developed your application, you can also create a .war file to run it on Tomcat. For that, you can user the warbler gem (also included in the stack).

bash-4.2# jruby -S warble config
cp /opt/bitnami/jruby/lib/ruby/gems/1.9/gems/warbler-1.3.2/warble.rb config/warble.rb
bash-4.2# jruby -S warble war
rm -f jrubystack.war
Creating jrubystack.war
bash-4.2# cp jrubystack.war /opt/bitnami/apache-tomcat/webapps/


In the AMI and virtual machines, you will need to change the permissions to the .war file to allow the user tomcat to deploy it.

bash-4.2# chown -R tomcat.tomcat /opt/bitnami/apache-tomcat/webapps/jrubystack.war


The jrubystack demo project is configured with MySQL. We now need to make sure that both Tomcat and MySQL are started.

bash-4.2# /opt/bitnami/ctlscript.sh restart
/opt/bitnami/apache-tomcat/scripts/ctl.sh : tomcat not running
/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
/opt/bitnami/apache-tomcat/scripts/ctl.sh : tomcat started


The jrubystack war file should have been deployed in Tomcat and the application should be accessible in http://ec2-xx-xx-xx-amazonaws.com/jrubystack

Now that you are running your server in the cloud, you can easily migrate it into BitNami Cloud Hosting and get additional services like scheduled backup, start/stop policy and monitoring. If you want to import your JRuby server to BitNami Cloud Hosting to take advantage of these services, view our tutorial. Our developer plan in BitNami Cloud Hosting allows you to deploy and manage one micro instance for free!

The JRuby team has mentioned that it plans on putting out point releases of 1.7.x every 2-3 weeks for the foreseeable future. Keep an eye on BitNami for getting the read-to-run BitNami Stacks with the latest versions!



Thursday, October 18, 2012

Joomla! 3 is Now Available from BitNami


We are pleased to announce that the newly released Joomla 3 is now available on BitNami!  The BitNami Joomla! 3 stack is recommended for developers and early adopters. As with all BitNami Stacks, you can deploy it for free in one click on your own computer, in a virtual machine or on Amazon cloud.

A few of the major improvements in this latest release of Joomla! are:

    • Mobile-ready, both for visitors and administrative areas.
    • Improved, more user friendly interface for the admin panel.
    • Developer tools that give you standardized back-end and front-end interfaces.
    • jQuery support.

Because all BitNami Stacks are completely self-contained and ready-to-run, they make it very easy to try the latest versions of your favorite open source applications without compromising the rest of your operating environment. They can also be removed from your system in minutes by either deleting the VM or running the uninstaller that is bundled with all native installers.

In addition to the BitNami native installers, VMs and AMIs, we also provide simplified deployment and management of Joomla! in the cloud with BitNami Cloud Hosting. Our cloud hosting platform allows you to add multiple applications to your cloud servers, choose from multiple operating systems, have greater flexibility around the machine specifications and provides automatic backups, built-in monitoring, one click cloning, multi-account management and other features that make it easier to run your favorite BitNami apps on the Amazon Cloud. Sign up for our free developer plan to check it out!

Joomla! 3 control panel
Joomla! 3 welcome page

Friday, March 9, 2012

Why your next web app should be hosted in the Cloud

The emergence of Cloud Computing is changing how web applications are created, deployed and managed. A dedicated hosted server may no longer be the best option. Whether you are developing basic WordPress or Joomla! sites or building complex e-commerce sites with Magento and SugarCRM, there are multiple ways you can leverage the cloud to your benefit.


This article will cover several of the advantages of moving your customers to a cloud platform. It will also explain how BitNami Cloud Hosting (BCH) can reduce the time you must devote to maintenance chores and help you concentrate on your core competency: web development.

The biggest advantage that the cloud offers is flexibility, a new cost-capacity tradeoff. The acquisition of operative capacity traditionally requires meticulous planning, and it requires investment … at least it used to. The cloud offers the possibility of instantly expanding or reducing the size of your servers, with an immediate impact on your cost structure. You don't have to pre-commit resources for a possible sudden surge in visitors, nor scramble to increase capacity before an unexpected surge drowns your site in a sea of un-responded requests, nor lament costly idle resources when the surge did not (yet?) happen. It's the just-in-time revolution, this time in the server room instead of the factory.
The above said, a cloud environment requires a new set of skills, both in setup and ongoing management of your servers, which can be a time and/or money drain, directly impacting your productivity – just as it was before. BCH significantly reduces the non-core complexity of developing and hosting for web developers – it is a gentle on-ramp to the Amazon Cloud. It is more time available for development. It's the cloud made simple and cost-effective with:
  • Ready-to-run, consistent, fully configured application environments. No more configuration and version nightmares, such as“which library version is required for this app version?” Your WordPress server is fully configured, up and running in a few clicks. Or SugarCRM, or any of our many full-stack offerings.
  • On-demand servers that can be started with one click, stopped with another click – and are essentially free when stopped.
  • Simple server cloning – servers can be cloned in a few clicks to test updates or setup new development servers. Delete them when you are done.
  • A familiar environment, where things work the same as they do now: you do not have to port or adapt your application to the peculiarities of a PaaS provider. You are still in full control.
  • Instant rescaling of your servers, up or down, in a few clicks with the instant rescaling of your hosting costs. Scale up to a monster server, or down to a mite. With a traditional hosted server, you typically need to purchase a machine . That means you either need to purchase a big server that will be underutilized during development or purchase a smaller server initially and migrate to a bigger one when moving to production, and spend time and effort recreating the environment in the new server. As your application becomes popular, you will need to manually repeat the same process to migrate to bigger servers as needed. You can bypass this completely by using BitNami Cloud Hosting to dynamically resize your server as needed without any upfront investment.
  • The ability to run multiple applications on one server. Launch a single server to handle several customers, as you probably did with your hosting solution. Or launch one server for each, gain flexibility, simplify your accounting, and forget all about protecting your customers from each other in order to maintain their service level.
  • Cost-effective access to development servers on a pay-as-you-go basis. Launch a cheap micro server for development and testing, grow it in one click for deployment. Or develop locally on your own servers, physical or virtual, and easily move to an identically configured server in the cloud when ready.
  • Full-server, automatic, incremental backups with the ability to restore the server to any of the snapshots that you have configured. Restoring to a server snapshot guarantees that everything runs just at it did, no more version incompatibility nightmares.
  • Automatic server monitoring. BCH automatically monitors all launched servers and provides CPU, disk, memory utilization and other information so you can keep an eye on your infrastructure
Putting your servers in the cloud gives you more flexibility to manage your cost-capacity tradeoffs: more bang for your buck.

BitNami Cloud Hosting gives you the ability to do so with no effort, significantly reduces your sysadmin time, and frees you to devote your full energy to your core tasks.
Give it a whirl at http://bitnami.org/cloud

Wednesday, February 2, 2011

Installing Ubuntu Desktop on EC2 EBS

This tutorial explains how to install Ubuntu Desktop on EC2 EBS, improving the original method for this task.