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 THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
10 export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \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 "$THISDIR/shared_site_mgr.sh"
58 check_apps_root "$app_dirname"
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"
67 exit_on_error "finding and testing app folder"
69 #echo "!! domain being added is: $DOMAIN_NAME"
71 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_domain.sh" "$DOMAIN_NAME"
72 exit_on_error "Setting up domain: $DOMAIN_NAME"
76 # add the main website as specified by the domain name they gave us.
77 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$DOMAIN_NAME"
78 exit_on_error "Setting up apache site for: $APPLICATION_NAME"
80 # make the shadow site also, which always ends in cakelampvm.com.
81 shadow_domain="${APPLICATION_NAME}.cakelampvm.com"
82 if [ "$shadow_domain" != "$DOMAIN_NAME" ]; then
83 sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$shadow_domain"
84 exit_on_error "Setting up shadow apache site on '$shadow_domain'"
89 # run this prior to the checkout to fix perms.
90 fix_appdir_ownership "$BASE_APPLICATION_PATH" "$APPLICATION_NAME"
94 #echo about to do powerup with: app="$APPLICATION_NAME" repo="$REPO_NAME" theme="$THEME_NAME"
95 #echo default repo is "$DEFAULT_REPOSITORY_ROOT"
97 powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
102 Finished standing up the full domain and site for: ${app_dirname}
103 The domain name is: $DOMAIN_NAME