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