Wednesday Jan 13, 2010

Web Stack and the TLS Vulnerability

If you're a Web Stack user, please read Jyri's brief article about Web Stack and the TLS Vulnerability.

Thursday Dec 10, 2009

Restoring normality...

»...just as soon as we are sure what is normal anyway. Thank you.« (HHGTTG)

The last few weeks were a little quiet here in this blog. I had to do some urgent programming for the next release of our Web Stack and last week I had the great pleasure to talk about web application development at the Codebits conference in Lisbon.

4166227540_48a7f716b6_o.jpg Photography by Lenz Grimmer.

Friday Nov 13, 2009

Performance Tuning the Sun GlassFish Web Stack

My colleague Brian Overstreet wrote a must-read paper about tuning different components of the Sun GlassFish Web Stack focusing on Apache, MySQL, and PHP: Performance Tuning the Sun GlassFish Web Stack.

Monday Oct 26, 2009

Roller: Category list with entry counter

Sun Microsystem's employee blogging site (affectionately named BSC) uses Apache Roller to manage the site and house all the blogs. Roller is an open source Java blog software that for example also drives the US Government's and the IBM Developer Works blogs. But there is one feature I really missed: An entry counter in my sidebar's category list. It's a standard feature in the Wordpress world, but in Roller I didn't found any option enabling such a counter.


But as they say, "If the mountain won't come to Mohammed, then Mohammed will go to the mountain": If the feature will not come to me, then I will need to take care by myself.

And here is my mountain:

#set($rootCategory = $model.weblog.getWeblogCategory("nil"))

#set($cats = $rootCategory.getWeblogCategories())
#foreach($cat in $cats)
  #set($entriesList = $model.weblog.getRecentWeblogEntries($, 500))
  #set($count = $entriesList.size())
  #if($model.weblogCategory && $model.weblogCategory.path == $cat.path)
    <li class="selected"><a href="$url.category($cat.path)">$ ($count)</a></li>
    <li><a href="$url.category($cat.path)">$ ($count)</a></li>

It's quite easy and straight forward: Get a list of all categories, for each category get all the blog entries (in this case limited to 500, because I don't know how this scales), count the entries, and finally generate some HTML.

If everything would be that easy! :)

Wednesday Oct 14, 2009

Easy deploy your web apps with Sun GlassFish Web Stack

Today I want to show you a quick installation walkthrough of Sun GlassFish Web Stack. I'm using Solaris 10 in this walkthrough, but installation on RHEL is absolutely the same. As a small deployment example for a web application I'll do an installation of WordPress.

Web Stack Installation

  1. Okay, first step: Get the Sun GlassFish Web Stack.

    Simply enter in your browser.


    After clicking on the Get It button, you're asked to pick your platform: Red Hat Enterprise Linux or Solaris 10. (You may wonder why there is no OpenSolias download, that's quite simple: because the Web Stack is already sipped with OpenSolaris (2009.06), all you need to do to install the main components is to do a pkg install amp. And you'll get the Apache, MySQL and PHP components of Web Stack installed right on your system.)

    After picking the platform, you need to decide which kind of distribution you want to download: native packages or the IPS-based distribution:


    The native packaging distribution (aka RPM/SVR4) differs two version: one including Java-based components like Tomcat, GlassFish and Hudson, and one without.

    For this demo I picked my personal favorite, the IPS-based distribution, because it allows me a non-root install and gives me the ability to place my Web Stack anywhere I want in the directory tree of my system. So I don't need to have root access and can install Web Stack as a regular user.

  2. After the download is finished I open a terminal and take a look at my system environment:

    [oswald@localhost ~]$ df -h
    Filesystem            Size  Used Avail Use% Mounted on
                          7.2G  2.3G  4.5G  34% /
    /dev/hda1              99M   12M   83M  13% /boot
    tmpfs                 125M     0  125M   0% /dev/shm
    [oswald@localhost ~]$ pwd
    [oswald@localhost ~]$ id
    uid=500(oswald) gid=500(oswald) groups=500(oswald)
    [oswald@localhost ~]$ ls -l
    total 14452
    -rw-r--r--  1 oswald 14765264 Oct 12 14:43

    My current working directory is my home directory. There is enough space left on my file system. I'm a non-root, regular user, and I see the downloaded IPS installer image.

  3. Now I'm unzipping the image to my home directory:

    [oswald@localhost ~]$ unzip -q 

    This creates a directory named webstack1.5 by default. You can rename it to anything you want or simply keep the default name. In this case I choose to name it demo:

    [oswald@localhost ~]$ mv webstack1.5 demo
  4. Now I change into that directory and start the Update Tool:

    [oswald@localhost ~]$ cd demo
    [oswald@localhost demo]$ bin/updatetool 

    So, what we're seeing here is the update tool. Our current Sun GlassFish Web Stack installation is highlighted on the left hand side. If you have other products installed or multiple Web Stack installs, all these images will show up too. In this case I've only one image and once I click on Available Add-ons.

    Now I pick all the components I want to use in this demo, so I select Apache HTTP server, MySQL server, PHP Server and the PHP MySQL connector. By the way, if I realize I need more packages later on, I can come back here anytime and install whatever I need. For now, I've selected all I want at this point, and all I have to do now is to press the beautiful green install button above the package list.

  5. After downloading, I get back to the shell and use the command line tool pkg to review the list of installed packages:

    oswald@localhost demo]$ bin/pkg list
    NAME (PUBLISHER)                              VERSION         STATE      UFIX
    pkg                                           1.111.3-30.2210 installed  ----
    pkg-toolkit-incorporation                     2.2.1-30.2210   installed  ----
    python2.4-minimal                    installed  ----
    sun-apache22                                  2.2.11-1.5      installed  ----
    sun-mysql51                                   5.1.30-1.5      installed  ----
    sun-mysql51lib                                5.1.30-1.5      installed  ----
    sun-php52                                     5.2.9-1.5       installed  ----
    sun-php52-mysql                               5.2.9-1.5       installed  ----
    sun-wsbase                                    1.5-1.5         installed  ----
    updatetool                                    2.2.1-30.2210   installed  ----
    wxpython2.8-minimal                           2.8.8-30.2210   installed  ----

    You can also use pkg to install components, like in the Update Tool. So for the terminal addicted: if you don't like a GUI, there is also a command-line alternative.

  6. Okay, let's go on. I now start the Apache web server:

    [oswald@localhost demo]$ bin/sun-apache22 start
    Starting apache22

    And to check if the Apache is really running and working I'll take my browser to http://localhost. But wait a second...

    As we probably all know, by default, the Apache web server runs on port 80, which is the default port on which most Web servers run. But in the Unix world all port numbers below 1024 require root permissions to bind. And since I started Apache as a normal non-root user, the Apache will be unable to bind to port 80.

    If you use Web Stack as non-root user, Web Stack will add 10000 to every port number below 1024. So in this case Apache will use 10080 as it's favorite port.

  7. At http://localhost:10080/ we find the welcome page of Sun GlassFish Web Stack:

  8. But what's life with just an Apache, let's also start the MySQL and let the database server join our team:

    [oswald@localhost demo]$ bin/sun-mysql51 start
    Starting mysql51
  9. Because everyone on my system and on my network can now access my MySQL server, I strongly need to secure my installation by setting a password for MySQL's root user:
    [oswald@localhost demo]$ mysql/5.1/bin/mysqladmin -u root password "demo"

    Okay, demo is probably not a secure password for a production environment, but for this demo purposes it's a very appropriate one.

That's all. Your AMP stack is now ready.

Example Deployment

As an example I will now install the famous blogging software WordPress within my new AMP stack. Not because it's so difficult to do, but it's a good and pragmatic way to show the AMP stack is working and out-of-the-box capable to run popular web applications.

  1. First I need to create a database and a user for WordPress to access the database and to store its data.

    Okay, that should be an everyday task for a MySQL DBA:

    [oswald@localhost demo]$ bin/mysql -uroot -pdemo
    Welcome to the MySQL monitor.  Commands end with ; or \\g.
    Your MySQL connection id is 2
    Server version: 5.1.30-log Source distribution
    Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.
    mysql> CREATE DATABASE wordpress;
    Query OK, 1 row affected (0.01 sec)
    mysql> GRANT ALL PRIVILEGES ON wordpress.\* TO 'wordpress'@'localhost' \\
          IDENTIFIED BY 'demo';
    Query OK, 0 rows affected (0.98 sec)
    mysql> QUIT

    Get into the MySQL monitor, aka the MySQL command line tool, to connect to the database server. I use the CREATE DATABASE statement to create a database named wordpress. And with the GRANT statement I create a user named wordpress identified by the password demo. Again this is probably not a good password for production use, but for a demo this is perfecto.

  2. After changing into Apache's document root directory I wget the latest wordpress version:
    [oswald@localhost demo]$ cd var/apache2/2.2/htdocs
    [oswald@localhost htdocs] wget -q

    With GNU tar I extract the archive:

    [oswald@localhost htdocs]$ /usr/sfw/bin/tar xfz wordpress-2.8.4.tar.gz

    This creates a directory called wordpress.

  3. Now I can access my WordPress installation by pointing my browser to http://localhost:10080/wordpress.


    From now on it's very easy. Simply enter the details for the database server connection:

    The database name: wordpress.
    The user name: wordpress.
    The password: demo.
    The database host: localhost.
    And the table prefix wp_.

    And on the next page:


    I choose a name for my blog, and enter my email address. Press Install WordPress. And now it only takes a few moments and the installation is done. (Write down your random admin password, you will probably need it later.)

  4. Now I want to check if the Wordpress installation was successful and again point my browser to http://localhost:10080/wordpress.


    And, voilĂ , there it is: my shiny new "Sun GlassFish Web Stack" blog. Hooray.

That's all. Welcome to the wonderful world of AMP.

Friday Oct 02, 2009

Sun GlassFish Web Stack 1.6 as development and testing version available

Great news! Sriram anncounced the availability of the upcoming Sun GlassFish Web Stack 1.6 as development and testing version for Solaris 10 U5+ and RHEL 5.2+.

The development version is currently only available as IPS (Image Packaging System) distribution which basically gives you a small installer like application allowing you to download and pick only those components you're really need. IPS also allows you to pick up updates easily and - for me - the most impressive feature is the non-root install and the ability to place your web stack anywhere you want in the directory tree of your system. So you don't need to have root access and you can install web stack as a regular user. That's quite an amazing feature. And as far as I know no other web stack software for Unix offers this kind of feature.

Find all the details at Siram's blog: Web Stack 1.6 development builds are available for testing.

Friday Sep 11, 2009

Snow Leopard and SWAN access

Preparing myself and my hardware for the PHP Unconference this weekend in Hamburg and just realized that the new Mac OS X 10.6 Snow Leopard contains a native Cisco IPSec VPN client out-of-the-box. Just migrate your VPN settings and you're free to uninstall Cisco's antiquated VPNClient.

Kai 'Oswald' Seidler writes about his life as co-founder of Apache Friends, creator of XAMPP, and technology evangelist for web tier products at Sun Microsystems.


« July 2016