Skip to content

Commit c7adb0a

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add local.sh support and samples of local.sh and locarc"
2 parents 7a1f805 + f5633dd commit c7adb0a

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ proto
33
*.log
44
src
55
localrc
6+
local.sh

samples/local.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
# Sample ``local.sh`` for user-configurable tasks to run automatically
4+
# at the sucessful conclusion of ``stack.sh``.
5+
6+
# NOTE: Copy this file to the root ``devstack`` directory for it to
7+
# work properly.
8+
9+
# This is a collection of some of the things we have found to be useful to run
10+
# after stack.sh to tweak the OpenStack configuration that DevStack produces.
11+
# These should be considered as samples and are unsupported DevStack code.
12+
13+
# Keep track of the devstack directory
14+
TOP_DIR=$(cd $(dirname "$0") && pwd)
15+
16+
# Use openrc + stackrc + localrc for settings
17+
source $TOP_DIR/stackrc
18+
19+
# Destination path for installation ``DEST``
20+
DEST=${DEST:-/opt/stack}
21+
22+
23+
# Import ssh keys
24+
# ---------------
25+
26+
# Import keys from the current user into the default OpenStack user (usually
27+
# ``demo``)
28+
29+
# Get OpenStack auth
30+
source $TOP_DIR/openrc
31+
32+
# Add first keypair found in localhost:$HOME/.ssh
33+
for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
34+
if [[ -f $i ]]; then
35+
nova keypair-add --pub_key=$i `hostname`
36+
break
37+
fi
38+
done
39+
40+
41+
# Create A Flavor
42+
# ---------------
43+
44+
# Get OpenStack admin auth
45+
source $TOP_DIR/openrc admin admin
46+
47+
# Name of new flavor
48+
# set in ``localrc`` with ``DEFAULT_INSTANCE_TYPE=m1.micro``
49+
MI_NAME=m1.micro
50+
51+
# Create micro flavor if not present
52+
if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
53+
nova flavor-create $MI_NAME 6 128 0 1
54+
fi
55+
# Other Uses
56+
# ----------
57+
58+
# Add tcp/22 to default security group
59+

samples/localrc

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Sample ``localrc`` for user-configurable variables in ``stack.sh``
2+
3+
# NOTE: Copy this file to the root ``devstack`` directory for it to work properly.
4+
5+
# ``localrc`` is a user-maintained setings file that is sourced at the end of
6+
# ``stackrc``. This gives it the ability to override any variables set in ``stackrc``.
7+
# Also, most of the settings in ``stack.sh`` are written to only be set if no
8+
# value has already been set; this lets ``localrc`` effectively override the
9+
# default values.
10+
11+
# This is a collection of some of the settings we have found to be useful
12+
# in our DevStack development environments. Additional settings are described
13+
# in http://devstack.org/localrc.html
14+
# These should be considered as samples and are unsupported DevStack code.
15+
16+
17+
# Minimal Contents
18+
# ----------------
19+
20+
# While ``stack.sh`` is happy to run without ``localrc``, devlife is better when
21+
# there are a few minimal variables set:
22+
23+
# If the ``*_PASSWORD`` variables are not set here you will be prompted to enter
24+
# values for them by ``stack.sh``.
25+
ADMIN_PASSWORD=nomoresecrete
26+
MYSQL_PASSWORD=stackdb
27+
RABBIT_PASSWORD=stackqueue
28+
SERVICE_PASSWORD=$ADMIN_PASSWORD
29+
30+
# HOST_IP should be set manually for best results. It is auto-detected during the
31+
# first run of ``stack.sh`` but often is indeterminate on later runs due to the IP
32+
# being moved from an Ethernet interface to a bridge on the host. Setting it here
33+
# also makes it available for ``openrc`` to include when setting ``OS_AUTH_URL``.
34+
# ``HOST_IP`` is not set by default.
35+
HOST_IP=w.x.y.z
36+
37+
38+
# Set DevStack Install Directory
39+
# ------------------------------
40+
41+
# The DevStack install directory is set by the ``DEST`` variable. By setting it
42+
# early in ``localrc`` you can reference it in later variables. The default value
43+
# is ``/opt/stack``. It can be useful to set it even though it is not changed from
44+
# the default value.
45+
DEST=/opt/stack
46+
47+
48+
# Using milestone-proposed branches
49+
# ---------------------------------
50+
51+
# Uncomment these to grab the milestone-proposed branches from the repos:
52+
#GLANCE_BRANCH=milestone-proposed
53+
#HORIZON_BRANCH=milestone-proposed
54+
#KEYSTONE_BRANCH=milestone-proposed
55+
#KEYSTONECLIENT_BRANCH=milestone-proposed
56+
#NOVA_BRANCH=milestone-proposed
57+
#NOVACLIENT_BRANCH=milestone-proposed
58+
#SWIFT_BRANCH=milestone-proposed
59+
60+
61+
# Swift
62+
# -----
63+
64+
# Swift is now used as the back-end for the S3-like object store. If Nova's
65+
# objectstore (``n-obj`` in ``ENABLED_SERVICES``) is enabled, it will NOT
66+
# run if Swift is enabled. Setting the hash value is required and you will
67+
# be prompted for it if Swift is enabled so just set it to something already:
68+
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
69+
70+
# For development purposes the default of 3 replicas is usually not required.
71+
# Set this to 1 to save some resources:
72+
SWIFT_REPLICAS=1
73+
74+
# The data for Swift is stored in the source tree by default (``$DEST/swift/data``)
75+
# and can be moved by setting ``SWIFT_DATA_DIR``. The directory will be created
76+
# if it does not exist.
77+
SWIFT_DATA_DIR=$DEST/data

stack.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,16 @@ if is_service_enabled g-reg; then
17141714
fi
17151715

17161716

1717+
# Run local script
1718+
# ================
1719+
1720+
# Run ``local.sh`` if it exists to perform user-managed tasks
1721+
if [[ -x $TOP_DIR/local.sh ]]; then
1722+
echo "Running user script $TOP_DIR/local.sh"
1723+
$TOP_DIR/local.sh
1724+
fi
1725+
1726+
17171727
# Fin
17181728
# ===
17191729

0 commit comments

Comments
 (0)