powerup does not try to do any chmods now.
i have seen a failure of powerup due to chmods composer tries to do during the install step; this can be fixed by running standup again. subsequent powerups should work fine.
added a switchto function to jump to an application directory. e.g. switchto ecocor6 will jump into the apps/ecocor6/avenger5 directory.
stopped adding the swap disk automatically in revamp. having a ram disk on an SSD based machine can use up the lifespan too quickly, so it was though better to not add it unless explicitly asked.
if the variable ADD_SWAP is set (to anything), then the swap drive will be added. otherwise it will not be. usage could be like:
export ADD_SWAP=true ; revamp_cakelampvm
added "map archive = no" to global section in samba config to stop archive bit mapping feature from hosing executable bits.
locked the revamp command to only operate on a host that contains "cakelampvm" to avoid scorching other hosts.
Remember this and practice Dharma from your heart.
-- Longchenpa, from "Finding Rest in the Nature of the Mind", published
by Shambhala Publications
+~
+ The most important thing is to have faith and trust in the Buddha’s
+words. The Buddha’s teachings were not taught to deceive us but to explain
+the way things actually are. Many people try to analyze the Buddha’s
+teachings, but how is it possible to scrutinize a buddha’s qualities? We
+don’t even know what will happen tomorrow, or when we will die, or anything
+about our future lives, so how could we possibly examine the teachings of the
+Omniscient One? Since we are totally obscured by our strong disturbing
+emotions, in order to progress on the path toward enlightenment, we have no
+choice but to have faith in the Buddha’s teachings and apply them in our own
+lives.
+ The ability to practice Dharma depends on certain conditions. For
+example, this is a rare time during which the teachings of the Great
+Perfection are said to flourish. We’re very fortunate that through
+Padmasambhava’s blessings, such teachings have appeared and we’re able to
+receive them. We must have accumulated incredible merit and made fervent
+prayers very sincerely over numerous lifetimes to be able to encounter such
+amazing teachings now. Still, most people are just too involved in worldly
+activities to have time to practice the Dharma, and very few people in this
+world totally dedicate themselves to the teachings. Most people work for the
+sake of success in this life, to gain wealth, fame, power, and so on, but none
+of these worldly aims can liberate us from the suffering of samsara; in fact,
+they only create further conditions for ensuring that we remain in samsara for
+countless lifetimes to come.
+ -- Penor Rinpoche, from "An Ocean of Blessings: Heart Teachings of Drubwang
+ Penor Rinpoche", translated by Ani Jinba Palmo, published by Shambhala
+ Publications
+~
+ "When the sun comes out and illumines the world, its image is reflected in
+all clean vessels of water, being in all places without coming or going. If
+one vessel breaks, then the reflection of the sun does not appear in it. Do
+you think it is the fault of the sun that its reflection does not appear
+there?"
+ "No--it is just because the vessel is broken; it’s no fault of the sun."
+ "The knowledge of realization of Thusness, buddha-knowledge, is also like
+this, appearing throughout the cosmos, without before or after: Buddha appears
+in the clean mind-vessels of all sentient beings. If the mind-vessel is
+always clean, the embodiment of Buddha is always seen; if the mind is
+polluted, the vessel breaks and the Buddha cannot be seen."
+ -- from "The Flower Ornament Scripture: A Translation of The Avatamsaka
+ Sutra", translated by Thomas Cleary, published by Shambhala Publications
+~
+Why is endeavor necessary? If we consider material progress, we see that
+research started by one person can always be continued by another. But this
+is not possible with spiritual progress. The realization we talk about in the
+Buddhadharma is something that has to be accomplished by the individual. No
+one else can do it for us. Of course, it would be wonderful if in the future
+we could attain realization through some sort of new injection or by means of
+a new generation of computers, without having to go through any difficulties.
+If we could be absolutely certain that such a time would come, we could simply
+lie back and wait to get enlightened. But I doubt that this will ever happen.
+It is better to make an effort. We have to develop endeavor.
+
+ 1.
+ Thus with patience I will strive with diligence.
+ For in such diligence enlightenment is found.
+ If no wind blows, then nothing stirs,
+ And neither is there merit without diligence.
+
+ -- H.H. the Fourteenth Dalai Lama, from "The Bodhisattva Guide: A Commentary
+ on The Way of the Bodhisattva", The Bodhisattva Guide was originally
+ published as For the Benefit of All Beings, also published by Shambhala
+ Publications
# specifies the version of the code that is being constructed here.
major=2
minor=140
-revision=109
+revision=110
build=420
# specifies the remainder of the version record info.
define_yeti_alias remove_apache_site="sudo bash \$FEISTY_MEOW_SCRIPTS/system/remove_apache_site.sh"
define_yeti_alias add_swap_mount="sudo bash \$FEISTY_MEOW_SCRIPTS/system/add_swap_mount.sh"
-#hmmm: some magma intrusions from the fred customizations...
+# some site avenger sudoized aliases.
define_yeti_alias revamp_cakelampvm="sudo bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/revamp_cakelampvm.sh\""
##############
##############
+ # site avenger aliases
+ function switchto()
+ {
+ WORKDIR="$FEISTY_MEOW_SCRIPTS/site_avenger"
+ source "$FEISTY_MEOW_SCRIPTS/site_avenger/shared_site_mgr.sh"
+ switch_to "$1"
+ }
+
+ ##############
+
# NOTE: no more function definitions are allowed after this point.
function function_sentinel()
--- /dev/null
+#!/bin/bash
+
+# windows compatible process killer for any stray processes started as
+#"fallout" something.
+
+source $FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh
+
+procid="$( psa fallout | tail -n 1 | awk '{ print $1; }' )"
+
+if [ ! -z "$procid" ]; then
+ taskkill.exe /f /pid ${procid}
+fi
sep
-check_application_dir "$BASE_APPLICATION_PATH"
+check_apps_root "$BASE_APPLICATION_PATH"
# find proper webroot where the site will be initialized.
if [ -z "$app_dirname" ]; then
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
+test_or_die "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
--- /dev/null
+#!/bin/bash
+
+# override for ecocor6 to set the theme.
+
+export THEME_NAME="Ecocor"
+echo "*** overrode THEME_NAME as: $THEME_NAME"
+
+
# Author: Kevin Wentworth
# Author: Chris Koeritz
-# This script "powers up" a cakephp site by running the database migrations,
-# cleaning out the ORM cache, and fixing file permissions.
+# This script "powers up" a cakephp site by checking out the code from the
+# git repository and installing the composer dependencies.
# This script is currently highly specific to site avenger.
# General Info:
# A git repository is expected to be provided, and we will get all the code
# for the web site from there. The repository is expected to have a single
# application "name" and one or more "themes". By convention, the name
-# and the theme are often the same.
+# and the theme are often the same, except the theme is capitalized.
# For example, let's say our app name is "turtle" and our theme name is "box".
# The repo is checked out to a folder called "~/apps/turtle".
# This script will want to use "turtle" as the app name.
sep
-check_application_dir "$BASE_APPLICATION_PATH"
+check_apps_root "$BASE_APPLICATION_PATH"
# find proper webroot where the site will be initialized.
if [ -z "$app_dirname" ]; then
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
+test_or_die "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
# use our default values for the repository and theme if they're not provided.
if [ -z "$repo_name" ]; then
- repo_name="$app_dirname"
+ repo_name="$REPO_NAME"
+ if [ -z "$repo_name" ]; then
+ repo_name="$app_dirname"
+ fi
fi
if [ -z "$theme_name" ]; then
- theme_name="$(capitalize_first_char ${app_dirname})"
+ theme_name="$THEME_NAME"
+ if [ -z "$theme_name" ]; then
+ theme_name="$(capitalize_first_char ${app_dirname})"
+ fi
fi
echo "Repository: $repo_name"
exit 1
fi
+if [[ ! $(hostname) == *cakelampvm* ]]; then
+ echo "This script is only designed to be run on the cakelampvm host."
+ exit 1
+fi
+
##############
export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
test_or_die "chown apache2 and bind to developer"
group_perm /etc/apache2 /etc/bind
test_or_die "group perms on apache2 and bind"
+chown -R developer:developer /opt/feistymeow.org
+test_or_die "chown feisty meow to developer"
+group_perm /opt/feistymeow.org
+test_or_die "group perms on feisty meow"
##############
test_or_die "group perms on fred's apps"
harsh_perm /home/fred/.ssh
test_or_die "harsh_perm setting on fred .ssh"
-chown -R fred:fred /opt/feistymeow.org
-test_or_die "chown feisty meow to fred"
-group_perm /opt/feistymeow.org
-test_or_die "group perms on feisty meow"
group_perm /home/fred/apps/mapsdemo
test_or_die "group perms on mapsdemo app"
# install a better editor app.
-sep
+#sep
-echo "The script is about to install the bluefish editor and some dependencies.
-If the app is not already installed, then this process takes about one minute
-on a slow home DSL internet connection..."
+#echo "The script is about to install the bluefish editor and some dependencies.
+#If the app is not already installed, then this process takes about one minute
+#on a slow home DSL internet connection..."
-apt-get install -y bluefish &> "/tmp/install_bluefish-$(logname).log"
-test_or_continue "installing bluefish editor"
+#apt-get install -y bluefish &> "/tmp/install_bluefish-$(logname).log"
+#test_or_continue "installing bluefish editor"
##############
##############
-# fix samba configuration for (ass-headed) default of read-only in user homes.
+# fix samba configuration for screwy default of read-only in user homes.
# why cripple a necessary feature by default?
sep
pattern="[#;][[:blank:]]*read only = yes"
replacement="read only = no"
-# we just always do the replacement now, after realizing the sentinel pattern
-# was acutally already in the file... too much subtlety can get one into trouble.
+# we just always do the replacement now rather than making it conditional,
+# after realizing the sentinel pattern was actually already in the file...
+# too much subtlety can get one into trouble.
sed -i "0,/$pattern/{s/$pattern/$replacement/}" /etc/samba/smb.conf
test_or_die "patching samba configuration to enable write acccess on user home dirs"
+echo successfully patched the samba configuration to enable writes on user home directories.
+
+# add in a disabling of the archive bit mapping feature, which hoses up the execute bit
+# in an attempt to save the sad old DOS archive bit across the samba connection.
+grep -q "map archive" /etc/samba/smb.conf
+# if the phrase wasn't found, we need to add it.
+if [ $? -ne 0 ]; then
+ sed -i "s/\[global\]/\[global\]\n\nmap archive = no/" /etc/samba/smb.conf
+ test_or_die "patching samba configuration to turn off archive bit mapping feature"
+ echo Successfully fixed Samba to not use the archive bit mapping feature.
+fi
+
# sweet, looks like that worked...
restart_samba
-echo successfully patched the samba configuration to enable writes on user home directories.
##############
sep
-echo "Checking existing swap partition configuration.
+# we will only add swap now if explicitly asked for it. this is to avoid creating
+# a swap file where the vm is running on an SSD, since that can use up the SSD's lifespan
+# too quickly.
+if [ ! -z "$ADD_SWAP" ]; then
+ echo "Checking existing swap partition configuration.
"
-# check for existing swap.
-free | grep -q "Swap:[[:blank:]]*[1-9][0-9]"
-if [ $? -ne 0 ]; then
- # no swap in current session, so add it.
- echo "Enabling ramdisk swap partition...
+ # check for existing swap.
+ free | grep -q "Swap:[[:blank:]]*[1-9][0-9]"
+ if [ $? -ne 0 ]; then
+ # no swap in current session, so add it.
+ echo "Enabling ramdisk swap partition...
"
- add_swap_mount
- echo "
+ add_swap_mount
+ echo "
Enabled ramdisk swap partition for current boot session."
-fi
+ fi
-# the above just gives this session a swap partition, but we want to have
-# the vm boot with one also.
+ # the above just gives this session a swap partition, but we want to have
+ # the vm boot with one also.
-# check if there is already swap mentioned in the root crontab. we will get root's
-# crontab below since this script has to run as sudo.
-crontab -l | grep -iq add_swap_mount
-if [ $? -ne 0 ]; then
- # no existing swap setup in crontab, so add it.
- echo "
+ # check if there is already swap mentioned in the root crontab. we will get root's
+ # crontab below since this script has to run as sudo.
+ crontab -l | grep -iq add_swap_mount
+ if [ $? -ne 0 ]; then
+ # no existing swap setup in crontab, so add it.
+ echo "
Adding a boot-time ramdisk swap partition...
"
- # need to do it carefully, since sed won't add lines to a null file. we thus
- # create a temporary file to do our work in and ignore sed as a tool for this.
- tmpfile="$(mktemp junk.XXXXXX)"
- crontab -l 2>/dev/null >"$tmpfile"
- echo "
+ # need to do it carefully, since sed won't add lines to a null file. we thus
+ # create a temporary file to do our work in and ignore sed as a tool for this.
+ tmpfile="$(mktemp junk.XXXXXX)"
+ crontab -l 2>/dev/null >"$tmpfile"
+ echo "
# need to explicitly set any variables we will use.
FEISTY_MEOW_APEX=${FEISTY_MEOW_APEX}
# add swap space to increase memory available.
@reboot bash $FEISTY_MEOW_APEX/scripts/system/add_swap_mount.sh
" >>"$tmpfile"
- # now install our new version of the crontab.
- crontab "$tmpfile"
- rm "$tmpfile"
+ # now install our new version of the crontab.
+ crontab "$tmpfile"
+ rm "$tmpfile"
- echo "
+ echo "
Added boot-time ramdisk swap partition to crontab for root."
+ fi
fi
##############
echo Adding site avenger packages to composer.
# add in site avenger dependencies so we can build avcore properly.
-composer config -g repositories.siteavenger composer https://packages.siteavenger.com/
+pushd ~ &>/dev/null
+sudo -u $(logname) composer config -g repositories.siteavenger composer https://packages.siteavenger.com/
+popd &>/dev/null
+
+##############
+
+# make the apache umask set group permissions automatically, so we stop having weird
+# permission issues on temp dirs.
+
+sep
+
+grep -q "umask" /etc/apache2/envvars
+if [ $? -eq 0 ]; then
+ # already present.
+ echo the umask configuration for apache already appears to be set.
+else
+ echo "
+
+# set umask to enable group read/write on files and directories.
+umask 002
+
+" >> /etc/apache2/envvars
+ restart_apache
+ echo "successfully changed apache umask configuration to enable group read/write"
+fi
##############
##############
export NO_CHECKIN_VENDOR=true
# tests that the main storage folder for apps exists.
-function check_application_dir()
+function check_apps_root()
{
local appdir="$1"; shift
if [ ! -d "$appdir" ]; then
source "$SITE_MANAGEMENT_CONFIG_FILE"
test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
+ return 0
}
# this function will seek out top-level directories in the target directory passed in.
options=( $(find "$appsdir" -mindepth 1 -maxdepth 1 -type d -exec basename {} ';') "Quit")
select app_dirname in "${options[@]}"; do
case $app_dirname in
- "Quit") echo ; echo "Quitting from the script."; exit 1; ;;
+ "Quit") echo ; echo "Quitting from the script."; return 1; ;;
*) echo ; echo "You picked folder '$app_dirname'" ; break; ;;
esac
done
if [ -z "$app_dirname" ]; then
echo "The folder was not provided. This script needs a directory name"
echo "within which to initialize the site."
- exit 1
+ return 1
fi
PS3="$holdps3"
fi
test_or_die "Testing application folder: $app_dirname"
echo "Application folder is: $app_dirname"
+ return 0
}
-# ensures that the app directory name is valid.
+# ensures that the app directory name is valid and then loads the config
+# for the app (either via a specific file or using the defaults).
function test_app_folder()
{
local appsdir="$1"; shift
# eases some permissions to enable apache to write log files and do other shopkeeping.
function fix_site_perms()
{
- local site_dir="$1"; shift
+ local app_dir="$1"; shift
+
+ local site_dir="$app_dir/$CHECKOUT_DIR_NAME"
if [ -f "$site_dir/bin/cake" ]; then
- chmod -R a+rx "$site_dir/bin/cake"
+ sudo chmod -R a+rx "$site_dir/bin/cake"
test_or_die "Enabling execute bit on cake binary"
fi
if [ -d "$site_dir/logs" ]; then
- chmod -R g+w "$site_dir/logs"
+ sudo chmod -R g+w "$site_dir/logs"
test_or_die "Enabling group write on site's Logs directory"
fi
if [ -d "$site_dir/tmp" ]; then
- chmod -R g+w "$site_dir/tmp"
+ sudo chmod -R g+w "$site_dir/tmp"
test_or_die "Enabling group write on site's tmp directory"
fi
}
test_or_die "Git clone of repository: $repo_name"
fi
- fix_site_perms "$complete_path"
+#not doing this here since powerup uses this and has no sudo.
+ #fix_site_perms "$complete_path"
+#unused?
# construct the full path to where the app will actually live.
site_store_path="$complete_path"
# go with the default user running the script.
user_name="$USER"
if [ ! -z "$user_name" -a "$user_name" != "root" ]; then
- echo "Chowning the apps folder to be owned by: $user_name"
+ echo "Chowning the app folder to be owned by: $user_name"
#hmmm: have to hope for now for standard group named after user
- chown -R "$user_name:$user_name" "$combo"
+ sudo chown -R "$user_name:$user_name" "$combo"
test_or_die "Chowning $combo to be owned by $user_name"
else
echo "user name failed checks for chowning, was found as '$user_name'"
fi
+
+ #
+#probably not enough for path!
+ fix_site_perms "$combo"
}
+# Jumps to an application directory given the app name. If no app name is
+# given, it will show a menu to pick the app.
+function switch_to()
+{
+ # check for parameters.
+ app_dirname="$1"; shift
+
+ check_apps_root "$BASE_APPLICATION_PATH"
+
+ # find proper webroot where the site will be initialized.
+ if [ -z "$app_dirname" ]; then
+ # no dir was passed, so guess it.
+ find_app_folder "$BASE_APPLICATION_PATH"
+ else
+ test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
+ fi
+ if [ $? -ne 0 ]; then
+ echo "Could not locate that application directory"
+ return 1
+ fi
+
+ # where we expect to find our checkout folder underneath.
+ full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
+
+ cd $full_app_dir/$CHECKOUT_DIR_NAME
+ pwd
+}
sep
-check_application_dir "$BASE_APPLICATION_PATH"
+check_apps_root "$BASE_APPLICATION_PATH"
# find proper webroot where the site will be initialized.
if [ -z "$app_dirname" ]; then
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
+test_or_die "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
sep
-check_application_dir "$BASE_APPLICATION_PATH"
+check_apps_root "$BASE_APPLICATION_PATH"
# find proper webroot where the site will be initialized.
if [ -z "$app_dirname" ]; then
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
+test_or_die "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
sep
-check_application_dir "$BASE_APPLICATION_PATH"
+check_apps_root "$BASE_APPLICATION_PATH"
# find proper webroot where the site will be initialized.
if [ -z "$app_dirname" ]; then
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
+test_or_die "finding and testing app folder"
#echo "!! domain being added is: $DOMAIN_NAME"
sep
+# run this prior to the checkout to fix perms.
+fix_appdir_ownership "$BASE_APPLICATION_PATH" "$APPLICATION_NAME"
+
+sep
+
#echo about to do powerup with: app="$APPLICATION_NAME" repo="$REPO_NAME" theme="$THEME_NAME"
#echo default repo is "$DEFAULT_REPOSITORY_ROOT"
sep
-# hmmm: pass the real user name who should own the files?
-# hmmm: "$(logname)" $USER works, but logname wasn't?
-fix_appdir_ownership "$BASE_APPLICATION_PATH" "$APPLICATION_NAME"
-
-sep
-
echo "
Finished standing up the full domain and site for: ${app_dirname}
The domain name is: $DOMAIN_NAME
sep
-check_application_dir "$BASE_APPLICATION_PATH"
+check_apps_root "$BASE_APPLICATION_PATH"
# find proper webroot where the site will be initialized.
if [ -z "$app_dirname" ]; then
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
+test_or_die "finding and testing app folder"
sep
sudo apt-get update -y
test_or_die "problem while doing 'apt-get update'"
-# new magic to tell dpkg to go with existing config files. let's see if it works!
-sudo apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold"
+
+# newest magic to tell dpkg to go with existing config files and force non-interactive version.
+sudo bash -c "\
+ export DEBIAN_FRONTEND=noninteractive; \
+ apt-get dist-upgrade -y -o Dpkg::Options::=\"--force-confdef\" \
+ -o Dpkg::Options::=\"--force-confold\"; \
+"
test_or_die "problem while doing 'apt-get dist-upgrade'"