Wednesday Oct 08, 2008

Cool Stack Roadmap

We released Cool Stack 1.3.1 recently. This was the last release that was built to work on releases as old as Solaris 10 01/06 (Update 1). Going forward, future versions of the stack will only be supported on newer Solaris 10 updates. So I'd like to urge everyone who is running older releases to please schedule their systems for upgrade. We highly recommend that you upgrade to at least Solaris 10 01/08 (Update 5) as it has many performance, security and other fixes.

For some time now, we've had two different stacks for Solaris 10 and OpenSolaris - Cool Stack for Solaris 10 and Web Stack for OpenSolaris. We cannot continue to sustain this model  where we have two different source bases with slightly different versions of various components. Further, there has been interest from some large customers for a single stack to be supported on Solaris 10, OpenSolaris as well as Linux. These customers also wanted production support for the stack.

To enable a unified stack, we are now transitioning Cool Stack to Sun Web Stack. This new stack was announced in OSCON in July. It will be very similar to Cool Stack in that it will be separately downloadable but it will be a full-fledged product in that customers who want production support, can now purchase it. The stack will continue to be available free of charge with limited support via a forum.

The first version of Sun Web Stack will be 1.4 (keeping the Cool Stack versioning in place) and should be available in November. Current Cool Stack 1.3.x customers may not see new functionality in terms of upgrades to components in this release as we are trying to sync it to the current versions of components in OpenSolaris. However, Zones users may want to take a look at this release as it does separate out the binaries from the configuration/log files, making it easier for multiple zones to share a single installation in /opt and yet use custom configuration/logs which will be located in /etc, /var etc. similar to other Solaris applications.

With this transition to Sun Web Stack, I will no longer be directly associated with the development of the stack. I will however keep an eye on it's performance and continue to push for increased performance via compiler optimizations or required source changes. We in the performance team will continue to use, test and analyze the performance of many of the components in the stack. So hopefully you will continue to monitor my blog as I talk more about the performance aspect of the stack.

Please do continue to use Cool Stack and Sun Web Stack as that product comes out. Sun is committed to a high-performing web stack of open source components on all platforms.

Wednesday Jun 11, 2008

Cool Stack 1.3 is here

It's finally here. Before you download the release, please do read the documentation. It's over a month late, but hopefully the features will compensate for the delay.
Almost every single component in the stack has been upgraded. Two new packages, CSKpython and CSKnginx have been added. And yes - the python package does include mod_python too.
You can read about the full list of changes in the Changelog.


ruby


Significant changes have been made to the ruby package. In addition to the upgrade to ruby1.8.6p114, we include a number of gems, notably mysql, postgres and mongrel. It should also be easy to install any new gem that requires native compilation using gcc - this should just work out of the box. A word of caution if you're running ruby on SPARC. Please DO NOT use gcc. If you're importing native gems, take the extra step of installing Studio 12 and use the rbconfig.studio instead (simply rename it to rbconfig.rb after saving the current one). This file is located in /opt/coolstack/lib/ruby/1.8/sparc-solaris2.10.


There have also been significant performance enhancements for ruby made in this release. By changing compiler flags, we have measured 20-30% improvement. In addition, SPARC-specific patches (which are now in ruby 1.8.7) improve performance a further 8-15%. If you are a ruby user, let us know your experiences. I'd love to hear of any performance changes you see as well.
In a future post, I'll share some performance results on the AMP stack. But for now, please try this release and let us know what you think via the forum or comments on this blog.


Cool Stack installation in Zones


For users who have installed Cool Stack in zones, I know the upgrade is a painful process. As I mentioned earlier, we do hope to fix this situation by allowing upgrade installs in future. But some users have found solutions on their own. In particular, I found this post in the forum interesting. Scroll down to reply 19.


Monday May 19, 2008

Where is 1.3?

I know many of you may be wondering why Cool Stack 1.3 isn't out yet, so I thought I'd post an update on where we are with the release. When I first started talking about this, I was hoping to get the release out in early May. But several things have colluded to cause a delay.

  1. We took on a lot for this release. Although just looking at the proposal, it may seem like a simple matter to just update the versions of the various components, underneath the hood, we decided to do a lot more streamlining of the build and packaging process.  Since so many version updates were involved, that also meant more legal approvals.
  2. We have a more formal QA process for this release (and for future releases). The good news is that this means we will have a more quality release, but the bad news is that it now takes more time as we have to go through a couple of QA cycles at least to qualify the release.
  3. We are going to institute a patching process for releases going forward. What this means is that we can put out patches for critical bugs and provide an upgrade path for existing installations. This should especially prove useful to users who have installed in zones. Before everyone starts jumping up with joy, I want to mention that for 1.3, you will still have to go through the pain of a fresh installation after saving your config files and re-applying them. But going forward, say for 1.3.1 or 1.4, we will provide an upgrade option, so please bear with the pain for this one release.
  4. And there is now talk about making Cool Stack into a more full-fledged product with proper production support. This is one of the major reasons for all of the above enhancements and the cause of the delay, but we have got so many requests for production support now, that we felt it was worth taking the time to do some ground work to make this happen.
  5. Just to be clear, we will continue to provide free support through the Cooltools forum as we are doing now, and we hope more of you will help us out on the forum. We know there are many experienced Cool Stack users out there - if you think Cool Stack has saved you time, we hope you will consider giving back a little of your time to the forum. We have one full-time engineer assigned to the project and a few other Sun engineers who are interested in Cool Stack's success contribute our time.  We are really short-staffed, so please, please do consider sharing your knowledge and helping out other Cool Stack users.

After reading all that, I know the big question still is : When will 1.3 be released ? We have just finished incorporating almost all components and are starting QA of build2. We have a few more things to take care of but I'm hopeful that we can get this out in the first week of June.

Thanks for your patience and your support of Cool Stack. Please do keep your feedback coming and subscribe to the forum. 


Friday Feb 29, 2008

Time for next Cool Stack release

It's been close to 4 months since we released Cool Stack 1.2, so it's time to start thinking about the next release. Here's what we have planned so far and as always I'm looking for feedback from current and future users on what you'd like to see. Needless to say, that all currently known bugs will be fixed and the current patches will be rolled into the release. However, if you don't tell us about the problems you've run into, we won't be able to fix them. So, once again I'd like to encourage people to please post your problem/issue/tips etc. on the forum.

Here's a list of stuff we're currently looking at for Cool Stack 1.3 :




















ComponentVersion in Cool Stack 1.3
Version in Coolstack 1.2
Apache 2.2.8 2.2.6
Tomcat 5.5.26 5.5.23
php 5.2.5 5.2.4
mysql 5.1 5.0.45
squid 3.0 2.6
apc 3.0.16 3.0.14
mod_perl 2.0.3 2.0.2
rails 2.0.2 1.2.3
Add php extensions: memcache , pdflib, and freetype , mcrypt

-
libevent 1.3e 1.3d
memcached 1.2.5 1.2.2
mod_jk 1.2.26 1.2.25
lighttpd 1.4.18 1.4.16
nginx 0.5.35 -
dtrace ruby extension -
multithreaded perl -
Improve lighttpd with more builtin extensions -
mysql performance improvement with libfasttime/libmtmalloc -
Add ruby gems :postgres, mysql. -
Improve ruby build process (to make easier compilation of external gems) -

I would like feedback on a couple of areas in particular:

  • MySQL 5.1 has many performance improvements and we'd very much like to package this version even though it's not FCS yet (it's been out for a looong time now and should be quite stable). Should we go ahead and use 5.1 instead of 5.0.x ?
  • We've heard some complaints about perl not being multi-threaded, but there is a small performance penalty associated with building it multi-threaded (especially if you're not going to be using it's multi-threaded features).  Any thoughts ?

Of course, please feel free to comment on anything else you'd like seen added/changed as well.

 

Shanti

 

Monday Nov 05, 2007

PHP dtrace extension for Cool Stack 1.2

We have fixed the issue with the PHP dtrace extension not working in Cool Stack 1.2. As I mentioned in my announcement post, we had already identified the issue but didn't have time to fix it before the release. The issue was that /usr/ccs/bin/ld was being used to do the linking but this doesn't work for dtrace as some initialization code needs to be called from the .init section and this is not setup correctly if we don't use 'cc' to do the linking (rather than 'ld'). 

So a simple addition to the configure line:
LD="cc"

did the trick.

We now have two files : dtrace_1.2_sparc.so and dtrace_1.2_x86.so posted. Download the one for your machine and do the following :

  • Copy it to the php5 extensions directory of /opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613 and re-name it as dtrace.so.
  • Add extension="dtrace.so" to your /opt/coolstack/php5/lib/php.ini. 

See my earlier post, for an example of how to use dtrace to trace through the AMP stack. 

Friday Nov 02, 2007

Cool Stack 1.2 Released

Finally, it's here. We missed our October 31 deadline, but hopefully that won't matter when you see the contents of the release.

Short summary of changes in the 1.2 release.

You can download the new packages from the Sun Download Center.

Some caveats to be aware of :

  • These packages will over-write Cool Stack 1.1 packages that you may already have installed. All packages continue to install in /opt/coolstack but some of the package names have been changed. Thus, pkgadd(1M) will not know that the new CSKapache2 package will install in /opt/coolstack/apache2 and over-write the contents from a previous Cool Stack 1.1 installation of CSKamp. So, please do save your current installation. A detailed strategy to do this is  defined on the Cool Stack site. Here are some other short-cuts :
    • Move /opt/coolstack to /opt/coolstack1.1. Remove all the CSK\* packages installed. Since the actual files in /opt/coolstack no longer exist (as you've moved the directory), pkgrm will do no harm but does change the system's perception of what packages are installed. Then delete /opt/coolstack and start installing the new packages.
    • Save just the files you need - typically apache2/conf directory, your php.ini file etc. Then remove all the CSK\* packages and delete /opt/coolstack.
  • This release was built and tested on Solaris 10. During final testing on Nevada (aka OpenSolaris or SXDE), we ran into package incompatibility issues. Some packages do not install in a straight-foward manner on OpenSolaris. Please use the work-around.
  • The php dtrace extension doesn't work. We have identified the fix and will post a patch soon.

As always, please do read the FAQ (we will be updating this as we get feedback about the new release) and if that doesn't help, post your question/problem on the CoolTools Forum.

Let us know what you think of this release via the forum, the feedback alias or this blog. If we don't get feedback, it is hard to know what components to include or what bugs need to be fixed.

Tuesday Oct 16, 2007

Cool Stack on Niagara 2 Systems


Sun recently announced the Sun SPARC Enterprise T5120 and T5220 and Sun Blade T6320 systems based on the UltraSPARC T2 processor.  You can find lots of information on the various features and functionality provided by these servers.

One other cool feature is that these systems ship with Cool Stack pre-loaded. The Cool Stack 1.1 packages are available in /var/spool/pkg. You can install the ones you want using the pkgadd(1M) command as follows :

root@wgs40-82 # cd /var/spool/pkg
root@wgs40-82 # ls
CSKampSrc_sparc.pkg        CSKphplibs_sparc.pkg
CSKamp_sparc.pkg           CSKrubySrc_sparc.pkg
CSKmemcachedSrc_sparc.pkg  CSKruby_sparc.pkg
CSKmemcached_sparc.pkg     CSKsquidSrc_sparc.pkg
CSKmysqlSrc_sparc.pkg      CSKsquid_sparc.pkg
CSKmysql_sparc.pkg         CSKtdsSrc_sparc.pkg
CSKncursesSrc_sparc.pkg    CSKtds_sparc.pkg
CSKncurses_sparc.pkg       CSKtomcat_sparc.pkg
CSKperlSrc_sparc.pkg       Changelog.txt
CSKperl_sparc.pkg          CoolStack1.1_sparc.pdf
CSKphplibsSrc_sparc.pkg    LICENSE.txt
root@wgs40-82 # pkgadd -d CSKamp_sparc.pkg

The following packages are available:
  1  CSKamp     Apache httpd, PHP and MySQL
                (sparc) Apache 2.2.3, PHP 5.2.0, MySQL 5.0.33

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:


Tuesday Sep 18, 2007

Cool Stack 1.1.1 contents

We are currently working on Cool Stack 1.1.1 which will have the following components updated, in addition to fixing known bugs :

  • Apache 2.2.6 : Add mod_proxy, mod_fcgid, SMF support
  • PHP 5.2.4      : Add dtrace extension, add new fastcgi version for use with non-Apache webservers
  • APC 3.0.14
  • Suhosin 0.9.20
  • MySQL 5.0.45: Add SMF support
  • Perl 5.8.8       : Add Sys:Syslog, DBI, DBD-mysql extensions
  • memcached 1.2.2
  • squid 2.6
  • tomcat 5.5.23
I would love to get feedback on this. Is your favorite module/extension missing ? Are there bugs/issues you have run into that haven't been reported on the forum ?

Tuesday Jul 03, 2007

APC Update

Many folks have reported problems with APC in Cool Stack 1.1 resulting in a SEGV in the CoolTools Forums.
The APC version in Cool Stack 1.1 is APC 3.0.11 and if enabled, extensions such as mysql, dtrace etc. fail with a SEGV. Media Wiki doesn't work either.

We have tested APC 3.0.14 and this version seems to work much better and I'm keeping my fingers crossed that it will work for you as well. Our performance testing doesn't show any substantial differences between 3.0.11 and 3.0.14. If you want to give it a try, simply download the correct file for your platform and rename it to apc.so in your php extensions directory /opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613.

APC 3.0.14 for Cool Stack 1.1 (SPARC)

APC 3.0.14 for Cool Stack 1.1 (x86)

Tuesday May 08, 2007

Cool Stack at JavaOne

If you're at JavaOne this week, please do visit the "Solaris + AMP" pod (#976). We are demoing the use of SMF and dtrace on Cool Stack. You can see how dtrace can be used to debug and trace the code path through your entire application, starting from the Javascript in the browser, through PHP and finally to MySQL at the back-end. We are also distributing Cool Stack 1.1 on a DVD at the pod.

I will be there on Thursday between 11:00 - 3:00 PM, so please do stop by and say hi. 

Shanti 

Tuesday May 01, 2007

Dtrace support for PHP

Dtrace is one of the coolest things in Solaris 10, adding great observability to applications. A Dtrace provider for PHP that adds probes to function entry and exit points has long been available. I finally got around to integrating this with the php in Cool Stack. 

Bryan Cantrill has some excellent examples of how to use dtrace to trace through your php code, down to the system libraries and kernel (if you want to go that far !) .

Instructions for installing the php dtrace extension

1. Download the shared library for the extension :

    dtrace.so.x86.bz2

    dtrace.so.sparc.bz2

2. Install the extension :

    # bunzip2 dtrace.so.<arch>.bz2
  # cp dtrace.so.<arch> /opt/coolstack/php5/lib/php/extensions/no-debug\*/dtrace.so

3. Enable the dtrace extension :

  Edit your php.ini (default is in /opt/coolstack/php5/lib/php.ini) and add the line :

  extension="dtrace.so"

4. Check if the extension has been correctly loaded by executing a sample php script that takes a long time to run (you can use Bryan's blastoff.php to do this). 

#/opt/coolstack# dtrace -l |grep php
39131   php16088         dtrace.so                php_dtrace_execute function-entry
39132   php16088         dtrace.so       php_dtrace_execute_internal function-entry
39133   php16088         dtrace.so                php_dtrace_execute function-return
39134   php16088         dtrace.so       php_dtrace_execute_internal function-return
#

5. You should now be able to use the dtrace provider whenever you want using dtrace scripts. The dtrace provider will work with mod_php if you're running Apache or if you're running php stand-alone. Here is a sample command that will show which functions are called :

# dtrace -n function-entry'{printf("called %s() in %s at line %d\\n", \\
copyinstr(arg0), copyinstr(arg1), arg2)}' -q


Please feel free to contribute additional dtrace scripts.

 

Shanti



Monday Apr 16, 2007

SMF support for MySQL in Cool Stack



Here are instructions on how to use SMF to manage MySQL. These instructions assume no knowledge of SMF. All commands should be executed as root.

Create the manifest

 The manifest defines the service and controls the privileges with which the service will execute. We use the service name csk-mysql to distinguish this as a Cool Stack service.

Create a file named /var/svc/manifest/network/cskmysql.xml with the following contents :


<?xml version='1.0'?>
 <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
    Copyright 2006,2007 Sun Microsystems, Inc.  All rights reserved.
    Manifest for CSKmysql - should reside in /var/svc/manifest/network
-->

<service_bundle type='manifest' name='CSKmysql:mysql'>

<service
        name='network/csk-mysql'
        type='service'
        version='1'>
        <create_default_instance enabled='false' />
        <single_instance />

       <!--
         Wait for network interfaces to be initialized.
        -->
       <dependency name='network'
           grouping='require_all'
           restart_on='error'
           type='service'>
           <service_fmri 

           value='svc:/milestone/network:default'/>
        </dependency>

        <!--
          Wait for all local filesystems to be mounted.
        -->
        <dependency name='filesystem-local'
            grouping='require_all'
            restart_on='none'
            type='service'>
            <service_fmri
               value='svc:/system/filesystem/local:default'/>
         </dependency>

         <exec_method
             type='method'
             name='start'
             exec='/opt/coolstack/lib/svc/method/svc-cskmysql start'
             timeout_seconds='60'>
             <method_context
working_directory='/opt/coolstack'>
                 <method_credential
                   user='mysql' group='mysql'
                   privileges='basic,!proc_session,!proc_info,!file_link_any,net_privaddr' />
             </method_context>
         </exec_method>

         <exec_method
             type='method'
             name='stop'
             exec='/opt/coolstack/lib/svc/method/svc-cskmysql stop'
             timeout_seconds='60'>
             <method_context />
         </exec_method>

         <exec_method
             type='method'
             name='refresh'
             exec='/opt/coolstack/lib/svc/method/svc-cskmysql restart'
             timeout_seconds='60'>
             <method_context working_directory='/opt/coolstack'>
                 <method_credential
                   user='mysql' group='mysql'
                   privileges='basic,!proc_session,!proc_info,!file_link_any,net_privaddr' />
             </method_context>
         </exec_method>

 </service>
 </service_bundle>

Create the method

Create the file /opt/coolstack/lib/svc/method/svc-cskmysql referenced in the manifest with the following contents and make it executable. You may have to create the directories below /opt/coolstack/lib first. This file needs to be edited to set DB_DIR to the path of your data directory (where data files reside), and MYSQL_DIR if you are using the 64-bit MySQL version.

#!/usr/bin/sh
#
#   Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
#        Method file for CSKMySQL
#
# This uses the MySQL packages from CoolStack 1.1 (CSKmysql)
# If you're using the 32bit mysql from CSKamp, change MYSQL_DIR below to mysql_32bit.
# This file should reside in /opt/coolstack/lib/svc/method
#
# NOTE: Make sure DB_DIR is owned BY the mysql user and group and chmod 700
#

. /lib/svc/share/smf_include.sh

DB_DIR=/data
PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid
MYSQL_DIR=/opt/coolstack/mysql_32bit

mysql_stop () {
        if [ -f ${PIDFILE} ]; then
            /usr/bin/pkill mysqld_safe >/dev/null 2>&1
            /usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ' mysqld'
        fi
}

mysql_start () {
        $MYSQL_DIR/bin/mysqld_safe --user=mysql --datadir=${DB_DIR} --pid-file=${PIDFILE} > /dev/null &
}

##
# Start of script
#
case "$1" in
    start)
        mysql_start
        ;;
    stop)
        mysql_stop
        ;;
    restart)
        mysql_stop
        while pgrep mysqld > /dev/null
        do
            sleep 1
        done
        mysql_start
        ;;
    \*)
        echo ""
        echo "Usage: `basename $0` { start | stop | restart }"
        echo ""
        exit 64
        ;;
esac


Change file ownership

Ensure that the mysql user and group exist and this user owns $DB_DIR. It's also a good idea to chmod 0700 all files in $DB_DIR.

Start the csk-mysql service

Import the new mysql config :

# svccfg -v import /var/svc/manifest/network/cskmysql.xml

We are now ready to start our service. Start it as follows :

# svcadm -v enable csk-mysql

If the service starts successfully, you should see mysqld running. A log of the
service startup will be in /var/svc/log/network-csk-mysql:CSKmysql.log file. You can also get more detailed information for troubleshooting startup failures from the command svcs -x. More information on SMF can be found at  http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html

 


Thursday Apr 12, 2007

SMF support for Cool Stack Apache

Here are instructions on how to use SMF to manage Apache. These instructions assume no knowledge of SMF. All commands should be executed as root.

Create the manifest

 The manifest defines the service and controls the privileges with which the service will execute. We use the service name csk-httpd to distinguish this as a Cool Stack service (and not to cause any confusion with the httpd service that already exists).

Create a file named /var/svc/manifest/network/cskapache2.xml with the following contents :

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
    Copyright 2006-2007 Sun Microsystems, Inc.  All rights reserved.
    CSKapache2 manifest - should reside in /var/svc/manifest/network.
-->

<service_bundle type='manifest' name='CSKamp:apache'>

<service
    name='network/csk-http'
    type='service'
    version='1'>

    <!--
       Because we may have multiple instances of network/http
       provided by different implementations, we keep dependencies
       and methods within the instance.
    -->

    <instance name='CSKapache2' enabled='false'>
    <!--
       Wait for network interfaces to be initialized.
    -->
       <dependency name='network'
           grouping='require_all'
           restart_on='error'
           type='service'>
           <service_fmri value='svc:/milestone/network:default'/>
       </dependency>

       <!--
          Wait for all local filesystems to be mounted.
       -->
       <dependency name='filesystem-local'
           grouping='require_all'
           restart_on='none'
           type='service'>
           <service_fmri
               value='svc:/system/filesystem/local:default'/>
       </dependency>

       <!--
           Wait for automounting to be available, as we may be
           serving data from home directories or other remote
           filesystems.
       -->
       <dependency name='autofs'
           grouping='optional_all'
           restart_on='error'
           type='service'>
           <service_fmri
               value='svc:/system/filesystem/autofs:default'/>
       </dependency>

       <exec_method
           type='method'
           name='start'
           exec='/opt/coolstack/lib/svc/method/svc-cskapache2 start'
           timeout_seconds='60'>
           <method_context>
               <method_credential
                   user='webservd' group='webservd'
                   privileges='basic,!proc_session,!proc_info,!file_link_any,net_privaddr' />
           </method_context>
      </exec_method>

      <exec_method
           type='method'
           name='stop'
           exec='/opt/coolstack/lib/svc/method/svc-cskapache2 stop'
           timeout_seconds='60'>
           <method_context />
      </exec_method>

       <exec_method
           type='method'
           name='refresh'
           exec='/opt/coolstack/lib/svc/method/svc-cskapache2 refresh'
           timeout_seconds='60'>
           <method_context />
      </exec_method>

        <property_group name='httpd' type='application'>
            <stability value='Evolving' />
            <propval name='ssl' type='boolean' value='false' />
        </property_group>

        <property_group name='startd' type='framework'>
            <!-- sub-process core dumps shouldn't restart session -->
            <propval name='ignore_error' type='astring'
                     value='core,signal' />
        </property_group>

    </instance>

    <stability value='Evolving' />
    <template>
        <common_name>
            <loctext xml:lang='C'>
                Apache 2 HTTP server
            </loctext>
        </common_name>
        <documentation>
            <manpage title='httpd' section='8'
                manpath='/opt/coolstack/apache2/man' />
            <doc_link name='apache.org'
                uri='http://httpd.apache.org' />
        </documentation>
    </template>
</service>

</service_bundle>

Create the method

Create the file /opt/coolstack/lib/svc/method/svc-cskapache2 referenced in the manifest with the following contents and make it executable. You will have to create all directories below /opt/coolstack/lib first.This file assumes a certain name and location for the apache configuration and pid file. Edit it if you are not using the default settings from Cool Stack.

#!/sbin/sh
#
# Copyright 2004-2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)http-apache2       1.2     04/11/11 SMI"
# Modified for apache in CSKamp package of Cool Stack
# This file should reside in /opt/coolstack/lib/svc/method

. /lib/svc/share/smf_include.sh

APACHE_HOME=/opt/coolstack/apache2
CONF_FILE=$APACHE_HOME/conf/httpd.conf
PIDFILE=$APACHE_HOME/logs/httpd.pid

[ ! -f ${CONF_FILE} ] &&  exit $SMF_EXIT_ERR_CONFIG

case "$1" in
    start)
        /bin/rm -f ${PIDFILE}
        cmd="start"
        ;;
    refresh)
        cmd="graceful"
        ;;
    stop)
        cmd="stop"
        ;;
    \*)
        echo "Usage: $0 {start|stop|refresh}"
        exit 1
        ;;
esac

exec ${APACHE_HOME}/bin/apachectl $cmd 2>&1

Change file ownership

Since we want to start apache as user webservd (not root), we need to ensure that this user can write to the log directory and the pid file. All these files  reside in /opt/coolstack/apache2/logs by default.

# cd /opt/coolstack/apache2
# chown -R webservd logs
# chgrp -R webservd logs


Disable the Solaris http service

We do not want our service to conflict with the apache2 service that ships with Solaris. Note that by default, this service is disabled. You can check if it is enabled as follows :

# svcs |grep http

If no output is printed, then it is disabled. If you see something like :

maintenance    11:47:11 svc:/network/http:apache2

or

online    11:47:11 svc:/network/http:apache2

then, the service is up. Disable the service as follows : 

# svcadm -v disable http

svc:/network/http:apache2 disabled.
 

Start the csk-http service

Import the new service config as follows :

# svccfg -v import /var/svc/manifest/network/cskapache2.xml

We are now ready to start our service. Start it as follows :

# svcadm -v enable csk-http 

If the service starts successfully, you should see httpd processes running. A log of the service startup will be in /var/svc/log/network-csk-http:CSKapache2.log file. You can also get more detailed information for troubleshooting startup failures from the command svcs -x. More information on SMF can be found at  http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html

 

 


 

About

I'm a Senior Staff Engineer in the Performance & Applications Engineering Group (PAE). This blog focuses on tips to build, configure, tune and measure performance of popular open source web applications on Solaris.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today