Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 3 | # ``stack.sh`` is an opinionated OpenStack developer installation. It |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 4 | # installs and configures various combinations of **Ceilometer**, **Cinder**, |
| 5 | # **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Quantum** |
| 6 | # and **Swift** |
Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 7 | |
Vishvananda Ishaya | 9b35367 | 2011-10-20 10:07:10 -0700 | [diff] [blame] | 8 | # This script allows you to specify configuration options of what git |
Jesse Andrews | 5372f43 | 2011-10-03 01:08:24 -0400 | [diff] [blame] | 9 | # repositories to use, enabled services, network configuration and various |
| 10 | # passwords. If you are crafty you can run the script on multiple nodes using |
| 11 | # shared settings for common resources (mysql, rabbitmq) and build a multi-node |
| 12 | # developer install. |
Jesse Andrews | 782b991 | 2011-10-02 16:53:21 -0400 | [diff] [blame] | 13 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 14 | # To keep this script simple we assume you are running on a recent **Ubuntu** |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 15 | # (11.10 Oneiric or newer) or **Fedora** (F16 or newer) machine. It |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 16 | # should work in a VM or physical server. Additionally we put the list of |
| 17 | # ``apt`` and ``rpm`` dependencies and other configuration files in this repo. |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 18 | |
Jesse Andrews | 0e7e897 | 2011-10-02 16:36:54 -0400 | [diff] [blame] | 19 | # Learn more and get the most recent version at http://devstack.org |
Jesse Andrews | 6edd17f | 2011-09-15 22:19:42 -0700 | [diff] [blame] | 20 | |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 21 | # Keep track of the devstack directory |
Jesse Andrews | 51fb22e | 2011-10-19 09:24:17 -0700 | [diff] [blame] | 22 | TOP_DIR=$(cd $(dirname "$0") && pwd) |
| 23 | |
Dean Troyer | 6563a3c | 2012-01-31 12:11:56 -0600 | [diff] [blame] | 24 | # Import common functions |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 25 | source $TOP_DIR/functions |
Dean Troyer | 6563a3c | 2012-01-31 12:11:56 -0600 | [diff] [blame] | 26 | |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 27 | # Determine what system we are running on. This provides ``os_VENDOR``, |
| 28 | # ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` |
Dean Troyer | a9e0a48 | 2012-07-09 14:07:23 -0500 | [diff] [blame] | 29 | # and ``DISTRO`` |
| 30 | GetDistro |
Jesse Andrews | 6edd17f | 2011-09-15 22:19:42 -0700 | [diff] [blame] | 31 | |
Anthony Young | 6015c82 | 2011-10-12 07:17:11 +0000 | [diff] [blame] | 32 | |
Dean Troyer | 48352ee | 2012-12-12 12:50:38 -0600 | [diff] [blame] | 33 | # Global Settings |
| 34 | # =============== |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 35 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 36 | # ``stack.sh`` is customizable through setting environment variables. If you |
| 37 | # want to override a setting you can set and export it:: |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 38 | # |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 39 | # export DATABASE_PASSWORD=anothersecret |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 40 | # ./stack.sh |
| 41 | # |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 42 | # You can also pass options on a single line ``DATABASE_PASSWORD=simple ./stack.sh`` |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 43 | # |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 44 | # Additionally, you can put any local variables into a ``localrc`` file:: |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 45 | # |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 46 | # DATABASE_PASSWORD=anothersecret |
| 47 | # DATABASE_USER=hellaroot |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 48 | # |
| 49 | # We try to have sensible defaults, so you should be able to run ``./stack.sh`` |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 50 | # in most cases. ``localrc`` is not distributed with DevStack and will never |
| 51 | # be overwritten by a DevStack update. |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 52 | # |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 53 | # DevStack distributes ``stackrc`` which contains locations for the OpenStack |
| 54 | # repositories and branches to configure. ``stackrc`` sources ``localrc`` to |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 55 | # allow you to safely override those settings. |
| 56 | |
Dean Troyer | bbafb1b | 2012-06-11 16:51:39 -0500 | [diff] [blame] | 57 | if [[ ! -r $TOP_DIR/stackrc ]]; then |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 58 | log_error $LINENO "missing $TOP_DIR/stackrc - did you grab more than just stack.sh?" |
Dean Troyer | bbafb1b | 2012-06-11 16:51:39 -0500 | [diff] [blame] | 59 | fi |
| 60 | source $TOP_DIR/stackrc |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 61 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 62 | |
Dean Troyer | 48352ee | 2012-12-12 12:50:38 -0600 | [diff] [blame] | 63 | # Local Settings |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 64 | # -------------- |
| 65 | |
Dean Troyer | 48352ee | 2012-12-12 12:50:38 -0600 | [diff] [blame] | 66 | # Make sure the proxy config is visible to sub-processes |
| 67 | export_proxy_variables |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 68 | |
Jesse Andrews | 6edd17f | 2011-09-15 22:19:42 -0700 | [diff] [blame] | 69 | # Destination path for installation ``DEST`` |
Anthony Young | e8fed48 | 2011-09-26 19:50:43 -0700 | [diff] [blame] | 70 | DEST=${DEST:-/opt/stack} |
Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 71 | |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 72 | |
| 73 | # Sanity Check |
Dean Troyer | 48352ee | 2012-12-12 12:50:38 -0600 | [diff] [blame] | 74 | # ------------ |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 75 | |
Dean Troyer | 33cb430 | 2012-12-10 16:47:36 -0600 | [diff] [blame] | 76 | # Clean up last environment var cache |
| 77 | if [[ -r $TOP_DIR/.stackenv ]]; then |
| 78 | rm $TOP_DIR/.stackenv |
| 79 | fi |
| 80 | |
Akihiro MOTOKI | b0f1c38 | 2013-01-13 17:58:12 +0900 | [diff] [blame] | 81 | # Import common services (database, message queue) configuration |
Dean Troyer | c1b486a | 2012-11-05 14:26:09 -0600 | [diff] [blame] | 82 | source $TOP_DIR/lib/database |
Akihiro MOTOKI | b0f1c38 | 2013-01-13 17:58:12 +0900 | [diff] [blame] | 83 | source $TOP_DIR/lib/rpc_backend |
Dean Troyer | c1b486a | 2012-11-05 14:26:09 -0600 | [diff] [blame] | 84 | |
Doug Hellmann | f04178f | 2012-07-05 17:10:03 -0400 | [diff] [blame] | 85 | # Remove services which were negated in ENABLED_SERVICES |
Joe Gordon | 6fd2811 | 2012-11-13 16:55:41 -0800 | [diff] [blame] | 86 | # using the "-" prefix (e.g., "-rabbit") instead of |
Doug Hellmann | f04178f | 2012-07-05 17:10:03 -0400 | [diff] [blame] | 87 | # calling disable_service(). |
| 88 | disable_negated_services |
Chmouel Boudjnah | c4cd414 | 2012-06-27 11:01:40 +0200 | [diff] [blame] | 89 | |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 90 | # Warn users who aren't on an explicitly supported distro, but allow them to |
| 91 | # override check and attempt installation with ``FORCE=yes ./stack`` |
Vincent Untz | e7bca2f | 2012-12-20 15:09:20 +0100 | [diff] [blame] | 92 | if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|f16|f17|f18|opensuse-12.2) ]]; then |
Dean Troyer | 4a1f5a7 | 2012-06-21 09:57:43 -0500 | [diff] [blame] | 93 | echo "WARNING: this script has not been tested on $DISTRO" |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 94 | if [[ "$FORCE" != "yes" ]]; then |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 95 | die $LINENO "If you wish to run this script anyway run with FORCE=yes" |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 96 | fi |
| 97 | fi |
| 98 | |
Akihiro MOTOKI | b0f1c38 | 2013-01-13 17:58:12 +0900 | [diff] [blame] | 99 | # Make sure we only have one rpc backend enabled, |
| 100 | # and the specified rpc backend is available on your platform. |
| 101 | check_rpc_backend |
Russell Bryant | 4a22145 | 2012-03-13 13:44:12 -0400 | [diff] [blame] | 102 | |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 103 | # ``stack.sh`` keeps function libraries here |
| 104 | # Make sure ``$TOP_DIR/lib`` directory is present |
| 105 | if [ ! -d $TOP_DIR/lib ]; then |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 106 | log_error $LINENO "missing devstack/lib" |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 107 | fi |
| 108 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 109 | # ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config |
| 110 | # templates and other useful files in the ``files`` subdirectory |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 111 | FILES=$TOP_DIR/files |
| 112 | if [ ! -d $FILES ]; then |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 113 | log_error $LINENO "missing devstack/files" |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 114 | fi |
| 115 | |
Dean Troyer | 1573335 | 2012-09-06 11:51:30 -0500 | [diff] [blame] | 116 | SCREEN_NAME=${SCREEN_NAME:-stack} |
Dean Troyer | c6c1d43 | 2012-03-27 20:59:22 -0500 | [diff] [blame] | 117 | # Check to see if we are already running DevStack |
Dean Troyer | 1573335 | 2012-09-06 11:51:30 -0500 | [diff] [blame] | 118 | if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].$SCREEN_NAME"; then |
Anthony Young | 5545845 | 2011-12-17 00:21:49 +0000 | [diff] [blame] | 119 | echo "You are already running a stack.sh session." |
| 120 | echo "To rejoin this session type 'screen -x stack'." |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 121 | echo "To destroy this session, type './unstack.sh'." |
Anthony Young | 5545845 | 2011-12-17 00:21:49 +0000 | [diff] [blame] | 122 | exit 1 |
| 123 | fi |
Todd Willey | 0a16145 | 2011-10-28 02:34:19 -0400 | [diff] [blame] | 124 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 125 | # Set up logging level |
| 126 | VERBOSE=$(trueorfalse True $VERBOSE) |
| 127 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 128 | |
| 129 | # root Access |
| 130 | # ----------- |
| 131 | |
| 132 | # OpenStack is designed to be run as a non-root user; Horizon will fail to run |
| 133 | # as **root** since Apache will not serve content from **root** user). If |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 134 | # ``stack.sh`` is run as **root**, it automatically creates a **stack** user with |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 135 | # sudo privileges and runs as that user. |
| 136 | |
| 137 | if [[ $EUID -eq 0 ]]; then |
James E. Blair | 92e8199 | 2011-10-11 09:26:29 -0500 | [diff] [blame] | 138 | ROOTSLEEP=${ROOTSLEEP:-10} |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 139 | echo "You are running this script as root." |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 140 | echo "In $ROOTSLEEP seconds, we will create a user '$STACK_USER' and run as that user" |
James E. Blair | 92e8199 | 2011-10-11 09:26:29 -0500 | [diff] [blame] | 141 | sleep $ROOTSLEEP |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 142 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 143 | # Give the non-root user the ability to run as **root** via ``sudo`` |
Vincent Untz | 71ebc6f | 2012-06-12 13:45:15 +0200 | [diff] [blame] | 144 | is_package_installed sudo || install_package sudo |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 145 | if ! getent group $STACK_USER >/dev/null; then |
| 146 | echo "Creating a group called $STACK_USER" |
| 147 | groupadd $STACK_USER |
Vincent Untz | e29b94e | 2012-06-12 14:21:18 +0200 | [diff] [blame] | 148 | fi |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 149 | if ! getent passwd $STACK_USER >/dev/null; then |
| 150 | echo "Creating a user called $STACK_USER" |
| 151 | useradd -g $STACK_USER -s /bin/bash -d $DEST -m $STACK_USER |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 152 | fi |
| 153 | |
Joe Gordon | e5d9238 | 2012-09-13 17:19:03 -0700 | [diff] [blame] | 154 | echo "Giving stack user passwordless sudo privileges" |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 155 | # UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 156 | grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || |
| 157 | echo "#includedir /etc/sudoers.d" >> /etc/sudoers |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 158 | ( umask 226 && echo "$STACK_USER ALL=(ALL) NOPASSWD:ALL" \ |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 159 | > /etc/sudoers.d/50_stack_sh ) |
| 160 | |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 161 | echo "Copying files to $STACK_USER user" |
Sean Gallagher | 8f393df | 2012-12-03 00:17:38 -0800 | [diff] [blame] | 162 | STACK_DIR="$DEST/${TOP_DIR##*/}" |
| 163 | cp -r -f -T "$TOP_DIR" "$STACK_DIR" |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 164 | chown -R $STACK_USER "$STACK_DIR" |
| 165 | cd "$STACK_DIR" |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 166 | if [[ "$SHELL_AFTER_RUN" != "no" ]]; then |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 167 | exec sudo -u $STACK_USER bash -l -c "set -e; bash stack.sh; bash" |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 168 | else |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 169 | exec sudo -u $STACK_USER bash -l -c "set -e; source stack.sh" |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 170 | fi |
| 171 | exit 1 |
Jesse Andrews | 509992f | 2011-10-27 11:18:09 -0700 | [diff] [blame] | 172 | else |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 173 | # We're not **root**, make sure ``sudo`` is available |
Vincent Untz | 71ebc6f | 2012-06-12 13:45:15 +0200 | [diff] [blame] | 174 | is_package_installed sudo || die "Sudo is required. Re-run stack.sh as root ONE TIME ONLY to set up sudo." |
Dean Troyer | e0d677c | 2012-03-07 14:11:33 -0600 | [diff] [blame] | 175 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 176 | # UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one |
Jesse Andrews | 84a399b | 2011-10-27 11:20:38 -0700 | [diff] [blame] | 177 | sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || |
| 178 | echo "#includedir /etc/sudoers.d" | sudo tee -a /etc/sudoers |
Dean Troyer | e0d677c | 2012-03-07 14:11:33 -0600 | [diff] [blame] | 179 | |
| 180 | # Set up devstack sudoers |
Todd Willey | 0a16145 | 2011-10-28 02:34:19 -0400 | [diff] [blame] | 181 | TEMPFILE=`mktemp` |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 182 | echo "$STACK_USER ALL=(root) NOPASSWD:ALL" >$TEMPFILE |
Vincent Untz | f2a25b7 | 2012-06-13 17:45:43 +0200 | [diff] [blame] | 183 | # Some binaries might be under /sbin or /usr/sbin, so make sure sudo will |
| 184 | # see them by forcing PATH |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 185 | echo "Defaults:$STACK_USER secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin" >> $TEMPFILE |
Todd Willey | 0a16145 | 2011-10-28 02:34:19 -0400 | [diff] [blame] | 186 | chmod 0440 $TEMPFILE |
| 187 | sudo chown root:root $TEMPFILE |
Dean Troyer | e0d677c | 2012-03-07 14:11:33 -0600 | [diff] [blame] | 188 | sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh |
| 189 | |
Dean Troyer | e0d677c | 2012-03-07 14:11:33 -0600 | [diff] [blame] | 190 | # Remove old file |
| 191 | sudo rm -f /etc/sudoers.d/stack_sh_nova |
Dean Troyer | 9122e7b | 2011-10-17 14:07:11 -0500 | [diff] [blame] | 192 | fi |
| 193 | |
Dean Troyer | e26232b | 2012-06-27 17:55:15 -0500 | [diff] [blame] | 194 | # Create the destination directory and ensure it is writable by the user |
| 195 | sudo mkdir -p $DEST |
David Ripton | 1bb7587 | 2013-03-01 11:48:27 -0500 | [diff] [blame] | 196 | sudo chown -R $STACK_USER $DEST |
Dean Troyer | e26232b | 2012-06-27 17:55:15 -0500 | [diff] [blame] | 197 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 198 | # Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without |
| 199 | # Internet access. ``stack.sh`` must have been previously run with Internet |
| 200 | # access to install prerequisites and fetch repositories. |
Dean Troyer | 25dab66 | 2011-12-16 22:40:46 -0600 | [diff] [blame] | 201 | OFFLINE=`trueorfalse False $OFFLINE` |
| 202 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 203 | # Set ``ERROR_ON_CLONE`` to ``True`` to configure ``stack.sh`` to exit if |
| 204 | # the destination git repository does not exist during the ``git_clone`` |
| 205 | # operation. |
James E. Blair | 94cb960 | 2012-06-22 15:28:29 -0700 | [diff] [blame] | 206 | ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE` |
| 207 | |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 208 | # Destination path for service data |
| 209 | DATA_DIR=${DATA_DIR:-${DEST}/data} |
| 210 | sudo mkdir -p $DATA_DIR |
David Ripton | 1bb7587 | 2013-03-01 11:48:27 -0500 | [diff] [blame] | 211 | sudo chown -R $STACK_USER $DATA_DIR |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 212 | |
| 213 | |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 214 | # Common Configuration |
| 215 | # ==================== |
Jesse Andrews | 782b991 | 2011-10-02 16:53:21 -0400 | [diff] [blame] | 216 | |
Vishvananda Ishaya | c9ad14b | 2012-07-03 20:29:01 +0000 | [diff] [blame] | 217 | # Set fixed and floating range here so we can make sure not to use addresses |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 218 | # from either range when attempting to guess the IP to use for the host. |
| 219 | # Note that setting FIXED_RANGE may be necessary when running DevStack |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 220 | # in an OpenStack cloud that uses either of these address ranges internally. |
Vishvananda Ishaya | c9ad14b | 2012-07-03 20:29:01 +0000 | [diff] [blame] | 221 | FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28} |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 222 | FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24} |
| 223 | FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256} |
| 224 | NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} |
Vishvananda Ishaya | c9ad14b | 2012-07-03 20:29:01 +0000 | [diff] [blame] | 225 | |
Dean Troyer | c892bde | 2013-03-13 14:06:13 -0500 | [diff] [blame] | 226 | HOST_IP=$(get_default_host_ip $FIXED_RANGE $FLOATING_RANGE "$HOST_IP_IFACE" "$HOST_IP") |
| 227 | if [ "$HOST_IP" == "" ]; then |
| 228 | die $LINENO "Could not determine host ip address. Either localrc specified dhcp on ${HOST_IP_IFACE} or defaulted" |
Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 229 | fi |
| 230 | |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 231 | # Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints. |
| 232 | SERVICE_HOST=${SERVICE_HOST:-$HOST_IP} |
Dean Troyer | c83a7e1 | 2012-11-29 11:47:58 -0600 | [diff] [blame] | 233 | SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http} |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 234 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 235 | # Configure services to use syslog instead of writing to individual log files |
Dean Troyer | ff603ef | 2011-11-22 17:48:10 -0600 | [diff] [blame] | 236 | SYSLOG=`trueorfalse False $SYSLOG` |
| 237 | SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP} |
| 238 | SYSLOG_PORT=${SYSLOG_PORT:-516} |
| 239 | |
Nachi Ueno | e3aaa96 | 2013-02-20 11:38:47 -0800 | [diff] [blame] | 240 | # Enable sysstat logging |
| 241 | SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"} |
| 242 | SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"} |
| 243 | |
| 244 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 245 | # Use color for logging output (only available if syslog is not used) |
Vishvananda Ishaya | 6f13ba3 | 2012-06-01 23:17:38 +0000 | [diff] [blame] | 246 | LOG_COLOR=`trueorfalse True $LOG_COLOR` |
| 247 | |
Dean Troyer | 2bbcd68 | 2011-11-05 16:19:03 -0500 | [diff] [blame] | 248 | # Service startup timeout |
| 249 | SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60} |
| 250 | |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 251 | |
| 252 | # Configure Projects |
| 253 | # ================== |
| 254 | |
| 255 | # Get project function libraries |
Dean Troyer | c83a7e1 | 2012-11-29 11:47:58 -0600 | [diff] [blame] | 256 | source $TOP_DIR/lib/tls |
Sean Dague | b562e6a | 2012-11-19 16:00:01 -0500 | [diff] [blame] | 257 | source $TOP_DIR/lib/horizon |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 258 | source $TOP_DIR/lib/keystone |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 259 | source $TOP_DIR/lib/glance |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 260 | source $TOP_DIR/lib/nova |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 261 | source $TOP_DIR/lib/cinder |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 262 | source $TOP_DIR/lib/swift |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 263 | source $TOP_DIR/lib/ceilometer |
| 264 | source $TOP_DIR/lib/heat |
| 265 | source $TOP_DIR/lib/quantum |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 266 | source $TOP_DIR/lib/baremetal |
Brad Topol | f127e2f | 2013-01-22 10:17:50 -0600 | [diff] [blame] | 267 | source $TOP_DIR/lib/ldap |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 268 | |
| 269 | # Set the destination directories for OpenStack projects |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 270 | HORIZON_DIR=$DEST/horizon |
Dean Troyer | 9f61d29 | 2012-11-26 18:56:20 +0000 | [diff] [blame] | 271 | OPENSTACKCLIENT_DIR=$DEST/python-openstackclient |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 272 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 273 | |
| 274 | # Interactive Configuration |
| 275 | # ------------------------- |
| 276 | |
| 277 | # Do all interactive config up front before the logging spew begins |
James E. Blair | 213c416 | 2012-11-06 09:38:36 +0100 | [diff] [blame] | 278 | |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 279 | # Generic helper to configure passwords |
| 280 | function read_password { |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 281 | XTRACE=$(set +o | grep xtrace) |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 282 | set +o xtrace |
| 283 | var=$1; msg=$2 |
| 284 | pw=${!var} |
| 285 | |
Anthony Young | b4db225 | 2011-10-12 14:08:08 -0700 | [diff] [blame] | 286 | localrc=$TOP_DIR/localrc |
Anthony Young | 6015c82 | 2011-10-12 07:17:11 +0000 | [diff] [blame] | 287 | |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 288 | # If the password is not defined yet, proceed to prompt user for a password. |
| 289 | if [ ! $pw ]; then |
| 290 | # If there is no localrc file, create one |
Anthony Young | b4db225 | 2011-10-12 14:08:08 -0700 | [diff] [blame] | 291 | if [ ! -e $localrc ]; then |
| 292 | touch $localrc |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 293 | fi |
| 294 | |
Vishvananda Ishaya | 9b35367 | 2011-10-20 10:07:10 -0700 | [diff] [blame] | 295 | # Presumably if we got this far it can only be that our localrc is missing |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 296 | # the required password. Prompt user for a password and write to localrc. |
Anthony Young | b4db225 | 2011-10-12 14:08:08 -0700 | [diff] [blame] | 297 | echo '' |
| 298 | echo '################################################################################' |
| 299 | echo $msg |
| 300 | echo '################################################################################' |
Dean Troyer | 4e6a2b7 | 2011-12-29 17:27:45 -0600 | [diff] [blame] | 301 | echo "This value will be written to your localrc file so you don't have to enter it " |
| 302 | echo "again. Use only alphanumeric characters." |
Anthony Young | b4db225 | 2011-10-12 14:08:08 -0700 | [diff] [blame] | 303 | echo "If you leave this blank, a random default value will be used." |
Dean Troyer | 4e6a2b7 | 2011-12-29 17:27:45 -0600 | [diff] [blame] | 304 | pw=" " |
| 305 | while true; do |
| 306 | echo "Enter a password now:" |
| 307 | read -e $var |
| 308 | pw=${!var} |
| 309 | [[ "$pw" = "`echo $pw | tr -cd [:alnum:]`" ]] && break |
| 310 | echo "Invalid chars in password. Try again:" |
| 311 | done |
Anthony Young | b4db225 | 2011-10-12 14:08:08 -0700 | [diff] [blame] | 312 | if [ ! $pw ]; then |
| 313 | pw=`openssl rand -hex 10` |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 314 | fi |
Anthony Young | b4db225 | 2011-10-12 14:08:08 -0700 | [diff] [blame] | 315 | eval "$var=$pw" |
| 316 | echo "$var=$pw" >> $localrc |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 317 | fi |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 318 | $XTRACE |
Anthony Young | 7a549f4 | 2011-10-12 07:13:13 +0000 | [diff] [blame] | 319 | } |
| 320 | |
Dean Troyer | 13dc5cc | 2012-03-27 14:50:45 -0500 | [diff] [blame] | 321 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 322 | # Database Configuration |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 323 | |
Dean Troyer | afc29fe | 2013-02-07 15:56:24 -0600 | [diff] [blame] | 324 | # To select between database backends, add the following to ``localrc``: |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 325 | # |
Dean Troyer | afc29fe | 2013-02-07 15:56:24 -0600 | [diff] [blame] | 326 | # disable_service mysql |
| 327 | # enable_service postgresql |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 328 | # |
Dean Troyer | afc29fe | 2013-02-07 15:56:24 -0600 | [diff] [blame] | 329 | # The available database backends are listed in ``DATABASE_BACKENDS`` after |
| 330 | # ``lib/database`` is sourced. ``mysql`` is the default. |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 331 | |
| 332 | initialize_database_backends && echo "Using $DATABASE_TYPE database backend" || echo "No database enabled" |
| 333 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 334 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 335 | # Queue Configuration |
Jesse Andrews | 782b991 | 2011-10-02 16:53:21 -0400 | [diff] [blame] | 336 | |
Anthony Young | a841644 | 2011-09-13 20:07:44 -0700 | [diff] [blame] | 337 | # Rabbit connection info |
Russell Bryant | 4a22145 | 2012-03-13 13:44:12 -0400 | [diff] [blame] | 338 | if is_service_enabled rabbit; then |
| 339 | RABBIT_HOST=${RABBIT_HOST:-localhost} |
| 340 | read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT." |
| 341 | fi |
Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 342 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 343 | |
| 344 | # Keystone |
| 345 | |
| 346 | if is_service_enabled key; then |
| 347 | # The ``SERVICE_TOKEN`` is used to bootstrap the Keystone database. It is |
| 348 | # just a string and is not a 'real' Keystone token. |
| 349 | read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN." |
| 350 | # Services authenticate to Identity with servicename/``SERVICE_PASSWORD`` |
| 351 | read_password SERVICE_PASSWORD "ENTER A SERVICE_PASSWORD TO USE FOR THE SERVICE AUTHENTICATION." |
| 352 | # Horizon currently truncates usernames and passwords at 20 characters |
| 353 | read_password ADMIN_PASSWORD "ENTER A PASSWORD TO USE FOR HORIZON AND KEYSTONE (20 CHARS OR LESS)." |
| 354 | |
| 355 | # Keystone can now optionally install OpenLDAP by enabling the ``ldap`` |
| 356 | # service in ``localrc`` (e.g. ``enable_service ldap``). |
| 357 | # To clean out the Keystone contents in OpenLDAP set ``KEYSTONE_CLEAR_LDAP`` |
| 358 | # to ``yes`` (e.g. ``KEYSTONE_CLEAR_LDAP=yes``) in ``localrc``. To enable the |
| 359 | # Keystone Identity Driver (``keystone.identity.backends.ldap.Identity``) |
| 360 | # set ``KEYSTONE_IDENTITY_BACKEND`` to ``ldap`` (e.g. |
| 361 | # ``KEYSTONE_IDENTITY_BACKEND=ldap``) in ``localrc``. |
| 362 | |
| 363 | # only request ldap password if the service is enabled |
| 364 | if is_service_enabled ldap; then |
| 365 | read_password LDAP_PASSWORD "ENTER A PASSWORD TO USE FOR LDAP" |
Chmouel Boudjnah | 6ae9ea5 | 2012-07-05 06:50:51 +0000 | [diff] [blame] | 366 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 367 | fi |
| 368 | |
| 369 | |
| 370 | # Swift |
| 371 | |
| 372 | if is_service_enabled s-proxy; then |
Chmouel Boudjnah | 77b0e1d | 2012-02-29 16:55:43 +0000 | [diff] [blame] | 373 | # We only ask for Swift Hash if we have enabled swift service. |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 374 | # ``SWIFT_HASH`` is a random unique string for a swift cluster that |
Chmouel Boudjnah | b2857e4 | 2011-11-03 16:19:14 +0100 | [diff] [blame] | 375 | # can never change. |
| 376 | read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH." |
| 377 | fi |
Vishvananda Ishaya | 5f03932 | 2011-11-05 16:12:20 -0700 | [diff] [blame] | 378 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 379 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 380 | # Configure logging |
| 381 | # ----------------- |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 382 | |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 383 | # Draw a spinner so the user knows something is happening |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 384 | function spinner() { |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 385 | local delay=0.75 |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 386 | local spinstr='/-\|' |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 387 | printf "..." >&3 |
| 388 | while [ true ]; do |
| 389 | local temp=${spinstr#?} |
| 390 | printf "[%c]" "$spinstr" >&3 |
| 391 | local spinstr=$temp${spinstr%"$temp"} |
| 392 | sleep $delay |
| 393 | printf "\b\b\b" >&3 |
| 394 | done |
| 395 | } |
| 396 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 397 | # Echo text to the log file, summary log file and stdout |
| 398 | # echo_summary "something to say" |
| 399 | function echo_summary() { |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 400 | if [[ -t 3 && "$VERBOSE" != "True" ]]; then |
| 401 | kill >/dev/null 2>&1 $LAST_SPINNER_PID |
| 402 | if [ ! -z "$LAST_SPINNER_PID" ]; then |
| 403 | printf "\b\b\bdone\n" >&3 |
| 404 | fi |
Dean Troyer | afc29fe | 2013-02-07 15:56:24 -0600 | [diff] [blame] | 405 | echo -n -e $@ >&6 |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 406 | spinner & |
| 407 | LAST_SPINNER_PID=$! |
| 408 | else |
Dean Troyer | afc29fe | 2013-02-07 15:56:24 -0600 | [diff] [blame] | 409 | echo -e $@ >&6 |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 410 | fi |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | # Echo text only to stdout, no log files |
| 414 | # echo_nolog "something not for the logs" |
| 415 | function echo_nolog() { |
| 416 | echo $@ >&3 |
| 417 | } |
| 418 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 419 | # Set up logging for ``stack.sh`` |
| 420 | # Set ``LOGFILE`` to turn on logging |
| 421 | # Append '.xxxxxxxx' to the given name to maintain history |
| 422 | # where 'xxxxxxxx' is a representation of the date the file was created |
Dean Troyer | 33cb430 | 2012-12-10 16:47:36 -0600 | [diff] [blame] | 423 | TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"} |
Chmouel Boudjnah | d966ed2 | 2012-03-05 12:42:48 +0000 | [diff] [blame] | 424 | if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then |
| 425 | LOGDAYS=${LOGDAYS:-7} |
Chmouel Boudjnah | d966ed2 | 2012-03-05 12:42:48 +0000 | [diff] [blame] | 426 | CURRENT_LOG_TIME=$(date "+$TIMESTAMP_FORMAT") |
| 427 | fi |
| 428 | |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 429 | if [[ -n "$LOGFILE" ]]; then |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 430 | # First clean up old log files. Use the user-specified ``LOGFILE`` |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 431 | # as the template to search for, appending '.*' to match the date |
| 432 | # we added on earlier runs. |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 433 | LOGDIR=$(dirname "$LOGFILE") |
David Ripton | 406019a | 2013-03-06 09:58:39 -0500 | [diff] [blame] | 434 | LOGFILENAME=$(basename "$LOGFILE") |
Chmouel Boudjnah | fff6fec | 2012-03-09 15:37:56 +0000 | [diff] [blame] | 435 | mkdir -p $LOGDIR |
David Ripton | 406019a | 2013-03-06 09:58:39 -0500 | [diff] [blame] | 436 | find $LOGDIR -maxdepth 1 -name $LOGFILENAME.\* -mtime +$LOGDAYS -exec rm {} \; |
Chmouel Boudjnah | d966ed2 | 2012-03-05 12:42:48 +0000 | [diff] [blame] | 437 | LOGFILE=$LOGFILE.${CURRENT_LOG_TIME} |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 438 | SUMFILE=$LOGFILE.${CURRENT_LOG_TIME}.summary |
| 439 | |
| 440 | # Redirect output according to config |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 441 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 442 | # Copy stdout to fd 3 |
| 443 | exec 3>&1 |
| 444 | if [[ "$VERBOSE" == "True" ]]; then |
| 445 | # Redirect stdout/stderr to tee to write the log file |
Davanum Srinivas | e5eee58 | 2012-12-06 09:47:53 -0500 | [diff] [blame] | 446 | exec 1> >( awk ' |
| 447 | { |
| 448 | cmd ="date +\"%Y-%m-%d %H:%M:%S \"" |
| 449 | cmd | getline now |
| 450 | close("date +\"%Y-%m-%d %H:%M:%S \"") |
| 451 | sub(/^/, now) |
| 452 | print |
| 453 | fflush() |
| 454 | }' | tee "${LOGFILE}" ) 2>&1 |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 455 | # Set up a second fd for output |
| 456 | exec 6> >( tee "${SUMFILE}" ) |
| 457 | else |
| 458 | # Set fd 1 and 2 to primary logfile |
| 459 | exec 1> "${LOGFILE}" 2>&1 |
| 460 | # Set fd 6 to summary logfile and stdout |
| 461 | exec 6> >( tee "${SUMFILE}" /dev/fd/3 ) |
| 462 | fi |
| 463 | |
| 464 | echo_summary "stack.sh log $LOGFILE" |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 465 | # Specified logfile name always links to the most recent log |
David Ripton | 406019a | 2013-03-06 09:58:39 -0500 | [diff] [blame] | 466 | ln -sf $LOGFILE $LOGDIR/$LOGFILENAME |
| 467 | ln -sf $SUMFILE $LOGDIR/$LOGFILENAME.summary |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 468 | else |
| 469 | # Set up output redirection without log files |
| 470 | # Copy stdout to fd 3 |
| 471 | exec 3>&1 |
Eric Windisch | efdf3ff | 2012-09-24 12:47:44 -0400 | [diff] [blame] | 472 | if [[ "$VERBOSE" != "True" ]]; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 473 | # Throw away stdout and stderr |
| 474 | exec 1>/dev/null 2>&1 |
| 475 | fi |
| 476 | # Always send summary fd to original stdout |
| 477 | exec 6>&3 |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 478 | fi |
| 479 | |
Chmouel Boudjnah | d966ed2 | 2012-03-05 12:42:48 +0000 | [diff] [blame] | 480 | # Set up logging of screen windows |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 481 | # Set ``SCREEN_LOGDIR`` to turn on logging of screen windows to the |
| 482 | # directory specified in ``SCREEN_LOGDIR``, we will log to the the file |
| 483 | # ``screen-$SERVICE_NAME-$TIMESTAMP.log`` in that dir and have a link |
| 484 | # ``screen-$SERVICE_NAME.log`` to the latest log file. |
| 485 | # Logs are kept for as long specified in ``LOGDAYS``. |
Chmouel Boudjnah | d966ed2 | 2012-03-05 12:42:48 +0000 | [diff] [blame] | 486 | if [[ -n "$SCREEN_LOGDIR" ]]; then |
| 487 | |
| 488 | # We make sure the directory is created. |
| 489 | if [[ -d "$SCREEN_LOGDIR" ]]; then |
| 490 | # We cleanup the old logs |
| 491 | find $SCREEN_LOGDIR -maxdepth 1 -name screen-\*.log -mtime +$LOGDAYS -exec rm {} \; |
| 492 | else |
| 493 | mkdir -p $SCREEN_LOGDIR |
| 494 | fi |
| 495 | fi |
| 496 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 497 | |
| 498 | # Set Up Script Execution |
| 499 | # ----------------------- |
| 500 | |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 501 | # Kill background processes on exit |
| 502 | trap clean EXIT |
| 503 | clean() { |
| 504 | local r=$? |
| 505 | kill >/dev/null 2>&1 $(jobs -p) |
| 506 | exit $r |
| 507 | } |
| 508 | |
| 509 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 510 | # Exit on any errors so that errors don't compound |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 511 | trap failed ERR |
| 512 | failed() { |
| 513 | local r=$? |
Vishvananda Ishaya | 7879a3c | 2012-09-21 15:36:06 -0700 | [diff] [blame] | 514 | kill >/dev/null 2>&1 $(jobs -p) |
Scott Moser | f9da508 | 2011-10-07 21:28:00 -0400 | [diff] [blame] | 515 | set +o xtrace |
| 516 | [ -n "$LOGFILE" ] && echo "${0##*/} failed: full log in $LOGFILE" |
| 517 | exit $r |
| 518 | } |
| 519 | |
| 520 | # Print the commands being run so that we can see the command that triggers |
| 521 | # an error. It is also useful for following along as the install occurs. |
| 522 | set -o xtrace |
| 523 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 524 | |
Jesse Andrews | 30f68e9 | 2011-09-13 00:59:54 -0700 | [diff] [blame] | 525 | # Install Packages |
Jesse Andrews | d74257d | 2011-09-13 01:24:50 -0700 | [diff] [blame] | 526 | # ================ |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 527 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 528 | # OpenStack uses a fair number of other projects. |
Jesse Andrews | 30f68e9 | 2011-09-13 00:59:54 -0700 | [diff] [blame] | 529 | |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 530 | # Install package requirements |
Dean Troyer | 48352ee | 2012-12-12 12:50:38 -0600 | [diff] [blame] | 531 | # Source it so the entire environment is available |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 532 | echo_summary "Installing package prerequisites" |
Dean Troyer | 48352ee | 2012-12-12 12:50:38 -0600 | [diff] [blame] | 533 | source $TOP_DIR/tools/install_prereqs.sh |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 534 | |
Akihiro MOTOKI | b0f1c38 | 2013-01-13 17:58:12 +0900 | [diff] [blame] | 535 | install_rpc_backend |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 536 | |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 537 | if is_service_enabled $DATABASE_BACKENDS; then |
| 538 | install_database |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 539 | fi |
| 540 | |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 541 | if is_service_enabled q-agt; then |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 542 | install_quantum_agent_packages |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 543 | fi |
| 544 | |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 545 | TRACK_DEPENDS=${TRACK_DEPENDS:-False} |
| 546 | |
| 547 | # Install python packages into a virtualenv so that we can track them |
| 548 | if [[ $TRACK_DEPENDS = True ]] ; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 549 | echo_summary "Installing Python packages into a virtualenv $DEST/.venv" |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 550 | install_package python-virtualenv |
| 551 | |
| 552 | rm -rf $DEST/.venv |
| 553 | virtualenv --system-site-packages $DEST/.venv |
| 554 | source $DEST/.venv/bin/activate |
| 555 | $DEST/.venv/bin/pip freeze > $DEST/requires-pre-pip |
| 556 | fi |
| 557 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 558 | |
| 559 | # Check Out Source |
| 560 | # ---------------- |
| 561 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 562 | echo_summary "Installing OpenStack project source" |
| 563 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 564 | # Grab clients first |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 565 | install_keystoneclient |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 566 | install_glanceclient |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 567 | install_novaclient |
Dean Troyer | 9f61d29 | 2012-11-26 18:56:20 +0000 | [diff] [blame] | 568 | # Check out the client libs that are used most |
| 569 | git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH |
| 570 | |
Jesse Andrews | 38df122 | 2011-11-20 09:55:44 -0800 | [diff] [blame] | 571 | # glance, swift middleware and nova api needs keystone middleware |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 572 | if is_service_enabled key g-api n-api s-proxy; then |
Jesse Andrews | 38df122 | 2011-11-20 09:55:44 -0800 | [diff] [blame] | 573 | # unified auth system (manages accounts/tokens) |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 574 | install_keystone |
Jesse Andrews | 38df122 | 2011-11-20 09:55:44 -0800 | [diff] [blame] | 575 | fi |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 576 | |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 577 | if is_service_enabled s-proxy; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 578 | install_swiftclient |
| 579 | install_swift |
Chmouel Boudjnah | 6ae9ea5 | 2012-07-05 06:50:51 +0000 | [diff] [blame] | 580 | if is_service_enabled swift3; then |
| 581 | # swift3 middleware to provide S3 emulation to Swift |
| 582 | git_clone $SWIFT3_REPO $SWIFT3_DIR $SWIFT3_BRANCH |
| 583 | fi |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 584 | fi |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 585 | |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 586 | if is_service_enabled g-api n-api; then |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 587 | # image catalog service |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 588 | install_glance |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 589 | fi |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 590 | if is_service_enabled nova; then |
| 591 | # compute service |
| 592 | install_nova |
| 593 | fi |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 594 | if is_service_enabled n-novnc; then |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 595 | # a websockets/html5 or flash powered VNC console for vm instances |
| 596 | git_clone $NOVNC_REPO $NOVNC_DIR $NOVNC_BRANCH |
| 597 | fi |
Daniel P. Berrange | d10e12f | 2013-01-03 11:51:42 +0000 | [diff] [blame] | 598 | if is_service_enabled n-spice; then |
| 599 | # a websockets/html5 or flash powered SPICE console for vm instances |
| 600 | git_clone $SPICE_REPO $SPICE_DIR $SPICE_BRANCH |
| 601 | fi |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 602 | if is_service_enabled horizon; then |
Sean Dague | b562e6a | 2012-11-19 16:00:01 -0500 | [diff] [blame] | 603 | # dashboard |
| 604 | install_horizon |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 605 | fi |
Monty Taylor | 5440ac0 | 2012-03-23 11:32:29 -0700 | [diff] [blame] | 606 | if is_service_enabled quantum; then |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 607 | install_quantum |
| 608 | install_quantumclient |
| 609 | install_quantum_third_party |
Deepak Garg | 1e98bdc | 2012-02-22 12:15:26 +0530 | [diff] [blame] | 610 | fi |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 611 | if is_service_enabled heat; then |
| 612 | install_heat |
Steve Baker | 32761a4 | 2012-11-05 09:57:57 +1300 | [diff] [blame] | 613 | install_heatclient |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 614 | fi |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 615 | if is_service_enabled cinder; then |
| 616 | install_cinder |
| 617 | fi |
John H. Tran | 9336164 | 2012-07-26 11:22:05 -0700 | [diff] [blame] | 618 | if is_service_enabled ceilometer; then |
Yunhong, Jiang | e583d9b | 2013-01-09 09:33:07 +0800 | [diff] [blame] | 619 | install_ceilometerclient |
John H. Tran | 9336164 | 2012-07-26 11:22:05 -0700 | [diff] [blame] | 620 | install_ceilometer |
| 621 | fi |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 622 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 623 | |
Jesse Andrews | 30f68e9 | 2011-09-13 00:59:54 -0700 | [diff] [blame] | 624 | # Initialization |
Jesse Andrews | d74257d | 2011-09-13 01:24:50 -0700 | [diff] [blame] | 625 | # ============== |
Jesse Andrews | 30f68e9 | 2011-09-13 00:59:54 -0700 | [diff] [blame] | 626 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 627 | echo_summary "Configuring OpenStack projects" |
| 628 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 629 | # Set up our checkouts so they are installed in the python path |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 630 | configure_keystoneclient |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 631 | configure_novaclient |
Dean Troyer | 9f61d29 | 2012-11-26 18:56:20 +0000 | [diff] [blame] | 632 | setup_develop $OPENSTACKCLIENT_DIR |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 633 | |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 634 | if is_service_enabled key g-api n-api s-proxy; then |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 635 | configure_keystone |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 636 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 637 | |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 638 | if is_service_enabled s-proxy; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 639 | configure_swift |
| 640 | configure_swiftclient |
| 641 | if is_service_enabled swift3; then |
| 642 | setup_develop $SWIFT3_DIR |
| 643 | fi |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 644 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 645 | |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 646 | if is_service_enabled g-api n-api; then |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 647 | configure_glance |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 648 | fi |
Dean Troyer | a34961b | 2012-06-26 13:05:33 -0500 | [diff] [blame] | 649 | |
| 650 | # Do this _after_ glance is installed to override the old binary |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 651 | # TODO(dtroyer): figure out when this is no longer necessary |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 652 | configure_glanceclient |
Dean Troyer | a34961b | 2012-06-26 13:05:33 -0500 | [diff] [blame] | 653 | |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 654 | if is_service_enabled nova; then |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 655 | # First clean up old instances |
| 656 | cleanup_nova |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 657 | configure_nova |
| 658 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 659 | |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 660 | if is_service_enabled horizon; then |
Sean Dague | b562e6a | 2012-11-19 16:00:01 -0500 | [diff] [blame] | 661 | configure_horizon |
James E. Blair | e7ce24f | 2011-11-10 13:05:13 -0800 | [diff] [blame] | 662 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 663 | |
Anthony Young | 84a03e0 | 2012-03-15 11:27:13 -0700 | [diff] [blame] | 664 | if is_service_enabled quantum; then |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 665 | setup_quantumclient |
| 666 | setup_quantum |
Monty Taylor | 5440ac0 | 2012-03-23 11:32:29 -0700 | [diff] [blame] | 667 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 668 | |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 669 | if is_service_enabled heat; then |
| 670 | configure_heat |
Steve Baker | 32761a4 | 2012-11-05 09:57:57 +1300 | [diff] [blame] | 671 | configure_heatclient |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 672 | fi |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 673 | |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 674 | if is_service_enabled cinder; then |
| 675 | configure_cinder |
| 676 | fi |
Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 677 | |
Monty Taylor | 47f0206 | 2012-07-26 11:09:24 -0500 | [diff] [blame] | 678 | if [[ $TRACK_DEPENDS = True ]] ; then |
| 679 | $DEST/.venv/bin/pip freeze > $DEST/requires-post-pip |
| 680 | if ! diff -Nru $DEST/requires-pre-pip $DEST/requires-post-pip > $DEST/requires.diff ; then |
| 681 | cat $DEST/requires.diff |
| 682 | fi |
| 683 | echo "Ran stack.sh in depend tracking mode, bailing out now" |
| 684 | exit 0 |
| 685 | fi |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 686 | |
Dean Troyer | c83a7e1 | 2012-11-29 11:47:58 -0600 | [diff] [blame] | 687 | if is_service_enabled tls-proxy; then |
| 688 | configure_CA |
| 689 | init_CA |
Dean Troyer | ca80217 | 2013-01-09 19:08:02 -0600 | [diff] [blame] | 690 | init_cert |
Dean Troyer | c83a7e1 | 2012-11-29 11:47:58 -0600 | [diff] [blame] | 691 | # Add name to /etc/hosts |
| 692 | # don't be naive and add to existing line! |
| 693 | fi |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 694 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 695 | |
Dean Troyer | ff603ef | 2011-11-22 17:48:10 -0600 | [diff] [blame] | 696 | # Syslog |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 697 | # ------ |
Dean Troyer | ff603ef | 2011-11-22 17:48:10 -0600 | [diff] [blame] | 698 | |
| 699 | if [[ $SYSLOG != "False" ]]; then |
Dean Troyer | ff603ef | 2011-11-22 17:48:10 -0600 | [diff] [blame] | 700 | if [[ "$SYSLOG_HOST" = "$HOST_IP" ]]; then |
| 701 | # Configure the master host to receive |
| 702 | cat <<EOF >/tmp/90-stack-m.conf |
| 703 | \$ModLoad imrelp |
| 704 | \$InputRELPServerRun $SYSLOG_PORT |
| 705 | EOF |
| 706 | sudo mv /tmp/90-stack-m.conf /etc/rsyslog.d |
| 707 | else |
| 708 | # Set rsyslog to send to remote host |
| 709 | cat <<EOF >/tmp/90-stack-s.conf |
| 710 | *.* :omrelp:$SYSLOG_HOST:$SYSLOG_PORT |
| 711 | EOF |
| 712 | sudo mv /tmp/90-stack-s.conf /etc/rsyslog.d |
| 713 | fi |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 714 | echo_summary "Starting rsyslog" |
Dean Troyer | 13dc5cc | 2012-03-27 14:50:45 -0500 | [diff] [blame] | 715 | restart_service rsyslog |
Dean Troyer | ff603ef | 2011-11-22 17:48:10 -0600 | [diff] [blame] | 716 | fi |
| 717 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 718 | |
Joe Gordon | e5d9238 | 2012-09-13 17:19:03 -0700 | [diff] [blame] | 719 | # Finalize queue installation |
| 720 | # ---------------------------- |
Akihiro MOTOKI | b0f1c38 | 2013-01-13 17:58:12 +0900 | [diff] [blame] | 721 | restart_rpc_backend |
Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 722 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 723 | |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 724 | # Configure database |
| 725 | # ------------------ |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 726 | |
Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 727 | if is_service_enabled $DATABASE_BACKENDS; then |
| 728 | configure_database |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 729 | fi |
| 730 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 731 | |
| 732 | # Configure screen |
| 733 | # ---------------- |
| 734 | |
Dean Troyer | 681f3fd | 2013-02-27 19:00:39 -0600 | [diff] [blame] | 735 | USE_SCREEN=$(trueorfalse True $USE_SCREEN) |
| 736 | if [[ "$USE_SCREEN" == "True" ]]; then |
| 737 | # Create a new named screen to run processes in |
| 738 | screen -d -m -S $SCREEN_NAME -t shell -s /bin/bash |
| 739 | sleep 1 |
| 740 | |
| 741 | # Set a reasonable status bar |
| 742 | if [ -z "$SCREEN_HARDSTATUS" ]; then |
| 743 | SCREEN_HARDSTATUS='%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})' |
| 744 | fi |
| 745 | screen -r $SCREEN_NAME -X hardstatus alwayslastline "$SCREEN_HARDSTATUS" |
Josh Kearney | 0a7a41e | 2012-04-04 17:47:56 -0500 | [diff] [blame] | 746 | fi |
| 747 | |
Jiajun Liu | 61bb2c1 | 2012-10-19 09:48:30 +0800 | [diff] [blame] | 748 | # Clear screen rc file |
| 749 | SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc |
| 750 | if [[ -e $SCREENRC ]]; then |
| 751 | echo -n > $SCREENRC |
| 752 | fi |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 753 | |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 754 | |
jiajun xu | a941424 | 2012-12-06 16:30:57 +0800 | [diff] [blame] | 755 | # Initialize the directory for service status check |
| 756 | init_service_check |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 757 | |
Sean Dague | 921f2da | 2013-02-26 10:35:59 -0500 | [diff] [blame] | 758 | # Kick off Sysstat |
| 759 | # ------------------------ |
| 760 | # run sysstat if it is enabled, this has to be early as daemon |
| 761 | # startup is one of the things to track. |
| 762 | if is_service_enabled sysstat;then |
| 763 | if [[ -n ${SCREEN_LOGDIR} ]]; then |
| 764 | screen_it sysstat "sar -o $SCREEN_LOGDIR/$SYSSTAT_FILE $SYSSTAT_INTERVAL" |
| 765 | else |
| 766 | screen_it sysstat "sar $SYSSTAT_INTERVAL" |
| 767 | fi |
| 768 | fi |
| 769 | |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 770 | # Keystone |
| 771 | # -------- |
| 772 | |
| 773 | if is_service_enabled key; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 774 | echo_summary "Starting Keystone" |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 775 | init_keystone |
| 776 | start_keystone |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 777 | |
Dean Troyer | d835de8 | 2012-11-29 17:11:35 -0600 | [diff] [blame] | 778 | # Set up a temporary admin URI for Keystone |
Dean Troyer | c83a7e1 | 2012-11-29 11:47:58 -0600 | [diff] [blame] | 779 | SERVICE_ENDPOINT=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0 |
| 780 | |
| 781 | if is_service_enabled tls-proxy; then |
| 782 | export OS_CACERT=$INT_CA_DIR/ca-chain.pem |
| 783 | # Until the client support is fixed, just use the internal endpoint |
| 784 | SERVICE_ENDPOINT=http://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT_INT/v2.0 |
| 785 | fi |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 786 | |
Dean Troyer | d835de8 | 2012-11-29 17:11:35 -0600 | [diff] [blame] | 787 | # Do the keystone-specific bits from keystone_data.sh |
| 788 | export OS_SERVICE_TOKEN=$SERVICE_TOKEN |
| 789 | export OS_SERVICE_ENDPOINT=$SERVICE_ENDPOINT |
| 790 | create_keystone_accounts |
Dean Troyer | a0dce26 | 2012-12-11 16:52:37 -0600 | [diff] [blame] | 791 | create_nova_accounts |
Dean Troyer | 671c16e | 2012-12-13 16:22:38 -0600 | [diff] [blame] | 792 | create_cinder_accounts |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 793 | create_quantum_accounts |
Dean Troyer | d835de8 | 2012-11-29 17:11:35 -0600 | [diff] [blame] | 794 | |
| 795 | # ``keystone_data.sh`` creates services, admin and demo users, and roles. |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 796 | ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \ |
| 797 | SERVICE_TOKEN=$SERVICE_TOKEN SERVICE_ENDPOINT=$SERVICE_ENDPOINT SERVICE_HOST=$SERVICE_HOST \ |
| 798 | S3_SERVICE_PORT=$S3_SERVICE_PORT KEYSTONE_CATALOG_BACKEND=$KEYSTONE_CATALOG_BACKEND \ |
Angus Salkeld | e279021 | 2012-09-11 11:24:09 +1000 | [diff] [blame] | 799 | DEVSTACK_DIR=$TOP_DIR ENABLED_SERVICES=$ENABLED_SERVICES HEAT_API_CFN_PORT=$HEAT_API_CFN_PORT \ |
Steve Baker | bb421be | 2012-10-10 13:19:10 +1300 | [diff] [blame] | 800 | HEAT_API_PORT=$HEAT_API_PORT \ |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 801 | bash -x $FILES/keystone_data.sh |
| 802 | |
| 803 | # Set up auth creds now that keystone is bootstrapped |
| 804 | export OS_AUTH_URL=$SERVICE_ENDPOINT |
| 805 | export OS_TENANT_NAME=admin |
| 806 | export OS_USERNAME=admin |
| 807 | export OS_PASSWORD=$ADMIN_PASSWORD |
Dean Troyer | d835de8 | 2012-11-29 17:11:35 -0600 | [diff] [blame] | 808 | unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 809 | fi |
| 810 | |
| 811 | |
Tres Henry | ca85b79 | 2011-10-28 14:00:21 -0700 | [diff] [blame] | 812 | # Horizon |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 813 | # ------- |
Jesse Andrews | cbe98d5 | 2011-10-02 17:47:32 -0400 | [diff] [blame] | 814 | |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 815 | # Set up the django horizon application to serve via apache/wsgi |
Jesse Andrews | 75a3765 | 2011-09-12 17:09:08 -0700 | [diff] [blame] | 816 | |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 817 | if is_service_enabled horizon; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 818 | echo_summary "Configuring and starting Horizon" |
Sean Dague | b562e6a | 2012-11-19 16:00:01 -0500 | [diff] [blame] | 819 | init_horizon |
| 820 | start_horizon |
Anthony Young | 70dc5e0 | 2011-09-15 16:52:43 -0700 | [diff] [blame] | 821 | fi |
Jesse Andrews | 75a3765 | 2011-09-12 17:09:08 -0700 | [diff] [blame] | 822 | |
Anthony Young | 3859f73 | 2011-09-14 02:33:43 -0700 | [diff] [blame] | 823 | |
Jesse Andrews | d74257d | 2011-09-13 01:24:50 -0700 | [diff] [blame] | 824 | # Glance |
| 825 | # ------ |
| 826 | |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 827 | if is_service_enabled g-reg; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 828 | echo_summary "Configuring Glance" |
| 829 | |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 830 | init_glance |
Dean Troyer | 6577b46 | 2012-01-16 22:27:20 -0600 | [diff] [blame] | 831 | |
Chmouel Boudjnah | ee76d26 | 2012-05-09 17:19:09 +0100 | [diff] [blame] | 832 | # Store the images in swift if enabled. |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 833 | if is_service_enabled s-proxy; then |
Chmouel Boudjnah | ee76d26 | 2012-05-09 17:19:09 +0100 | [diff] [blame] | 834 | iniset $GLANCE_API_CONF DEFAULT default_store swift |
| 835 | iniset $GLANCE_API_CONF DEFAULT swift_store_auth_address $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/ |
| 836 | iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance |
| 837 | iniset $GLANCE_API_CONF DEFAULT swift_store_key $SERVICE_PASSWORD |
| 838 | iniset $GLANCE_API_CONF DEFAULT swift_store_create_container_on_put True |
| 839 | fi |
Anthony Young | 70dc5e0 | 2011-09-15 16:52:43 -0700 | [diff] [blame] | 840 | fi |
Jesse Andrews | 75a3765 | 2011-09-12 17:09:08 -0700 | [diff] [blame] | 841 | |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 842 | |
| 843 | # Quantum |
Anthony Young | 60df29a | 2012-03-28 09:40:17 -0700 | [diff] [blame] | 844 | # ------- |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 845 | |
Shweta P | 4dc53aa | 2012-04-04 16:17:40 -0400 | [diff] [blame] | 846 | if is_service_enabled quantum; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 847 | echo_summary "Configuring Quantum" |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 848 | |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 849 | configure_quantum |
| 850 | init_quantum |
Dan Wendlandt | 0007f3a | 2012-05-18 13:37:47 -0700 | [diff] [blame] | 851 | fi |
| 852 | |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 853 | # Some Quantum plugins require network controllers which are not |
| 854 | # a part of the OpenStack project. Configure and start them. |
Gary Kotton | 396a014 | 2012-07-29 04:28:47 -0400 | [diff] [blame] | 855 | if is_service_enabled quantum; then |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 856 | configure_quantum_third_party |
| 857 | init_quantum_third_party |
| 858 | start_quantum_third_party |
Gary Kotton | 396a014 | 2012-07-29 04:28:47 -0400 | [diff] [blame] | 859 | fi |
| 860 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 861 | |
Jesse Andrews | d74257d | 2011-09-13 01:24:50 -0700 | [diff] [blame] | 862 | # Nova |
| 863 | # ---- |
Dean Troyer | bd13b70 | 2012-02-13 11:22:36 -0600 | [diff] [blame] | 864 | |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 865 | if is_service_enabled nova; then |
| 866 | echo_summary "Configuring Nova" |
| 867 | configure_nova |
Jesse Andrews | dfcd200 | 2011-09-13 13:17:22 -0700 | [diff] [blame] | 868 | fi |
| 869 | |
Isaku Yamahata | 6f85ab3 | 2012-08-06 16:56:10 +0900 | [diff] [blame] | 870 | if is_service_enabled n-net q-dhcp; then |
Anthony Young | 5545845 | 2011-12-17 00:21:49 +0000 | [diff] [blame] | 871 | # Delete traces of nova networks from prior runs |
Davanum Srinivas | d71d6e7 | 2013-01-28 19:15:57 -0500 | [diff] [blame] | 872 | # Do not kill any dnsmasq instance spawned by NetworkManager |
| 873 | netman_pid=$(pidof NetworkManager || true) |
| 874 | if [ -z "$netman_pid" ]; then |
| 875 | sudo killall dnsmasq || true |
| 876 | else |
| 877 | sudo ps h -o pid,ppid -C dnsmasq | grep -v $netman_pid | awk '{print $1}' | sudo xargs kill || true |
| 878 | fi |
| 879 | |
Anthony Young | 5545845 | 2011-12-17 00:21:49 +0000 | [diff] [blame] | 880 | clean_iptables |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 881 | rm -rf ${NOVA_STATE_PATH}/networks |
| 882 | sudo mkdir -p ${NOVA_STATE_PATH}/networks |
| 883 | sudo chown -R ${USER} ${NOVA_STATE_PATH}/networks |
Dean Troyer | 0b31e86 | 2012-03-07 16:47:56 -0600 | [diff] [blame] | 884 | # Force IP forwarding on, just on case |
| 885 | sudo sysctl -w net.ipv4.ip_forward=1 |
Anthony Young | 70dc5e0 | 2011-09-15 16:52:43 -0700 | [diff] [blame] | 886 | fi |
Jesse Andrews | 75a3765 | 2011-09-12 17:09:08 -0700 | [diff] [blame] | 887 | |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 888 | |
Chmouel Boudjnah | 28fa4e8 | 2011-11-01 12:30:55 +0100 | [diff] [blame] | 889 | # Storage Service |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 890 | # --------------- |
| 891 | |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 892 | if is_service_enabled s-proxy; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 893 | echo_summary "Configuring Swift" |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 894 | init_swift |
Chmouel Boudjnah | 28fa4e8 | 2011-11-01 12:30:55 +0100 | [diff] [blame] | 895 | fi |
| 896 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 897 | |
Anthony Young | acff87a | 2011-10-20 10:12:58 -0700 | [diff] [blame] | 898 | # Volume Service |
| 899 | # -------------- |
| 900 | |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 901 | if is_service_enabled cinder; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 902 | echo_summary "Configuring Cinder" |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 903 | init_cinder |
Anthony Young | acff87a | 2011-10-20 10:12:58 -0700 | [diff] [blame] | 904 | fi |
| 905 | |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 906 | if is_service_enabled nova; then |
| 907 | echo_summary "Configuring Nova" |
Dean Troyer | da7b809 | 2012-10-08 18:12:14 -0500 | [diff] [blame] | 908 | # Rebuild the config file from scratch |
| 909 | create_nova_conf |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 910 | init_nova |
Jesse Andrews | d1879c5 | 2011-09-16 16:28:13 -0700 | [diff] [blame] | 911 | |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 912 | # Additional Nova configuration that is dependent on other services |
| 913 | if is_service_enabled quantum; then |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 914 | create_nova_conf_quantum |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 915 | elif is_service_enabled n-net; then |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 916 | create_nova_conf_nova_network |
Brad Hall | 1bfa3d5 | 2011-10-27 18:18:20 -0700 | [diff] [blame] | 917 | fi |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 918 | |
Dean Troyer | b9182d6 | 2012-11-07 12:31:34 -0600 | [diff] [blame] | 919 | |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 920 | # XenServer |
| 921 | # --------- |
Anthony Young | b62b4ca | 2011-10-26 22:29:08 -0700 | [diff] [blame] | 922 | |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 923 | if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
| 924 | echo_summary "Using XenServer virtualization driver" |
| 925 | read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN." |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 926 | iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver" |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 927 | XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"} |
| 928 | XENAPI_USER=${XENAPI_USER:-"root"} |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 929 | iniset $NOVA_CONF DEFAULT xenapi_connection_url "$XENAPI_CONNECTION_URL" |
| 930 | iniset $NOVA_CONF DEFAULT xenapi_connection_username "$XENAPI_USER" |
| 931 | iniset $NOVA_CONF DEFAULT xenapi_connection_password "$XENAPI_PASSWORD" |
| 932 | iniset $NOVA_CONF DEFAULT flat_injected "False" |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 933 | # Need to avoid crash due to new firewall support |
| 934 | XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"} |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 935 | iniset $NOVA_CONF DEFAULT firewall_driver "$XEN_FIREWALL_DRIVER" |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 936 | |
| 937 | # OpenVZ |
| 938 | # ------ |
| 939 | |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 940 | elif [ "$VIRT_DRIVER" = 'openvz' ]; then |
| 941 | echo_summary "Using OpenVZ virtualization driver" |
Daniel Salinas | 2c63821 | 2013-02-26 11:01:05 -0500 | [diff] [blame] | 942 | iniset $NOVA_CONF DEFAULT compute_driver "openvz.OpenVzDriver" |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 943 | iniset $NOVA_CONF DEFAULT connection_type "openvz" |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 944 | LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"} |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 945 | iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER" |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 946 | |
| 947 | # Bare Metal |
| 948 | # ---------- |
| 949 | |
| 950 | elif [ "$VIRT_DRIVER" = 'baremetal' ]; then |
| 951 | echo_summary "Using BareMetal driver" |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 952 | LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"} |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 953 | iniset $NOVA_CONF DEFAULT compute_driver nova.virt.baremetal.driver.BareMetalDriver |
| 954 | iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER |
| 955 | iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.baremetal_host_manager.BaremetalHostManager |
Devananda van der Veen | 2920b7d | 2013-03-04 11:47:14 -0800 | [diff] [blame] | 956 | iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0 |
| 957 | iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0 |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 958 | iniset $NOVA_CONF baremetal instance_type_extra_specs cpu_arch:$BM_CPU_ARCH |
Devananda van der Veen | 86d8fbb | 2013-02-12 21:58:33 -0800 | [diff] [blame] | 959 | iniset $NOVA_CONF baremetal driver $BM_DRIVER |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 960 | iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER |
| 961 | iniset $NOVA_CONF baremetal tftp_root /tftpboot |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 962 | |
Devananda van der Veen | 1edba33 | 2013-01-09 15:29:03 -0800 | [diff] [blame] | 963 | # Define extra baremetal nova conf flags by defining the array ``EXTRA_BAREMETAL_OPTS``. |
| 964 | for I in "${EXTRA_BAREMETAL_OPTS[@]}"; do |
| 965 | # Attempt to convert flags to options |
Arata Notsu | 38ac402 | 2013-02-19 12:42:26 +0900 | [diff] [blame] | 966 | iniset $NOVA_CONF baremetal ${I/=/ } |
Devananda van der Veen | 1edba33 | 2013-01-09 15:29:03 -0800 | [diff] [blame] | 967 | done |
| 968 | |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 969 | # Default |
| 970 | # ------- |
| 971 | |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 972 | else |
| 973 | echo_summary "Using libvirt virtualization driver" |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 974 | iniset $NOVA_CONF DEFAULT compute_driver "libvirt.LibvirtDriver" |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 975 | LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"} |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 976 | iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER" |
Dean Troyer | 86a7969 | 2012-10-22 15:24:46 -0500 | [diff] [blame] | 977 | fi |
Anthony Young | b62b4ca | 2011-10-26 22:29:08 -0700 | [diff] [blame] | 978 | fi |
| 979 | |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 980 | # Extra things to prepare nova for baremetal, before nova starts |
| 981 | if is_service_enabled nova && is_baremetal; then |
| 982 | echo_summary "Preparing for nova baremetal" |
| 983 | prepare_baremetal_toolchain |
| 984 | configure_baremetal_nova_dirs |
Devananda van der Veen | 7611c89 | 2012-11-23 10:54:54 -0800 | [diff] [blame] | 985 | if [[ "$BM_USE_FAKE_ENV" = "True" ]]; then |
| 986 | create_fake_baremetal_env |
| 987 | fi |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 988 | fi |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 989 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 990 | |
Jesse Andrews | d74257d | 2011-09-13 01:24:50 -0700 | [diff] [blame] | 991 | # Launch Services |
| 992 | # =============== |
Jesse Andrews | 30f68e9 | 2011-09-13 00:59:54 -0700 | [diff] [blame] | 993 | |
Jesse Andrews | dfcd200 | 2011-09-13 13:17:22 -0700 | [diff] [blame] | 994 | # Only run the services specified in ``ENABLED_SERVICES`` |
| 995 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 996 | # Launch Swift Services |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 997 | if is_service_enabled s-proxy; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 998 | echo_summary "Starting Swift" |
| 999 | start_swift |
| 1000 | fi |
| 1001 | |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 1002 | # Launch the Glance services |
| 1003 | if is_service_enabled g-api g-reg; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1004 | echo_summary "Starting Glance" |
Dean Troyer | 73f6f25 | 2012-09-17 11:22:21 -0500 | [diff] [blame] | 1005 | start_glance |
Anthony Young | d000b22 | 2011-09-19 14:46:53 -0700 | [diff] [blame] | 1006 | fi |
| 1007 | |
Dean Troyer | d81a027 | 2012-08-31 18:04:55 -0500 | [diff] [blame] | 1008 | # Create an access key and secret key for nova ec2 register image |
| 1009 | if is_service_enabled key && is_service_enabled swift3 && is_service_enabled nova; then |
| 1010 | NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1) |
| 1011 | NOVA_TENANT_ID=$(keystone tenant-list | grep " $SERVICE_TENANT_NAME " | get_field 1) |
| 1012 | CREDS=$(keystone ec2-credentials-create --user_id $NOVA_USER_ID --tenant_id $NOVA_TENANT_ID) |
| 1013 | ACCESS_KEY=$(echo "$CREDS" | awk '/ access / { print $4 }') |
| 1014 | SECRET_KEY=$(echo "$CREDS" | awk '/ secret / { print $4 }') |
Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 1015 | iniset $NOVA_CONF DEFAULT s3_access_key "$ACCESS_KEY" |
| 1016 | iniset $NOVA_CONF DEFAULT s3_secret_key "$SECRET_KEY" |
| 1017 | iniset $NOVA_CONF DEFAULT s3_affix_tenant "True" |
Anthony Young | d000b22 | 2011-09-19 14:46:53 -0700 | [diff] [blame] | 1018 | fi |
| 1019 | |
Monty Taylor | 99fcd81 | 2012-12-02 13:07:39 -0800 | [diff] [blame] | 1020 | screen_it zeromq "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-rpc-zmq-receiver" |
ewindisch | 3bae7c2 | 2012-01-18 11:18:35 -0500 | [diff] [blame] | 1021 | |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 1022 | # Launch the nova-api and wait for it to answer before continuing |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 1023 | if is_service_enabled n-api; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1024 | echo_summary "Starting Nova API" |
Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 1025 | start_nova_api |
Anthony Young | d000b22 | 2011-09-19 14:46:53 -0700 | [diff] [blame] | 1026 | fi |
Brad Hall | 1bfa3d5 | 2011-10-27 18:18:20 -0700 | [diff] [blame] | 1027 | |
Gary Kotton | 37dda8d | 2012-08-08 03:46:33 -0400 | [diff] [blame] | 1028 | if is_service_enabled q-svc; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1029 | echo_summary "Starting Quantum" |
Salvatore Orlando | d6767d0 | 2012-08-31 04:55:20 -0700 | [diff] [blame] | 1030 | |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 1031 | start_quantum_service_and_check |
| 1032 | create_quantum_initial_network |
| 1033 | setup_quantum_debug |
Aaron Rosen | 8ec719b | 2012-10-30 12:57:47 -0700 | [diff] [blame] | 1034 | elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then |
Gary Kotton | 37dda8d | 2012-08-08 03:46:33 -0400 | [diff] [blame] | 1035 | # Create a small network |
Nachi Ueno | fda946e | 2012-10-24 17:26:02 -0700 | [diff] [blame] | 1036 | $NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS |
Dean Troyer | 696ad33 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 1037 | |
Gary Kotton | 37dda8d | 2012-08-08 03:46:33 -0400 | [diff] [blame] | 1038 | # Create some floating ips |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 1039 | $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK_NAME |
Aaron Rosen | 9313dfa | 2012-07-06 16:08:49 -0400 | [diff] [blame] | 1040 | |
Gary Kotton | 37dda8d | 2012-08-08 03:46:33 -0400 | [diff] [blame] | 1041 | # Create a second pool |
Monty Taylor | 9fbeedd | 2012-08-17 12:52:27 -0400 | [diff] [blame] | 1042 | $NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL |
Brad Hall | 1bfa3d5 | 2011-10-27 18:18:20 -0700 | [diff] [blame] | 1043 | fi |
| 1044 | |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 1045 | if is_service_enabled quantum; then |
| 1046 | start_quantum_agents |
| 1047 | fi |
Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 1048 | if is_service_enabled nova; then |
| 1049 | echo_summary "Starting Nova" |
| 1050 | start_nova |
| 1051 | fi |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 1052 | if is_service_enabled cinder; then |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1053 | echo_summary "Starting Cinder" |
Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 1054 | start_cinder |
| 1055 | fi |
John H. Tran | 9336164 | 2012-07-26 11:22:05 -0700 | [diff] [blame] | 1056 | if is_service_enabled ceilometer; then |
Doug Hellmann | c5259b4 | 2012-09-22 10:52:31 -0400 | [diff] [blame] | 1057 | echo_summary "Configuring Ceilometer" |
John H. Tran | 9336164 | 2012-07-26 11:22:05 -0700 | [diff] [blame] | 1058 | configure_ceilometer |
Yunhong, Jiang | e583d9b | 2013-01-09 09:33:07 +0800 | [diff] [blame] | 1059 | configure_ceilometerclient |
Doug Hellmann | c5259b4 | 2012-09-22 10:52:31 -0400 | [diff] [blame] | 1060 | echo_summary "Starting Ceilometer" |
Lianhao Lu | 8c54849 | 2013-01-09 10:41:54 +0800 | [diff] [blame] | 1061 | init_ceilometer |
John H. Tran | 9336164 | 2012-07-26 11:22:05 -0700 | [diff] [blame] | 1062 | start_ceilometer |
| 1063 | fi |
Sean Dague | b562e6a | 2012-11-19 16:00:01 -0500 | [diff] [blame] | 1064 | |
Chmouel Boudjnah | 6ae9ea5 | 2012-07-05 06:50:51 +0000 | [diff] [blame] | 1065 | # Starting the nova-objectstore only if swift3 service is not enabled. |
Chmouel Boudjnah | e347b99 | 2012-03-16 17:38:49 +0000 | [diff] [blame] | 1066 | # Swift will act as s3 objectstore. |
Chmouel Boudjnah | 6ae9ea5 | 2012-07-05 06:50:51 +0000 | [diff] [blame] | 1067 | is_service_enabled swift3 || \ |
Monty Taylor | 9fbeedd | 2012-08-17 12:52:27 -0400 | [diff] [blame] | 1068 | screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore" |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1069 | |
Steve Baker | bad9d89 | 2012-10-25 14:49:47 +1300 | [diff] [blame] | 1070 | |
| 1071 | # Configure and launch heat engine, api and metadata |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 1072 | if is_service_enabled heat; then |
Steve Baker | bad9d89 | 2012-10-25 14:49:47 +1300 | [diff] [blame] | 1073 | # Initialize heat, including replacing nova flavors |
| 1074 | echo_summary "Configuring Heat" |
| 1075 | init_heat |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1076 | echo_summary "Starting Heat" |
Steve Baker | bfdad75 | 2012-08-18 09:00:42 +1200 | [diff] [blame] | 1077 | start_heat |
| 1078 | fi |
Dean Troyer | 7d28a0e | 2012-06-27 17:55:52 -0500 | [diff] [blame] | 1079 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 1080 | |
Attila Fazekas | 22ef573 | 2012-12-16 14:03:06 +0100 | [diff] [blame] | 1081 | # Create account rc files |
| 1082 | # ======================= |
| 1083 | |
| 1084 | # Creates source able script files for easier user switching. |
| 1085 | # This step also creates certificates for tenants and users, |
| 1086 | # which is helpful in image bundle steps. |
| 1087 | |
| 1088 | if is_service_enabled nova && is_service_enabled key; then |
| 1089 | $TOP_DIR/tools/create_userrc.sh -PA --target-dir $TOP_DIR/accrc |
| 1090 | fi |
| 1091 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 1092 | |
Jesse Andrews | d74257d | 2011-09-13 01:24:50 -0700 | [diff] [blame] | 1093 | # Install Images |
| 1094 | # ============== |
Jesse Andrews | e49b8bd | 2011-09-12 18:08:04 -0700 | [diff] [blame] | 1095 | |
Anthony Young | 0ab1d46 | 2011-10-13 23:03:23 -0700 | [diff] [blame] | 1096 | # Upload an image to glance. |
Jesse Andrews | 5372f43 | 2011-10-03 01:08:24 -0400 | [diff] [blame] | 1097 | # |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 1098 | # The default image is cirros, a small testing image which lets you login as **root** |
Scott Moser | cde655a | 2013-02-20 12:33:39 -0500 | [diff] [blame] | 1099 | # cirros has a ``cloud-init`` analog supporting login via keypair and sending |
| 1100 | # scripts as userdata. |
| 1101 | # See https://help.ubuntu.com/community/CloudInit for more on cloud-init |
Anthony Young | 0ab1d46 | 2011-10-13 23:03:23 -0700 | [diff] [blame] | 1102 | # |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 1103 | # Override ``IMAGE_URLS`` with a comma-separated list of UEC images. |
Jesse Andrews | aab7eae | 2011-10-19 10:30:19 -0700 | [diff] [blame] | 1104 | # * **oneiric**: http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz |
Dean Troyer | ca0e3d0 | 2012-04-13 15:58:37 -0500 | [diff] [blame] | 1105 | # * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz |
Jesse Andrews | 08e8b74 | 2011-10-02 23:42:56 -0400 | [diff] [blame] | 1106 | |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 1107 | if is_service_enabled g-reg; then |
Dean Troyer | bc071bc | 2012-10-01 14:06:44 -0500 | [diff] [blame] | 1108 | TOKEN=$(keystone token-get | grep ' id ' | get_field 2) |
termie | 747ee33 | 2012-01-11 22:31:59 +0000 | [diff] [blame] | 1109 | |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 1110 | if is_baremetal; then |
| 1111 | echo_summary "Creating and uploading baremetal images" |
Anthony Young | b62b4ca | 2011-10-26 22:29:08 -0700 | [diff] [blame] | 1112 | |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 1113 | # build and upload separate deploy kernel & ramdisk |
| 1114 | upload_baremetal_deploy $TOKEN |
| 1115 | |
| 1116 | # upload images, separating out the kernel & ramdisk for PXE boot |
| 1117 | for image_url in ${IMAGE_URLS//,/ }; do |
| 1118 | upload_baremetal_image $image_url $TOKEN |
| 1119 | done |
| 1120 | else |
| 1121 | echo_summary "Uploading images" |
| 1122 | |
| 1123 | # Option to upload legacy ami-tty, which works with xenserver |
| 1124 | if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then |
| 1125 | IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz" |
| 1126 | fi |
| 1127 | |
| 1128 | for image_url in ${IMAGE_URLS//,/ }; do |
| 1129 | upload_image $image_url $TOKEN |
| 1130 | done |
| 1131 | fi |
Jesse Andrews | e49b8bd | 2011-09-12 18:08:04 -0700 | [diff] [blame] | 1132 | fi |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 1133 | |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 1134 | # If we are running nova with baremetal driver, there are a few |
| 1135 | # last-mile configuration bits to attend to, which must happen |
| 1136 | # after n-api and n-sch have started. |
| 1137 | # Also, creating the baremetal flavor must happen after images |
| 1138 | # are loaded into glance, though just knowing the IDs is sufficient here |
| 1139 | if is_service_enabled nova && is_baremetal; then |
| 1140 | # create special flavor for baremetal if we know what images to associate |
| 1141 | [[ -n "$BM_DEPLOY_KERNEL_ID" ]] && [[ -n "$BM_DEPLOY_RAMDISK_ID" ]] && \ |
| 1142 | create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID |
| 1143 | |
| 1144 | # otherwise user can manually add it later by calling nova-baremetal-manage |
| 1145 | # otherwise user can manually add it later by calling nova-baremetal-manage |
| 1146 | [[ -n "$BM_FIRST_MAC" ]] && add_baremetal_node |
| 1147 | |
| 1148 | # NOTE: we do this here to ensure that our copy of dnsmasq is running |
| 1149 | sudo pkill dnsmasq || true |
| 1150 | sudo dnsmasq --conf-file= --port=0 --enable-tftp --tftp-root=/tftpboot \ |
| 1151 | --dhcp-boot=pxelinux.0 --bind-interfaces --pid-file=/var/run/dnsmasq.pid \ |
Chris Krelle | 3533628 | 2013-02-03 15:48:43 -0800 | [diff] [blame] | 1152 | --interface=$BM_DNSMASQ_IFACE --dhcp-range=$BM_DNSMASQ_RANGE \ |
Arata Notsu | 5096ba7 | 2013-02-18 18:49:01 +0900 | [diff] [blame] | 1153 | ${BM_DNSMASQ_DNS:+--dhcp-option=option:dns-server,$BM_DNSMASQ_DNS} |
Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 1154 | # ensure callback daemon is running |
| 1155 | sudo pkill nova-baremetal-deploy-helper || true |
| 1156 | screen_it baremetal "nova-baremetal-deploy-helper" |
| 1157 | fi |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1158 | |
Nachi Ueno | e3aaa96 | 2013-02-20 11:38:47 -0800 | [diff] [blame] | 1159 | |
Dean Troyer | 33cb430 | 2012-12-10 16:47:36 -0600 | [diff] [blame] | 1160 | # Save some values we generated for later use |
| 1161 | CURRENT_RUN_TIME=$(date "+$TIMESTAMP_FORMAT") |
| 1162 | echo "# $CURRENT_RUN_TIME" >$TOP_DIR/.stackenv |
| 1163 | for i in BASE_SQL_CONN ENABLED_SERVICES HOST_IP LOGFILE \ |
Dean Troyer | 74759aa | 2013-01-24 14:19:55 -0600 | [diff] [blame] | 1164 | SERVICE_HOST SERVICE_PROTOCOL STACK_USER TLS_IP; do |
Dean Troyer | 33cb430 | 2012-12-10 16:47:36 -0600 | [diff] [blame] | 1165 | echo $i=${!i} >>$TOP_DIR/.stackenv |
| 1166 | done |
| 1167 | |
Maru Newby | ec08651 | 2012-11-01 23:44:57 +0000 | [diff] [blame] | 1168 | |
Dean Troyer | 768295e | 2013-01-09 13:42:03 -0600 | [diff] [blame] | 1169 | # Run extras |
| 1170 | # ========== |
| 1171 | |
| 1172 | if [[ -d $TOP_DIR/extras.d ]]; then |
| 1173 | for i in $TOP_DIR/extras.d/*.sh; do |
| 1174 | [[ -r $i ]] && source $i stack |
| 1175 | done |
| 1176 | fi |
| 1177 | |
| 1178 | |
Dean Troyer | f5633dd | 2012-03-28 11:21:40 -0500 | [diff] [blame] | 1179 | # Run local script |
| 1180 | # ================ |
| 1181 | |
| 1182 | # Run ``local.sh`` if it exists to perform user-managed tasks |
| 1183 | if [[ -x $TOP_DIR/local.sh ]]; then |
| 1184 | echo "Running user script $TOP_DIR/local.sh" |
| 1185 | $TOP_DIR/local.sh |
| 1186 | fi |
| 1187 | |
jiajun xu | a941424 | 2012-12-06 16:30:57 +0800 | [diff] [blame] | 1188 | # Check the status of running services |
| 1189 | service_check |
Dean Troyer | f5633dd | 2012-03-28 11:21:40 -0500 | [diff] [blame] | 1190 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame^] | 1191 | |
Scott Moser | b94f4bf | 2011-10-07 14:51:07 +0000 | [diff] [blame] | 1192 | # Fin |
| 1193 | # === |
| 1194 | |
Dean Troyer | 471de7a | 2011-12-27 11:45:55 -0600 | [diff] [blame] | 1195 | set +o xtrace |
Scott Moser | b94f4bf | 2011-10-07 14:51:07 +0000 | [diff] [blame] | 1196 | |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1197 | if [[ -n "$LOGFILE" ]]; then |
| 1198 | exec 1>&3 |
| 1199 | # Force all output to stdout and logs now |
Dean Troyer | baa8b42 | 2012-09-24 15:02:05 -0500 | [diff] [blame] | 1200 | exec 1> >( tee -a "${LOGFILE}" ) 2>&1 |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1201 | else |
| 1202 | # Force all output to stdout now |
| 1203 | exec 1>&3 |
| 1204 | fi |
| 1205 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1206 | |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 1207 | # Using the cloud |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 1208 | # --------------- |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 1209 | |
Jesse Andrews | e19d884 | 2011-11-01 20:06:55 -0700 | [diff] [blame] | 1210 | echo "" |
| 1211 | echo "" |
| 1212 | echo "" |
| 1213 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1214 | # If you installed Horizon on this server you should be able |
root | 40a3700 | 2011-09-20 18:06:14 +0000 | [diff] [blame] | 1215 | # to access the site using your browser. |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 1216 | if is_service_enabled horizon; then |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1217 | echo "Horizon is now available at http://$SERVICE_HOST/" |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 1218 | fi |
| 1219 | |
Steve Baker | bad9d89 | 2012-10-25 14:49:47 +1300 | [diff] [blame] | 1220 | # Warn that the default flavors have been changed by Heat |
| 1221 | if is_service_enabled heat; then |
| 1222 | echo "Heat has replaced the default flavors. View by running: nova flavor-list" |
| 1223 | fi |
| 1224 | |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1225 | # If Keystone is present you can point ``nova`` cli to this server |
Chmouel Boudjnah | a6651e9 | 2012-02-16 10:16:52 +0000 | [diff] [blame] | 1226 | if is_service_enabled key; then |
Dean Troyer | d835de8 | 2012-11-29 17:11:35 -0600 | [diff] [blame] | 1227 | echo "Keystone is serving at $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/" |
Dean Troyer | df0972c | 2012-03-07 17:31:03 -0600 | [diff] [blame] | 1228 | echo "Examples on using novaclient command line is in exercise.sh" |
| 1229 | echo "The default users are: admin and demo" |
| 1230 | echo "The password: $ADMIN_PASSWORD" |
Jesse Andrews | 2485906 | 2011-09-15 21:28:23 -0700 | [diff] [blame] | 1231 | fi |
termie | 523c405 | 2011-09-28 19:49:40 -0500 | [diff] [blame] | 1232 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 1233 | # Echo ``HOST_IP`` - useful for ``build_uec.sh``, which uses dhcp to give the instance an address |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 1234 | echo "This is your host ip: $HOST_IP" |
| 1235 | |
Dean Troyer | afc29fe | 2013-02-07 15:56:24 -0600 | [diff] [blame] | 1236 | # Warn that a deprecated feature was used |
| 1237 | if [[ -n "$DEPRECATED_TEXT" ]]; then |
| 1238 | echo_summary "WARNING: $DEPRECATED_TEXT" |
Dean Troyer | ced6517 | 2012-03-02 16:36:16 -0600 | [diff] [blame] | 1239 | fi |
| 1240 | |
Dean Troyer | 4a43b7b | 2012-08-28 17:43:40 -0500 | [diff] [blame] | 1241 | # Indicate how long this took to run (bash maintained variable ``SECONDS``) |
Dean Troyer | 7903b79 | 2012-09-13 17:16:12 -0500 | [diff] [blame] | 1242 | echo_summary "stack.sh completed in $SECONDS seconds." |