Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
php v2 cartridge clean-up
Browse files Browse the repository at this point in the history
- Control script
  - clean-up
  - add return codes
  - add graceful restart
  - add configtest
  - fix reload
- Teardown - remove ~/.pearrc
- Remove extra include in the conf/httpd*.conf files (the conf.d/*.conf are included automatically)
- Remove unused bin/deploy
- Remove unused lib/util
  • Loading branch information
VojtechVitek committed May 28, 2013
1 parent fdca226 commit ad869d8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 55 deletions.
Empty file.
56 changes: 25 additions & 31 deletions cartridges/openshift-origin-cartridge-php/bin/control
Expand Up @@ -5,42 +5,36 @@ source $OPENSHIFT_CARTRIDGE_SDK_BASH
HTTPD_CFG_FILE=$OPENSHIFT_PHP_DIR/configuration/etc/conf/httpd_nolog.conf
HTTPD_CFG_DIR=$OPENSHIFT_PHP_DIR/configuration/etc/conf.d

function start() {
echo "Starting PHP cart"
update_httpd_passenv $HTTPD_CFG_FILE
/usr/sbin/httpd -C "Include $HTTPD_CFG_DIR/*.conf" -f $HTTPD_CFG_FILE -k start
function apache() {
client_message "$2 Apache+mod_php HTTPD server"
[ "$1" != "stop" ] && update_httpd_passenv $HTTPD_CFG_FILE
/usr/sbin/httpd -C "Include $HTTPD_CFG_DIR/*.conf" -f $HTTPD_CFG_FILE -k $1
return $?
}

function stop() {
echo "Stopping PHP cart"
/usr/sbin/httpd -C "Include $HTTPD_CFG_DIR/*.conf" -f $HTTPD_CFG_FILE -k stop
}

function restart() {
echo "Restarting PHP cart"
update_httpd_passenv $HTTPD_CFG_FILE
/usr/sbin/httpd -C "Include $HTTPD_CFG_DIR/*.conf" -f $HTTPD_CFG_FILE -k restart
function configtest() {
client_message "Testing Apache *.conf files"
/usr/sbin/httpd -C "Include $HTTPD_CFG_DIR/*.conf" -f $HTTPD_CFG_FILE -t
return $?
}

function status() {
if output=$(curl http://$OPENSHIFT_PHP_IP:$OPENSHIFT_PHP_PORT/server-status?auto 2>&1 )
then
client_result "Application is running"
client_result $output
return 0
else
client_result "Application is either stopped or inaccessible"
return 1
fi
}

function reload() {
echo "Reloading PHP cart"
restart
}

function tidy() {
client_message "Emptying log dir: $OPENSHIFT_PHP_LOG_DIR"
shopt -s dotglob
rm -rf $OPENSHIFT_PHP_LOG_DIR/*
return 0
}

function build() {
Expand Down Expand Up @@ -68,20 +62,20 @@ function build() {
fi
done
fi
}

function deploy() {
echo "TODO"
return 0
}

case "$1" in
start) start ;;
stop) stop ;;
restart) restart ;;
status) status ;;
reload) reload ;;
tidy) tidy ;;
build) build ;;
deploy) deploy ;;
*) exit 0
start) apache start "Starting" ;;
stop) apache stop "Stopping" ;;
restart) apache restart "Restarting" ;;
reload|graceful) apache graceful "Restarting gracefully" ;;
status) status ;;
configtest) configtest ;;
tidy) tidy ;;
build) build ;;
deploy) exit 0 ;; # Nothing to deploy on template PHP cartridge
*) client_message "\`$1' control action not implemented"; exit 0
esac

exit $?
3 changes: 3 additions & 0 deletions cartridges/openshift-origin-cartridge-php/bin/teardown
@@ -0,0 +1,3 @@
#!/bin/bash -ue

rm -f $OPENSHIFT_HOMEDIR/.pearrc
16 changes: 0 additions & 16 deletions cartridges/openshift-origin-cartridge-php/lib/util

This file was deleted.

Expand Up @@ -255,5 +255,3 @@ ExtendedStatus On
# Deny from all
# Allow from .example.com
#</Location>

include <%= "#{ENV['OPENSHIFT_PHP_DIR']}/configuration/etc/conf.d/php.conf" %>
Expand Up @@ -255,5 +255,3 @@ ExtendedStatus On
# Deny from all
# Allow from .example.com
#</Location>

include <%= "#{ENV['OPENSHIFT_PHP_DIR']}/configuration/etc/conf.d/php.conf" %>
Expand Up @@ -251,5 +251,3 @@ ExtendedStatus On
# Deny from all
# Allow from .example.com
#</Location>

include <%= "#{ENV['OPENSHIFT_PHP_DIR']}/configuration/etc/conf.d/php.conf" %>
Expand Up @@ -250,5 +250,3 @@ ExtendedStatus On
# Deny from all
# Allow from .example.com
#</Location>

include <%= "#{ENV['OPENSHIFT_PHP_DIR']}/configuration/etc/conf.d/php.conf" %>

0 comments on commit ad869d8

Please sign in to comment.