3 # Author: Chris Koeritz
5 # This is the full orchestrator for bringing up a web site using our site
6 # management scripts. So far, the scripts rely on at least php. The support
7 # is much more powerful if the site is based on cakephp and site avenger.
9 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
10 export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
12 source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
14 ############################
16 function print_instructions()
19 echo "$(basename $0 .sh) {app name}"
22 $(basename $0 .sh) will completely set up a web site, including a domain
23 name and an apache configuration file. The site will be acquired from a
24 git repository and configured. At the end of this script, the result should
25 be an almost working website; you may need to fix the site configuration,
26 create databases and so forth.
28 This script must be run as sudo or root; it makes changes to system files.
29 app name: The app name parameter is mandatory. The configuration file for
30 this script will be derived from the app name (e.g. if the app name is MyApp,
31 then the config file will be 'MyApp.config'). The config files are by
32 convention stored in the 'config' directory. The configuration file can be
33 overridden by setting the SITE_MANAGEMENT_CONFIG_FILE environment variable."
37 ############################
39 # main body of script.
41 # check for parameters.
42 app_dirname="$1"; shift
44 if [ "$app_dirname" == "-help" -o "$app_dirname" == "--help" ]; then
46 elif [ -z "$app_dirname" ]; then
50 #we will require sudo later.
51 #if [[ $EUID != 0 ]]; then
52 # echo "This script must be run as root or sudo."
56 source "$WORKDIR/shared_site_mgr.sh"
60 check_application_dir "$APPLICATION_DIR"
62 # find proper webroot where the site will be initialized.
63 if [ -z "$app_dirname" ]; then
64 # no dir was passed, so guess it.
65 find_app_folder "$APPLICATION_DIR"
67 test_app_folder "$APPLICATION_DIR" "$app_dirname"
70 #echo "!! domain being added is: $DOMAIN_NAME"
72 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_domain.sh" "$DOMAIN_NAME"
73 test_or_die "Setting up domain: $DOMAIN_NAME"
77 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$DOMAIN_NAME"
78 test_or_die "Setting up apache site for: $APPLICATION_NAME"
82 #echo about to do powerup with: app="$APPLICATION_NAME" repo="$REPO_NAME" theme="$THEME_NAME"
83 #echo default repo is "$DEFAULT_REPOSITORY_ROOT"
85 powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
86 # pass the real user name who should own the files.
92 Finished standing up the full domain and site for: ${app_dirname}
93 The domain name is: $DOMAIN_NAME