-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7f980f9
Showing
20 changed files
with
450 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
logs | ||
project/project | ||
project/target | ||
#target #commented for deploying to openshift | ||
tmp | ||
.history | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This is a simple build script and will be executed on your CI system if | ||
# available. Otherwise it will execute while your application is stopped | ||
# before the deploy step. This script gets executed directly, so it | ||
# could be python, php, ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This deploy hook gets executed after dependencies are resolved and the | ||
# build hook has been run but before the application has been started back | ||
# up again. This script gets executed directly, so it could be python, php, | ||
# ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# debug | ||
# set -x | ||
|
||
# check needed vars | ||
if [[ -z $OPENSHIFT_REPO_DIR ]]; then | ||
echo "Error: OPENSHIFT_REPO_DIR not defined" | ||
return 1 | ||
fi | ||
|
||
PLAY_PARAMS="" | ||
|
||
PLAY_CONFIG_FILE="${OPENSHIFT_REPO_DIR}conf/openshift.conf" | ||
|
||
if [[ -f $PLAY_CONFIG_FILE ]]; then | ||
|
||
function read_conf { | ||
local key=$1 | ||
local default=$2 | ||
local result=`grep "^$key[ |=]" $PLAY_CONFIG_FILE` | ||
|
||
# key not found | ||
if [[ -z "$result" ]]; then | ||
echo $default | ||
else | ||
result=`echo "$result" | grep -oP "=.*" | cut -b 1 --complement` | ||
echo $result | ||
fi | ||
} | ||
|
||
PLAY_PARAMS=$(read_conf "openshift.play.params" $PLAY_PARAMS) | ||
fi | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# This is a simple post deploy hook executed after your application | ||
# is deployed and started. This script gets executed directly, so | ||
# it could be python, php, ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This is a simple script and will be executed on your CI system if | ||
# available. Otherwise it will execute while your application is stopped | ||
# before the build step. This script gets executed directly, so it | ||
# could be python, php, ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
# The logic to start up your application should be put in this | ||
# script. The application will work only if it binds to | ||
# $OPENSHIFT_INTERNAL_IP:8080 | ||
|
||
|
||
# loads $PLAY_PARAMS | ||
. ${OPENSHIFT_REPO_DIR}.openshift/action_hooks/load_config | ||
|
||
if [[ ! $? -eq 0 ]]; then | ||
exit $? | ||
fi | ||
|
||
LOG_FILE="${OPENSHIFT_LOG_DIR}play.log" | ||
|
||
APP_COMMAND="${OPENSHIFT_REPO_DIR}target/start $PLAY_PARAMS "\ | ||
"-Dhttp.port=${OPENSHIFT_INTERNAL_PORT} "\ | ||
"-Dhttp.address=${OPENSHIFT_INTERNAL_IP} "\ | ||
"-Dconfig.resource=openshift.conf" | ||
|
||
echo $APP_COMMAND &>> $LOG_FILE | ||
nohup bash -c "$APP_COMMAND &>> ${LOG_FILE} 2>&1" &> /dev/null & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
# The logic to stop your application should be put in this script. | ||
|
||
# debug | ||
# set -x | ||
|
||
LOG_FILE="${OPENSHIFT_LOG_DIR}play.log" | ||
|
||
function kill_app { | ||
COMMAND="$1" | ||
# try 5 times to kill it | ||
for c in `seq 1 5`; do | ||
echo "Trying to kill proccess, attempt number $c" >> $LOG_FILE | ||
echo "$COMMAND" >> $LOG_FILE | ||
bash -c "$COMMAND &>> $LOG_FILE 2>&1" &> /dev/null | ||
sleep $c | ||
#killed it | ||
if [[ -z `ps -A | grep ' java$'` ]]; then | ||
if [[ -f "RUNNING_PID" ]]; then | ||
rm RUNNING_PID | ||
fi | ||
popd > /dev/null | ||
exit 0 | ||
fi | ||
done | ||
} | ||
|
||
if [[ ! $? -eq 0 ]]; then | ||
exit $? | ||
fi | ||
|
||
pushd "$OPENSHIFT_REPO_DIR" > /dev/null | ||
|
||
#kill play if it was running | ||
if [[ -f "RUNNING_PID" ]]; then | ||
|
||
pid=`cat RUNNING_PID` | ||
echo "Stopping play application" >> $LOG_FILE | ||
|
||
if [[ -n $pid ]]; then | ||
#try to kill it nicely | ||
kill_app "kill -SIGTERM $pid" | ||
#try to kill it harshly | ||
kill_app "kill -SIGKILL $pid" | ||
fi | ||
fi | ||
|
||
#it survived, try to kill java | ||
if [[ -n `ps -A | grep java` ]]; then | ||
echo "Stopping java proccess" >> $LOG_FILE | ||
#try to kill it nicely | ||
kill_app "pkill -SIGTERM java" | ||
#try to kill it harshly | ||
kill_app "pkill -SIGKILL java" | ||
fi | ||
|
||
#couldn't kill it | ||
if [[ -n `ps -A | grep java` ]]; then | ||
echo "Error: could not stop play application, error executing 'pkill java'" >> $LOG_FILE | ||
popd | ||
exit 1 | ||
fi | ||
|
||
popd > /dev/null | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Run scripts or jobs on a periodic basis | ||
======================================= | ||
Any scripts or jobs added to the minutely, hourly, daily, weekly or monthly | ||
directories will be run on a scheduled basis (frequency is as indicated by the | ||
name of the directory) using run-parts. | ||
|
||
run-parts ignores any files that are hidden or dotfiles (.*) or backup | ||
files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} | ||
|
||
The presence of two specially named files jobs.deny and jobs.allow controls | ||
how run-parts executes your scripts/jobs. | ||
jobs.deny ===> Prevents specific scripts or jobs from being executed. | ||
jobs.allow ===> Only execute the named scripts or jobs (all other/non-named | ||
scripts that exist in this directory are ignored). | ||
|
||
The principles of jobs.deny and jobs.allow are the same as those of cron.deny | ||
and cron.allow and are described in detail at: | ||
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-autotasks-cron-access | ||
|
||
See: man crontab or above link for more details and see the the weekly/ | ||
directory for an example. | ||
|
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Run scripts or jobs on a weekly basis | ||
===================================== | ||
Any scripts or jobs added to this directory will be run on a scheduled basis | ||
(weekly) using run-parts. | ||
|
||
run-parts ignores any files that are hidden or dotfiles (.*) or backup | ||
files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} and handles | ||
the files named jobs.deny and jobs.allow specially. | ||
|
||
In this specific example, the chronograph script is the only script or job file | ||
executed on a weekly basis (due to white-listing it in jobs.allow). And the | ||
README and chrono.dat file are ignored either as a result of being black-listed | ||
in jobs.deny or because they are NOT white-listed in the jobs.allow file. | ||
|
||
For more details, please see ../README.cron file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Time And Relative D...n In Execution (Open)Shift! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
echo "`date`: `cat $(dirname \"$0\")/chrono.dat`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Script or job files listed in here (one entry per line) will be | ||
# executed on a weekly-basis. | ||
# | ||
# Example: The chronograph script will be executed weekly but the README | ||
# and chrono.dat files in this directory will be ignored. | ||
# | ||
# The README file is actually ignored due to the entry in the | ||
# jobs.deny which is checked before jobs.allow (this file). | ||
# | ||
chronograph | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
# Any script or job files listed in here (one entry per line) will NOT be | ||
# executed (read as ignored by run-parts). | ||
# | ||
|
||
README | ||
|
Oops, something went wrong.