From d94e61a7b627381715751fb6cb6c0cecf7ece3f9 Mon Sep 17 00:00:00 2001 From: Template builder Date: Sun, 5 Jul 2015 16:27:08 -0400 Subject: Creating template --- .openshift/action_hooks/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .openshift/action_hooks/README.md (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/README.md b/.openshift/action_hooks/README.md new file mode 100644 index 000000000..541319581 --- /dev/null +++ b/.openshift/action_hooks/README.md @@ -0,0 +1,3 @@ +For information about action hooks, consult the documentation: + +http://openshift.github.io/documentation/oo_user_guide.html#action-hooks -- cgit v1.2.3 From fad9594b31629c697bf7ddab9e01d92f4868e605 Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Tue, 1 Sep 2015 18:44:37 +0200 Subject: Added openshift-hubzilla-deploy to .openshift/action_hooks/deploy --- .openshift/action_hooks/deploy | 110 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 .openshift/action_hooks/deploy (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy new file mode 100755 index 000000000..b7f095ccd --- /dev/null +++ b/.openshift/action_hooks/deploy @@ -0,0 +1,110 @@ +#!/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. + +# Bash help: http://www.panix.com/~elflord/unix/bash-tute.html + +# For information about action hooks supported by OpenShift, consult the documentation: +# http://openshift.github.io/documentation/oo_user_guide.html#the-openshift-directory + +#### + +# Hubzilla specific deploy script + +# Place this file in /.openshift/action_hooks/ (The .openshift folder will be in the root of your repo) +# The file name should be "deploy" such that you have: +# .openshift/action_hooks/deploy + +# Conventions: Vars in curley braces have the slash after implied so no need to add it. +# e.g. ${OPENSHIFT_REPO_DIR}php/foobar = /repo/php/foobar +# See all OpenShift vars here: +# https://www.openshift.com/developers/openshift-environment-variables + +# HME - NOTE - leftover from original openshift-drupal-deploy +# In config.php you can leverage the enviroment variables like this: +# // Define env vars. +# if (array_key_exists('OPENSHIFT_APP_NAME', $_SERVER)) { +# $src = $_SERVER; +# } else { +# $src = $_ENV; +# } +# +# $conf["file_private_path"] = $src['OPENSHIFT_DATA_DIR'] . "private"; +# $conf["file_temporary_path"] = $src['OPENSHIFT_DATA_DIR'] . "tmp"; + + +#### + +# Start Deploy + +echo "Starting Deploy..." + +# Let's create the Hubzilla files directory in the Openshift data folder ($OPENSHIFT_DATA_DIR). + +echo "Check for the files directory called store, if not created - create it" + +if [ ! -d ${OPENSHIFT_DATA_DIR}store ]; then +mkdir -p ${OPENSHIFT_DATA_DIR}"store/[data]/smarty3" +echo "Done creating files directory" + +else + +echo "The files directory called store already exists" + +fi + +#### + +# Set permissions on the files directory. + +echo "Now chmod 777 -R files" + +chmod -R 777 ${OPENSHIFT_DATA_DIR}store + +echo "chmod done, permissions set to 777" + +#### + +# Symlink our files folder to the repo. + +# Note the "php" directory below seems to be the best way to serve OpenShift files. +# This is good as that allows us for directories one level above such as tmp and private + +echo "Create sym links for writeable directories" + +ln -sf ${OPENSHIFT_DATA_DIR}store ${OPENSHIFT_REPO_DIR}store + +echo "Files sym links created" + +#### + +# Copy config.php from the repo, rename it and place it in the data directory. +# if it's there already, skip it. + +if [ ! -f ${OPENSHIFT_DATA_DIR}config.php ]; + +then + +cp ${OPENSHIFT_REPO_DIR}config.php ${OPENSHIFT_DATA_DIR}config.php + +echo "config.php copied." + +else + +echo "Looks like the config.php file is already there, we won't overwrite it." + +fi + +#### + +# symlink the config.php file. + +echo "Create sym link for config.php" + +ln -sf ${OPENSHIFT_DATA_DIR}config.php ${OPENSHIFT_REPO_DIR}config.php + +echo "config.php symlink created" + +#### -- cgit v1.2.3 From 5cb2fa598172e8848cdb2b9f0101bff7ac97a1e1 Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Tue, 1 Sep 2015 19:25:41 +0200 Subject: Fixed deploy script --- .openshift/action_hooks/deploy | 45 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index b7f095ccd..fb3136f32 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -80,31 +80,60 @@ echo "Files sym links created" #### -# Copy config.php from the repo, rename it and place it in the data directory. +# Copy .htconfig.php from the repo, rename it and place it in the data directory. # if it's there already, skip it. if [ ! -f ${OPENSHIFT_DATA_DIR}config.php ]; then -cp ${OPENSHIFT_REPO_DIR}config.php ${OPENSHIFT_DATA_DIR}config.php +cp ${OPENSHIFT_REPO_DIR}.htconfig.php ${OPENSHIFT_DATA_DIR}.htconfig.php -echo "config.php copied." +echo ".htconfig.php copied." else -echo "Looks like the config.php file is already there, we won't overwrite it." +echo "Looks like the .htconfig.php file is already there, we won't overwrite it." fi #### -# symlink the config.php file. +# symlink the .htconfig.php file. -echo "Create sym link for config.php" +echo "Create sym link for .htconfig.php" -ln -sf ${OPENSHIFT_DATA_DIR}config.php ${OPENSHIFT_REPO_DIR}config.php +ln -sf ${OPENSHIFT_DATA_DIR}.htconfig.php ${OPENSHIFT_REPO_DIR}.htconfig.php -echo "config.php symlink created" +echo ".htconfig.php symlink created" #### +# Copy .htaccess from the repo, rename it and place it in the data directory. +# if it's there already, skip it. + +if [ ! -f ${OPENSHIFT_DATA_DIR}.htaccess ]; + +then + +cp ${OPENSHIFT_REPO_DIR}.htaccess ${OPENSHIFT_DATA_DIR}.htaccess + +echo ".htaccess copied." + +else + +echo "Looks like the .htaccess file is already there, we won't overwrite it." + +fi + +#### + +# symlink the .htaccess file. + +echo "Create sym link for .htaccess" + +ln -sf ${OPENSHIFT_DATA_DIR}.htaccess ${OPENSHIFT_REPO_DIR}.htaccess + +echo ".htaccess symlink created" + +#### + -- cgit v1.2.3 From 365d690d7d32926b1fb4b1e4b7150dce70343f38 Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Tue, 1 Sep 2015 20:46:14 +0200 Subject: Fix filename --- .openshift/action_hooks/deploy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index fb3136f32..51e0f6d94 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -83,7 +83,7 @@ echo "Files sym links created" # Copy .htconfig.php from the repo, rename it and place it in the data directory. # if it's there already, skip it. -if [ ! -f ${OPENSHIFT_DATA_DIR}config.php ]; +if [ ! -f ${OPENSHIFT_DATA_DIR}.htconfig.php ]; then @@ -136,4 +136,3 @@ ln -sf ${OPENSHIFT_DATA_DIR}.htaccess ${OPENSHIFT_REPO_DIR}.htaccess echo ".htaccess symlink created" #### - -- cgit v1.2.3 From 1a05696a84808a7877fe52846110da77ef245c47 Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Fri, 4 Sep 2015 20:05:15 +0200 Subject: Updating OpenShift deploy script --- .openshift/action_hooks/deploy | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index 51e0f6d94..688871d72 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -136,3 +136,27 @@ ln -sf ${OPENSHIFT_DATA_DIR}.htaccess ${OPENSHIFT_REPO_DIR}.htaccess echo ".htaccess symlink created" #### + +echo "Check for the poller at .openshift/cron/minutely/poller , if not created - create it" + +if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller ]; then +printf '%s\n' '#!/bin/bash' 'if [ ! -f $OPENSHIFT_DATA_DIR/last_run ]; then' ' touch $OPENSHIFT_DATA_DIR/last_run' 'fi' 'if [[ $(find $OPENSHIFT_DATA_DIR/last_run -mmin +4) ]]; then #run every 5 mins' ' rm -f $OPENSHIFT_DATA_DIR/last_run' ' touch $OPENSHIFT_DATA_DIR/last_run' ' # The command(s) that you want to run every 5 minutes' 'cd /var/lib/openshift/${OPENSHIFT_APP_UUID}/app-root/repo; /opt/rh/php54/root/usr/bin/php include/poller.php' 'fi' >${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller +echo "Done creating file .openshift/cron/minutely/poller" + +else + +echo "The poller already exists" + +fi + +#### + +# Set permissions on the poller script to make it executable. + +echo "Now chmod 777 -R poller" + +chmod -R 777 ${OPENSHIFT_REPO}.openshift/cron/minutely/poller + +echo "chmod done, permissions set to 777 on poller script." + +#### -- cgit v1.2.3 From 438cb1d7e0f1518dd35a3a377dfd9a9fd885f80c Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Fri, 18 Sep 2015 18:51:03 +0200 Subject: Added hot_deploy to deploy script --- .openshift/action_hooks/deploy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index 688871d72..d6ba6940d 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -160,3 +160,19 @@ chmod -R 777 ${OPENSHIFT_REPO}.openshift/cron/minutely/poller echo "chmod done, permissions set to 777 on poller script." #### + +echo "Check for the hot deploy marker at .openshift/markers/hot_deploy , if not created - create it" + +if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy ]; then + +touch ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy + +echo "Done creating file .openshift/cron/minutely/poller" + +else + +echo "The hot deploy marker already exists" + +fi + +#### -- cgit v1.2.3 From 525a0478b00cbfde53fa8d7a91c04c92cb85e8b5 Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Fri, 18 Sep 2015 18:55:56 +0200 Subject: Added hot_deploy to deploy script - fixed echo --- .openshift/action_hooks/deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index d6ba6940d..29b3ab9c7 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -167,7 +167,7 @@ if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy ]; then touch ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy -echo "Done creating file .openshift/cron/minutely/poller" +echo "Done creating file .openshift/markers/hot_deploy" else -- cgit v1.2.3 From 68ea1d02897cde5d9588c12489b4c8a1508c522d Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Thu, 1 Oct 2015 21:59:12 +0200 Subject: Changed deploy script - removed hot_deploy and changed poller to every 10 minutes rather than 5 minutes. --- .openshift/action_hooks/deploy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index 29b3ab9c7..7b746ece1 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -140,7 +140,7 @@ echo ".htaccess symlink created" echo "Check for the poller at .openshift/cron/minutely/poller , if not created - create it" if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller ]; then -printf '%s\n' '#!/bin/bash' 'if [ ! -f $OPENSHIFT_DATA_DIR/last_run ]; then' ' touch $OPENSHIFT_DATA_DIR/last_run' 'fi' 'if [[ $(find $OPENSHIFT_DATA_DIR/last_run -mmin +4) ]]; then #run every 5 mins' ' rm -f $OPENSHIFT_DATA_DIR/last_run' ' touch $OPENSHIFT_DATA_DIR/last_run' ' # The command(s) that you want to run every 5 minutes' 'cd /var/lib/openshift/${OPENSHIFT_APP_UUID}/app-root/repo; /opt/rh/php54/root/usr/bin/php include/poller.php' 'fi' >${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller +printf '%s\n' '#!/bin/bash' 'if [ ! -f $OPENSHIFT_DATA_DIR/last_run ]; then' ' touch $OPENSHIFT_DATA_DIR/last_run' 'fi' 'if [[ $(find $OPENSHIFT_DATA_DIR/last_run -mmin +9) ]]; then #run every 10 mins' ' rm -f $OPENSHIFT_DATA_DIR/last_run' ' touch $OPENSHIFT_DATA_DIR/last_run' ' # The command(s) that you want to run every 5 minutes' 'cd /var/lib/openshift/${OPENSHIFT_APP_UUID}/app-root/repo; /opt/rh/php54/root/usr/bin/php include/poller.php' 'fi' >${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller echo "Done creating file .openshift/cron/minutely/poller" else @@ -161,17 +161,17 @@ echo "chmod done, permissions set to 777 on poller script." #### -echo "Check for the hot deploy marker at .openshift/markers/hot_deploy , if not created - create it" +### echo "Check for the hot deploy marker at .openshift/markers/hot_deploy , if not created - create it" -if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy ]; then +### if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy ]; then -touch ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy +### touch ${OPENSHIFT_REPO_DIR}.openshift/markers/hot_deploy -echo "Done creating file .openshift/markers/hot_deploy" +### echo "Done creating file .openshift/markers/hot_deploy" -else +### else -echo "The hot deploy marker already exists" +### echo "The hot deploy marker already exists" fi -- cgit v1.2.3 From f64acadd58d4aab4a93a1f128f8d4e702869016a Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Thu, 1 Oct 2015 22:03:12 +0200 Subject: Small fix to deploy --- .openshift/action_hooks/deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index 7b746ece1..f97772902 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -173,6 +173,6 @@ echo "chmod done, permissions set to 777 on poller script." ### echo "The hot deploy marker already exists" -fi +### fi #### -- cgit v1.2.3 From f23f8f7f5df4f0a7b03c688a911bfdadbff0951b Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Thu, 1 Oct 2015 22:08:38 +0200 Subject: Small fix to deploy --- .openshift/action_hooks/deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.openshift/action_hooks') diff --git a/.openshift/action_hooks/deploy b/.openshift/action_hooks/deploy index f97772902..1256cc0c1 100755 --- a/.openshift/action_hooks/deploy +++ b/.openshift/action_hooks/deploy @@ -140,7 +140,7 @@ echo ".htaccess symlink created" echo "Check for the poller at .openshift/cron/minutely/poller , if not created - create it" if [ ! -f ${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller ]; then -printf '%s\n' '#!/bin/bash' 'if [ ! -f $OPENSHIFT_DATA_DIR/last_run ]; then' ' touch $OPENSHIFT_DATA_DIR/last_run' 'fi' 'if [[ $(find $OPENSHIFT_DATA_DIR/last_run -mmin +9) ]]; then #run every 10 mins' ' rm -f $OPENSHIFT_DATA_DIR/last_run' ' touch $OPENSHIFT_DATA_DIR/last_run' ' # The command(s) that you want to run every 5 minutes' 'cd /var/lib/openshift/${OPENSHIFT_APP_UUID}/app-root/repo; /opt/rh/php54/root/usr/bin/php include/poller.php' 'fi' >${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller +printf '%s\n' '#!/bin/bash' 'if [ ! -f $OPENSHIFT_DATA_DIR/last_run ]; then' ' touch $OPENSHIFT_DATA_DIR/last_run' 'fi' 'if [[ $(find $OPENSHIFT_DATA_DIR/last_run -mmin +9) ]]; then #run every 10 mins' ' rm -f $OPENSHIFT_DATA_DIR/last_run' ' touch $OPENSHIFT_DATA_DIR/last_run' ' # The command(s) that you want to run every 10 minutes' 'cd /var/lib/openshift/${OPENSHIFT_APP_UUID}/app-root/repo; /opt/rh/php54/root/usr/bin/php include/poller.php' 'fi' >${OPENSHIFT_REPO_DIR}.openshift/cron/minutely/poller echo "Done creating file .openshift/cron/minutely/poller" else -- cgit v1.2.3