Thought I''d drop a note about my experience with running mongrel directly under the solaris service management framework. So far I''m very impressed. SMF is the solaris replacement for the init system. It''s tied much more closely to the OS and for instance doesn''t use pid files. I''ve found you can completely eliminate mongrel cluster, and for that matter the normal monitoring system like monit. Another nice feature is that solaris lets you easily give start/stop privileges to non root users, so no need to use sudo when restarting mongrel via capistrano. Chris
What are you using as the exec_method? Are you just stringing mongrel_rails start -p PORT together for each mongrel instance that you are running (changing the port number for each instance)?. On 6/25/07, snacktime <snacktime at gmail.com> wrote:> Thought I''d drop a note about my experience with running mongrel > directly under the solaris service management framework. So far I''m > very impressed. SMF is the solaris replacement for the init system. > It''s tied much more closely to the OS and for instance doesn''t use pid > files. I''ve found you can completely eliminate mongrel cluster, and > for that matter the normal monitoring system like monit. Another nice > feature is that solaris lets you easily give start/stop privileges to > non root users, so no need to use sudo when restarting mongrel via > capistrano.-- Mark James Adams
On Jun 26, 2007, at 00:29 , Mark James Adams wrote:> What are you using as the exec_method? Are you just stringing > mongrel_rails start -p PORT together for each mongrel instance that > you are running (changing the port number for each instance)?. > > On 6/25/07, snacktime <snacktime at gmail.com> wrote: >> Thought I''d drop a note about my experience with running mongrel >> directly under the solaris service management framework. So far I''m >> very impressed. SMF is the solaris replacement for the init system. >> It''s tied much more closely to the OS and for instance doesn''t use >> pid >> files. I''ve found you can completely eliminate mongrel cluster, and >> for that matter the normal monitoring system like monit. Another >> nice >> feature is that solaris lets you easily give start/stop privileges to >> non root users, so no need to use sudo when restarting mongrel via >> capistrano.Snacktime, Yes please do include details on your implementation as I am curious if Solaris is a viable option. Thanks! -- Wayne E. Seguin Sr. Systems Architect & Systems Admin wayneseguin at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070626/ff0e27d4/attachment.html
I create a single service with an instance for each mongrel. The start exec_method calls a shell script that first deletes the pid file if it exists then runs mongrel directly with all the options as arguments, no config file. Right now we are just using :kill in the stop exec_method. Note the property group for the authorizations in the service section. This is what is used to allow a specific non root user to control this service via svcadm in conjunction with an entry in /etc/user_attr. So far it''s working pretty well but we still need to make some adjustments, like telling the system to back off a bit and send a notification if mongrel won''t start, setting resource limits, etc.. /etc/user_attr: www::::auths=solaris.smf.manage.mongrel Sample config with one instance: <service_bundle type=''manifest'' name=''Mongrel''> <service name=''network/mongrel'' type=''service'' version=''0''> <dependency name=''fs'' grouping=''require_all'' restart_on=''none'' type=''service''> <service_fmri value=''svc:/system/filesystem/local''/> </dependency> <dependency name=''net'' grouping=''require_all'' restart_on=''none'' type=''service''> <service_fmri value=''svc:/network/loopback''/> </dependency> <dependent name=''mongrel_multi-user'' restart_on=''none'' grouping=''optional_all''> <service_fmri value=''svc:/milestone/multi-user''/> </dependent> <property_group name=''general'' type=''framework''> <propval name=''action_authorization'' type=''astring'' value=''solaris.smf.manage.mongrel'' /> <propval name=''value_authorization'' type=''astring'' value=''solaris.smf.manage.mongrel'' /> </property_group> <instance name=''p8000'' enabled=''false''> <exec_method name=''start'' type=''method'' exec=''/opt/csw/lib/svc/method/svc-mongrel 8000'' timeout_seconds=''60''> <method_context working_directory=''/opt/local/www/rails/staging/current''> <method_credential user=''mongrel'' group=''www'' /> <method_environment> <envvar name="PATH" value="/usr/bin:/bin:/opt/csw/bin" /> </method_environment> </method_context> </exec_method> <exec_method name=''stop'' type=''method'' exec='':kill'' timeout_seconds=''60''> <method_context/> </exec_method> <property_group name=''mongrel'' 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> <!-- more instances here --> <stability value=''Evolving'' /> </service> </service_bundle> svc-mongrel: #!/sbin/sh . /lib/svc/share/smf_include.sh PORT=$1 ENVIRONMENT=staging CWD=/opt/local/www/rails/$ENVIRONMENT/current LOGFILE=/opt/local/www/rails/$ENVIRONMENT/shared/log/mongrel_$PORT.log PIDFILE=/opt/local/www/rails/$ENVIRONMENT/shared/pids/mongrel_$PORT.pid DOCROOT=$CWD/public IP=10.1.1.4 USER=mongrel GROUP=www /bin/rm -f $PIDFILE /opt/csw/bin/mongrel_rails start -d -e $ENVIRONMENT -p $PORT -a $IP -l $LOGFILE -r $DOCROOT -c $CWD --user $USER --group $GROUP -P $PIDFILE