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.
11 ############################
13 function print_instructions()
16 echo "$(basename $0 .sh) {app name}"
19 app name: The app name parameter is mandatory. The configuration file for
20 this script will be derived from the app name (e.g. if the app name is MyApp,
21 then the config file will be 'MyApp.config'). The config files are by
22 convention stored in the 'config' directory. The configuration file can be
23 overridden by setting the SITE_MANAGEMENT_CONFIG_FILE environment variable."
27 ############################
29 # main body of script.
31 # check for parameters.
32 app_dirname="$1"; shift
34 if [ -z "$app_dirname" ]; then
38 source "$WORKDIR/shared_site_mgr.sh"
40 if [ "$app_dirname" == "-help" -o "$app_dirname" == "--help" ]; then
46 check_application_dir "$APPLICATION_DIR"
48 add_domain "$DOMAIN_NAME"
49 test_or_die "Setting up domain: $DOMAIN_NAME"
51 add_apache_site "$APPLICATION_NAME" "$DOMAIN_NAME"
52 test_or_die "Setting up apache site for: $APPLICATION_NAME"
54 powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
63 Finished standing up the full domain and site in:
66 #leave before old crud below
88 #below is probably not needed.
89 # find proper webroot where the site will be initialized.
90 if [ -z "$app_dirname" ]; then
91 # no dir was passed, so guess it.
92 find_app_folder "$APPLICATION_DIR"
94 test_app_folder "$APPLICATION_DIR" "$app_dirname"
97 # where we expect to find our checkout folder underneath.
98 full_app_dir="$APPLICATION_DIR/$app_dirname"
100 # use our default values for the repository and theme if they're not provided.
101 if [ -z "$repo_name" ]; then
102 repo_name="$app_dirname"
104 if [ -z "$theme_name" ]; then
105 theme_name="$(capitalize_first_char ${app_dirname})"
108 echo "Repository: $repo_name"
109 echo "Theme name: $theme_name"
112 # this should set the site_store_path variable if everything goes well.
113 update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
114 test_or_die "Updating the repository storage directory"
116 # update the site to load dependencies.
118 composer_repuff "$site_store_path"
119 test_or_die "Installing site dependencies with composer"
121 # set up the symbolic links needed to achieve siteliness.
124 create_site_links "$site_store_path" "$theme_name"
128 echo "Finished powering up the site in '${app_dirname}'."