Added snap configuration.
Moved openstack env variables out of snapcraft.yaml, and into a "microtack.rc". Made openstack-wrapper, which auto sources microstack.rc. Key off of revised snap.openstack, which supports snapctl config values in templates. Moved a lot of the overlay into snap-overlay/templates, and added config values to them. Also writes templates just once, when you run snap-openstack setup.
This commit is contained in:
parent
7b4e61201b
commit
8b5428d7f2
|
@ -2,6 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
source $SNAP_COMMON/etc/microstack.rc
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please specify a name for the server."
|
||||
exit 1
|
||||
|
@ -64,4 +66,4 @@ while :; do
|
|||
fi
|
||||
done
|
||||
|
||||
echo "You can also visit the openstack dashboard at 'http://10.20.20.1/'"
|
||||
echo "You can also visit the openstack dashboard at 'http://$extgateway/'"
|
||||
|
|
|
@ -9,13 +9,15 @@
|
|||
|
||||
set -ex
|
||||
|
||||
extgateway=$(snapctl get extgateway)
|
||||
|
||||
# Create external integration bridge
|
||||
ovs-vsctl --retry --may-exist add-br br-ex
|
||||
|
||||
# Configure br-ex
|
||||
ip address add 10.20.20.1/24 dev br-ex || :
|
||||
ip address add $extgateway/24 dev br-ex || :
|
||||
ip link set br-ex up || :
|
||||
|
||||
sudo iptables -t nat -A POSTROUTING -s 10.20.20.1/24 ! -d 10.20.20.1/24 -j MASQUERADE
|
||||
sudo iptables -t nat -A POSTROUTING -s $extgateway/24 ! -d $extgateway/24 -j MASQUERADE
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://glance:glance@10.20.20.1/glance
|
|
@ -1,2 +0,0 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://keystone:keystone@10.20.20.1/keystone
|
|
@ -1,2 +0,0 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://neutron:neutron@10.20.20.1/neutron
|
|
@ -1,5 +0,0 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://nova:nova@10.20.20.1/nova
|
||||
|
||||
[api_database]
|
||||
connection = mysql+pymysql://nova_api:nova_api@10.20.20.1/nova_api
|
|
@ -1,2 +0,0 @@
|
|||
[glance]
|
||||
api_servers = http://10.20.20.1:9292
|
|
@ -1,2 +0,0 @@
|
|||
[DEFAULT]
|
||||
transport_url = rabbit://openstack:rabbitmq@10.20.20.1
|
|
@ -38,8 +38,27 @@ setup:
|
|||
horizon-nginx.conf.j2: "{snap_common}/etc/nginx/snap/sites-enabled/horizon.conf"
|
||||
libvirtd.conf.j2: "{snap_common}/libvirt/libvirtd.conf"
|
||||
virtlogd.conf.j2: "{snap_common}/libvirt/virtlogd.conf"
|
||||
microstack.rc.j2: "{snap_common}/etc/microstack.rc"
|
||||
glance.conf.d.keystone.conf.j2: "{snap_common}/etc/glance/glance.conf.d/keystone.conf"
|
||||
nova.conf.d.keystone.conf.j2: "{snap_common}/etc/nova/nova.conf.d/keystone.conf"
|
||||
nova.conf.d.database.conf.j2: "{snap_common}/etc/nova/nova.conf.d/database.conf"
|
||||
nova.conf.d.rabbitmq.conf.j2: "{snap_common}/etc/nova/nova.conf.d/rabbitmq.conf"
|
||||
nova.conf.d.nova-placement.conf.j2: "{snap_common}/etc/nova/nova.conf.d/nova-placement.conf"
|
||||
nova.conf.d.glance.conf.j2: "{snap_common}/etc/nova/nova.conf.d/glance.conf"
|
||||
nova.conf.d.neutron.conf.j2: "{snap_common}/etc/nova/nova.conf.d/neutron.conf"
|
||||
keystone.database.conf.j2: "{snap_common}/etc/keystone/keystone.conf.d/database.conf"
|
||||
glance.database.conf.j2: "{snap_common}/etc/glance/glance.conf.d/database.conf"
|
||||
neutron.keystone.conf.j2: "{snap_common}/etc/neutron/neutron.conf.d/keystone.conf"
|
||||
neutron.nova.conf.j2: "{snap_common}/etc/neutron/neutron.conf.d/nova.conf"
|
||||
neutron.database.conf.j2: "{snap_common}/etc/neutron/neutron.conf.d/database.conf"
|
||||
|
||||
chmod:
|
||||
"{snap_common}/instances": 0755
|
||||
"{snap_common}/etc/microstack.rc": 0644
|
||||
snap-config-keys:
|
||||
- ospassword
|
||||
- extgateway
|
||||
- dns
|
||||
entry_points:
|
||||
keystone-manage:
|
||||
binary: "{snap}/bin/keystone-manage"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[keystone_authtoken]
|
||||
auth_uri = http://10.20.20.1:5000
|
||||
auth_url = http://10.20.20.1:5000
|
||||
memcached_servers = 10.20.20.1:11211
|
||||
auth_uri = http://{{ extgateway }}:5000
|
||||
auth_url = http://{{ extgateway }}:5000
|
||||
memcached_servers = {{ extgateway }}:11211
|
||||
auth_type = password
|
||||
project_domain_name = default
|
||||
user_domain_name = default
|
|
@ -0,0 +1,2 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://glance:glance@{{ extgateway }}/glance
|
|
@ -0,0 +1,2 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://keystone:keystone@{{ extgateway }}/keystone
|
|
@ -0,0 +1,9 @@
|
|||
export OS_PROJECT_DOMAIN_NAME=default
|
||||
export OS_USER_DOMAIN_NAME=default
|
||||
export OS_PROJECT_NAME=admin
|
||||
export OS_USERNAME=admin
|
||||
export OS_PASSWORD={{ ospassword }}
|
||||
export OS_AUTH_URL=http://{{ extgateway }}:5000
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
export OS_IMAGE_API_VERSION=2
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://neutron:neutron@{{ extgateway }}/neutron
|
|
@ -2,9 +2,9 @@
|
|||
auth_strategy = keystone
|
||||
|
||||
[keystone_authtoken]
|
||||
auth_uri = http://10.20.20.1:5000
|
||||
auth_url = http://10.20.20.1:5000
|
||||
memcached_servers = 10.20.20.1:11211
|
||||
auth_uri = http://{{ extgateway }}:5000
|
||||
auth_url = http://{{ extgateway }}:5000
|
||||
memcached_servers = {{ extgateway }}:11211
|
||||
auth_type = password
|
||||
project_domain_name = default
|
||||
user_domain_name = default
|
|
@ -3,7 +3,7 @@ notify_nova_on_port_status_changes = True
|
|||
notify_nova_on_port_data_changes = True
|
||||
|
||||
[nova]
|
||||
auth_url = http://10.20.20.1:5000
|
||||
auth_url = http://{{ extgateway }}:5000
|
||||
auth_type = password
|
||||
project_domain_name = default
|
||||
user_domain_name = default
|
|
@ -0,0 +1,5 @@
|
|||
[database]
|
||||
connection = mysql+pymysql://nova:nova@{{ extgateway }}/nova
|
||||
|
||||
[api_database]
|
||||
connection = mysql+pymysql://nova_api:nova_api@{{ extgateway }}/nova_api
|
|
@ -0,0 +1,2 @@
|
|||
[glance]
|
||||
api_servers = http://{{ extgateway }}:9292
|
|
@ -1,7 +1,7 @@
|
|||
[keystone_authtoken]
|
||||
auth_uri = http://10.20.20.1:5000
|
||||
auth_url = http://10.20.20.1:5000
|
||||
memcached_servers = 10.20.20.1:11211
|
||||
auth_uri = http://{{ extgateway }}:5000
|
||||
auth_url = http://{{ extgateway }}:5000
|
||||
memcached_servers = {{ extgateway }}:11211
|
||||
auth_type = password
|
||||
project_domain_name = default
|
||||
user_domain_name = default
|
|
@ -1,7 +1,7 @@
|
|||
[neutron]
|
||||
url = http://10.20.20.1:9696
|
||||
auth_url = http://10.20.20.1:5000
|
||||
memcached_servers = 10.20.20.1:11211
|
||||
url = http://{{ extgateway }}:9696
|
||||
auth_url = http://{{ extgateway }}:5000
|
||||
memcached_servers = {{ extgateway }}:11211
|
||||
auth_type = password
|
||||
project_domain_name = default
|
||||
user_domain_name = default
|
|
@ -4,6 +4,6 @@ project_domain_name = default
|
|||
project_name = service
|
||||
auth_type = password
|
||||
user_domain_name = default
|
||||
auth_url = http://10.20.20.1:5000
|
||||
auth_url = http://{{ extgateway }}:5000
|
||||
username = placement
|
||||
password = placement
|
|
@ -0,0 +1,2 @@
|
|||
[DEFAULT]
|
||||
transport_url = rabbit://openstack:rabbitmq@{{ extgateway }}
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
source $SNAP_COMMON/etc/microstack.rc
|
||||
|
||||
exec $@
|
|
@ -1,4 +1,19 @@
|
|||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
ospassword=$(snapctl get ospassword)
|
||||
extgateway=$(snapctl get extgateway)
|
||||
dns=$(snapctl get dns)
|
||||
|
||||
if [ -z "$ospassword" -o -z "$extgateway" -o -z "$dns" ]; then
|
||||
echo "Missing required config value."
|
||||
snapctl get microstack
|
||||
exit 1
|
||||
fi
|
||||
|
||||
snap-openstack setup # Write out templates
|
||||
|
||||
source $SNAP_COMMON/etc/microstack.rc
|
||||
|
||||
# Open up networking so that instances can route to the Internet (see
|
||||
# bin/setup-br-ex for more networking setup, executed on microstack
|
||||
|
@ -9,25 +24,25 @@ sudo sysctl net.ipv4.ip_forward=1
|
|||
echo "Creating OpenStack Databases"
|
||||
|
||||
# Wait for MySQL to startup
|
||||
while ! nc -z 10.20.20.1 3306; do sleep 0.1; done;
|
||||
while ! nc -z $extgateway 3306; do sleep 0.1; done;
|
||||
sleep 5
|
||||
|
||||
# Wait for rabbitmq to start
|
||||
while ! nc -z 10.20.20.1 5672; do sleep 0.1; done;
|
||||
while ! nc -z $extgateway 5672; do sleep 0.1; done;
|
||||
|
||||
for db in neutron nova nova_api nova_cell0 cinder glance keystone; do
|
||||
echo "CREATE DATABASE IF NOT EXISTS ${db}; GRANT ALL PRIVILEGES ON ${db}.* TO '${db}'@'10.20.20.1' IDENTIFIED BY '${db}';" \
|
||||
echo "CREATE DATABASE IF NOT EXISTS ${db}; GRANT ALL PRIVILEGES ON ${db}.* TO '${db}'@'$extgateway' IDENTIFIED BY '${db}';" \
|
||||
| mysql-start-client -u root
|
||||
done
|
||||
|
||||
# Grant nova user access to cell0
|
||||
echo "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'10.20.20.1' IDENTIFIED BY 'nova';" | mysql-start-client -u root
|
||||
echo "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'$extgateway' IDENTIFIED BY 'nova';" | mysql-start-client -u root
|
||||
|
||||
# Endpoints from localhost -> 10.20.20.1
|
||||
# TODO Rebuild database so that these are already set to 10.20.20.1,
|
||||
# Endpoints from localhost -> $extgateway
|
||||
# TODO Rebuild database so that these are already set to $extgateway,
|
||||
# after lp:1824176 is addressed, and the process of building a new
|
||||
# mysql.tar.xz is less fraught.
|
||||
openstack endpoint list | grep localhost | while read line; do openstack endpoint set `echo $line | cut -d" " -f2` --url `echo $line | cut -d" " -f14 | sed 's/localhost/10.20.20.1/'`; done
|
||||
openstack endpoint list | grep localhost | while read line; do openstack endpoint set `echo $line | cut -d" " -f2` --url `echo $line | cut -d" " -f14 | sed "s/localhost/$extgateway/"`; done
|
||||
|
||||
# RabbitMQ
|
||||
echo "Configuring RabbitMQ"
|
||||
|
@ -45,12 +60,12 @@ HOME=$SNAP_COMMON/lib/rabbitmq rabbitmqctl set_permissions openstack ".*" ".*" "
|
|||
|
||||
# Glance
|
||||
echo "Waiting for glance to start."
|
||||
while ! nc -z 10.20.20.1 9292; do sleep 0.1; done;
|
||||
while ! nc -z $extgateway 9292; do sleep 0.1; done;
|
||||
|
||||
sleep 5
|
||||
|
||||
# Wait for identity service
|
||||
while ! nc -z 10.20.20.1 5000; do sleep 0.1; done;
|
||||
while ! nc -z $extgateway 5000; do sleep 0.1; done;
|
||||
|
||||
# Setup the cirros image, which is used by the launch app
|
||||
openstack image show cirros || {
|
||||
|
@ -70,7 +85,7 @@ openstack image show cirros || {
|
|||
systemctl restart snap.microstack.*virt*
|
||||
|
||||
# Wait for horizon
|
||||
while ! nc -z 10.20.20.1 80; do sleep 0.1; done;
|
||||
while ! nc -z $extgateway 80; do sleep 0.1; done;
|
||||
|
||||
# Restart Placement API
|
||||
# Workaround for issue w/ base:core18, where the Placement API throws
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
snapctl set \
|
||||
ospassword=keystone \
|
||||
extgateway=10.20.20.1 \
|
||||
dns=1.1.1.1
|
||||
|
||||
# MySQL snapshot for speedy install
|
||||
# snapshot is a mysql data dir with
|
||||
|
@ -11,8 +16,10 @@ tar -xJf ${SNAP}/data/mysql.tar.xz -C ${SNAP_COMMON}/lib
|
|||
echo "Installing configuration for OpenStack Services"
|
||||
for project in neutron nova keystone glance; do
|
||||
mkdir -p ${SNAP_COMMON}/etc/${project}/${project}.conf.d
|
||||
cp -r ${SNAP}/etc/${project}/${project}.conf.d/* ${SNAP_COMMON}/etc/${project}/${project}.conf.d
|
||||
cp -r ${SNAP}/etc/${project}/${project}.conf.d/* ${SNAP_COMMON}/etc/${project}/${project}.conf.d || true # Skip conf files that have been moved into templates
|
||||
done
|
||||
|
||||
snap-openstack setup # Sets up templates for the first time.
|
||||
|
||||
# Configure Keystone Fernet Keys
|
||||
snap-openstack keystone-manage fernet_setup --keystone-user root --keystone-group root
|
||||
|
|
|
@ -12,20 +12,11 @@ environment:
|
|||
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
|
||||
LC_ALL: C
|
||||
OS_PLACEMENT_CONFIG_DIR: $SNAP/etc/nova/
|
||||
# admin rc (TODO: put this someplace more sensible)
|
||||
OS_PROJECT_DOMAIN_NAME: default
|
||||
OS_USER_DOMAIN_NAME: default
|
||||
OS_PROJECT_NAME: admin
|
||||
OS_USERNAME: admin
|
||||
OS_PASSWORD: keystone
|
||||
OS_AUTH_URL: http://10.20.20.1:5000
|
||||
OS_IDENTITY_API_VERSION: 3
|
||||
OS_IMAGE_API_VERSION: 2
|
||||
|
||||
apps:
|
||||
# Openstack
|
||||
openstack:
|
||||
command: openstack
|
||||
command: openstack-wrapper openstack
|
||||
# plugs:
|
||||
# - network
|
||||
|
||||
|
@ -329,7 +320,7 @@ parts:
|
|||
- oslo.cache[dogpile]
|
||||
- pymysql
|
||||
- uwsgi
|
||||
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
|
||||
- git+https://github.com/petevg/snap.openstack#egg=snap.openstack
|
||||
- http://tarballs.openstack.org/nova/nova-stable-rocky.tar.gz
|
||||
- http://tarballs.openstack.org/neutron/neutron-stable-rocky.tar.gz
|
||||
- http://tarballs.openstack.org/glance/glance-stable-rocky.tar.gz
|
||||
|
@ -377,6 +368,14 @@ parts:
|
|||
stage: [$etc]
|
||||
prime: [$etc]
|
||||
|
||||
openstack-wrapper:
|
||||
source: ./snap-wrappers/openstack
|
||||
plugin: dump
|
||||
after:
|
||||
- openstack-projects
|
||||
organize:
|
||||
openstack-wrapper: bin/openstack-wrapper
|
||||
|
||||
nova-config:
|
||||
after: [openstack-projects]
|
||||
plugin: dump
|
||||
|
@ -706,8 +705,8 @@ parts:
|
|||
rm -R libvirt-4.0.* || true
|
||||
# Download sources and patch
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_4.0.0.orig.tar.xz
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_4.0.0-1ubuntu8.10.debian.tar.xz
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_4.0.0-1ubuntu8.10.dsc
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_4.0.0-1ubuntu8.12.debian.tar.xz
|
||||
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_4.0.0-1ubuntu8.12.dsc
|
||||
dpkg-source -x libvirt*.dsc
|
||||
snapcraftctl build
|
||||
organize:
|
||||
|
|
Loading…
Reference in New Issue