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 # force the sudo at the start of the script, rather than waiting halfway
51 # through to ask for access.
52 sudo bash -c 'echo sudo permissions acquired.'
54 source "$WORKDIR/shared_site_mgr.sh"
58 check_application_dir "$BASE_APPLICATION_PATH"
60 # find proper webroot where the site will be initialized.
61 if [ -z "$app_dirname" ]; then
62 # no dir was passed, so guess it.
63 find_app_folder "$BASE_APPLICATION_PATH"
65 test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
68 #echo "!! domain being added is: $DOMAIN_NAME"
70 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_domain.sh" "$DOMAIN_NAME"
71 test_or_die "Setting up domain: $DOMAIN_NAME"
75 # add the main website as specified by the domain name they gave us.
76 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$DOMAIN_NAME"
77 test_or_die "Setting up apache site for: $APPLICATION_NAME"
79 # make the shadow site also, which always ends in cakelampvm.com.
80 shadow_domain="${APPLICATION_NAME}.cakelampvm.com"
81 if [ "$shadow_domain" != "$DOMAIN_NAME" ]; then
82 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$shadow_domain"
83 test_or_die "Setting up shadow apache site on '$shadow_domain'"
88 #echo about to do powerup with: app="$APPLICATION_NAME" repo="$REPO_NAME" theme="$THEME_NAME"
89 #echo default repo is "$DEFAULT_REPOSITORY_ROOT"
91 powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
95 # hmmm: pass the real user name who should own the files?
96 # hmmm: "$(logname)" $USER works, but logname wasn't?
97 fix_ownership "$BASE_APPLICATION_PATH" "$APPLICATION_NAME"
102 Finished standing up the full domain and site for: ${app_dirname}
103 The domain name is: $DOMAIN_NAME