chiliproj/rc.chiliproj

changeset 767
3ee660c5bc4f
parent 766
fd2bc92f4dee
child 774
9024b850a1f9
     1.1 --- a/chiliproj/rc.chiliproj	Mon Apr 01 20:12:48 2013 +0200
     1.2 +++ b/chiliproj/rc.chiliproj	Tue Apr 02 20:44:50 2013 +0200
     1.3 @@ -4,22 +4,29 @@
     1.4  ##
     1.5  
     1.6  %config
     1.7 -    chili_enable="$openpkg_rc_def"
     1.8 -    chili_host="localhost"
     1.9 -    chili_port=3000
    1.10 -    chili_svcs=1
    1.11 -    chili_log_prolog="true"
    1.12 -    chili_log_epilog="true"
    1.13 -    chili_log_numfiles="10"
    1.14 -    chili_log_minsize="1M"
    1.15 -    chili_log_complevel="9"
    1.16 -    chili_logfile="@l_prefix@/lib/chiliproj/log/production.log"
    1.17 -    chili_thinpath="@l_prefix@/var/chiliproj"
    1.18 +    chiliproj_enable="$openpkg_rc_def"
    1.19 +    chiliproj_cleartext"="yes"
    1.20 +    chiliproj_tlsecured"="no"
    1.21 +    #chiliproj_flags="-u @l_nusr@ -g @l_musr@"
    1.22 +    chiliproj_flags=""
    1.23 +    chiliproj_host="localhost"
    1.24 +    chiliproj_port_clt=80
    1.25 +    chiliproj_port_tls=443
    1.26 +    chiliproj_svcs=1
    1.27 +    chiliproj_key="@l_prefix@/etc/openssl/host-ca-rsa-4096-key.pem"
    1.28 +    chiliproj_crt="@l_prefix@/etc/openssl/host-ca-rsa-4096-crt.pem"
    1.29 +    chiliproj_log_prolog="true"
    1.30 +    chiliproj_log_epilog="true"
    1.31 +    chiliproj_log_numfiles="10"
    1.32 +    chiliproj_log_minsize="1M"
    1.33 +    chiliproj_log_complevel="9"
    1.34 +    chiliproj_logfile="@l_prefix@/lib/chiliproj/log/production.log"
    1.35 +    chiliproj_thinpath="@l_prefix@/var/chiliproj"
    1.36  
    1.37  %common
    1.38 -    chili_pidpath="@l_prefix@/var/chiliproj"
    1.39 -    chili_signal () {
    1.40 -        for thepid in ${chili_pidpath}/thind.[0-9][0-9]*.pid; do
    1.41 +    chiliproj_pidpath="@l_prefix@/var/chiliproj"
    1.42 +    chiliproj_signal () {
    1.43 +        for thepid in ${chiliproj_pidpath}/thind.[0-9][0-9]*.pid; do
    1.44              [ -f $thepid ] && kill -$1 `cat $thepid`
    1.45              proclive=$?
    1.46              if [ $proclive = 0 ]; then break; fi
    1.47 @@ -28,39 +35,52 @@
    1.48      }
    1.49  
    1.50  %status -u @l_susr@ -o
    1.51 -    chili_usable="unknown"
    1.52 -    chili_active="no"
    1.53 +    chiliproj_usable="unknown"
    1.54 +    chiliproj_active="no"
    1.55      rcService chiliproj enable yes && \
    1.56 -        chili_signal 0 && chili_active="yes"
    1.57 -    echo "chili_enable=\"$chili_enable\""
    1.58 -    echo "chili_usable=\"$chili_usable\""
    1.59 -    echo "chili_active=\"$chili_active\""
    1.60 +        chiliproj_signal 0 && chiliproj_active="yes"
    1.61 +    echo "chiliproj_enable=\"$chiliproj_enable\""
    1.62 +    echo "chiliproj_usable=\"$chiliproj_usable\""
    1.63 +    echo "chiliproj_active=\"$chiliproj_active\""
    1.64  
    1.65  %start -u @l_susr@
    1.66      rcService chiliproj enable yes || exit 0
    1.67      rcService chiliproj active yes && exit 0
    1.68 -#--ssl
    1.69 -#--ssl-verify
    1.70 -#--ssl-key-file <path>
    1.71 -#--ssl-cert-file <path>
    1.72 -    cd @l_chilipath@ && \
    1.73 -        @l_gempath@/bin/bundle exec thin \
    1.74 -        -d \
    1.75 -        -e production \
    1.76 -        -u @l_nusr@ \
    1.77 -        -g @l_mgrp@ \
    1.78 -        -a $chili_host \
    1.79 -        -p $chili_port \
    1.80 -        -s $chili_svcs \
    1.81 -        -P $chili_pidpath/thind.pid \
    1.82 -        -l $chili_thinpath/thind.log \
    1.83 -        start
    1.84 +    if [ "$chiliproj_cleartext" = "yes" ]; then
    1.85 +        cd @l_chilipath@ && \
    1.86 +            @l_gempath@/bin/bundle exec thin \
    1.87 +                -d \
    1.88 +                -e production \
    1.89 +                -a $chiliproj_host \
    1.90 +                -p $chiliproj_port_clt \
    1.91 +                -s $chiliproj_svcs \
    1.92 +                -P $chiliproj_pidpath/thind.pid \
    1.93 +                -l $chiliproj_thinpath/thind.log \
    1.94 +                $chiliproj_flags \
    1.95 +                start
    1.96 +    fi
    1.97 +    if [ "$chiliproj_tlsecured" = "yes" ]; then
    1.98 +        cd @l_prefix@/lib/chiliproj && \
    1.99 +            @l_gempath@/bin/bundle exec thin \
   1.100 +                -d \
   1.101 +                -e production \
   1.102 +                -a $chiliproj_host \
   1.103 +                -p $chiliproj_port_tls \
   1.104 +                -s $chiliproj_svcs \
   1.105 +                -P $chiliproj_pidpath/thind.pid \
   1.106 +                -l $chiliproj_thinpath/thind.log \
   1.107 +                --ssl \
   1.108 +                --ssl-key-file $chiliproj_key \
   1.109 +                --ssl-cert-file $chiliproj_crt \
   1.110 +                $chiliproj_flags \
   1.111 +                start
   1.112 +    fi
   1.113  
   1.114  %stop -u @l_susr@
   1.115      rcService chiliproj enable yes || exit 0
   1.116      rcService chiliproj active no  && exit 0
   1.117      cd @l_chilipath@
   1.118 -    for thepid in ${chili_pidpath}/thind.[0-9][0-9]*.pid; do
   1.119 +    for thepid in ${chiliproj_pidpath}/thind.[0-9][0-9]*.pid; do
   1.120          cd @l_prefix@/lib/chiliproj
   1.121          @l_gempath@/bin/bundle exec thin -P $thepid stop
   1.122      done
   1.123 @@ -77,17 +97,17 @@
   1.124      rcTmp -i
   1.125      hintfile=`rcTmp -f -n hint`
   1.126      shtool rotate -f \
   1.127 -        -n ${chili_log_numfiles} -s ${chili_log_minsize} -d \
   1.128 -        -z ${chili_log_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \
   1.129 -        -P "${chili_log_prolog}" \
   1.130 -        -E "${chili_log_epilog}; echo 1 >$hintfile" \
   1.131 -        ${chili_logfile}
   1.132 +        -n ${chiliproj_log_numfiles} -s ${chiliproj_log_minsize} -d \
   1.133 +        -z ${chiliproj_log_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \
   1.134 +        -P "${chiliproj_log_prolog}" \
   1.135 +        -E "${chiliproj_log_epilog}; echo 1 >$hintfile" \
   1.136 +        ${chiliproj_logfile}
   1.137      shtool rotate -f \
   1.138 -        -n ${chili_thin_numfiles} -s ${chili_thin_minsize} -d \
   1.139 -        -z ${chili_thin_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \
   1.140 -        -P "${chili_thin_prolog}" \
   1.141 -        -E "${chili_thin_epilog}; echo 1 >$hintfile" \
   1.142 -        ${chili_thinpath}/thind.*.log
   1.143 +        -n ${chiliproj_thin_numfiles} -s ${chiliproj_thin_minsize} -d \
   1.144 +        -z ${chiliproj_thin_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \
   1.145 +        -P "${chiliproj_thin_prolog}" \
   1.146 +        -E "${chiliproj_thin_epilog}; echo 1 >$hintfile" \
   1.147 +        ${chiliproj_thinpath}/thind.*.log
   1.148      if [ -s $hintfile ]; then
   1.149          rc chiliproj restart
   1.150      fi

mercurial