microstack/snapcraft.yaml
Pete Vander Giessen 597ffc99d8 Perist external bridge over reboots.
This fixes an issue where we weren't creating a netplan config and/or
and entry in /etc/network/interfaces for br-ex, and thus losing
external access to our virtual networks after reboot.

Since we don't actually want to touch the host system's networking
config, we just drop a oneshot daemon into place that sets br-ex up
each time the snap services are started.
2018-12-05 21:25:11 +00:00

809 lines
21 KiB
YAML

name: microstack
version: rocky
summary: OpenStack on your laptop.
description: |
Microstack gives you an easy way to develop and test OpenStack
workloads on your laptop.
grade: stable
confinement: classic
environment:
LD_LIBRARY_PATH: $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET
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://localhost:5000
OS_IDENTITY_API_VERSION: 3
OS_IMAGE_API_VERSION: 2
apps:
# Openstack
openstack:
command: openstack
# plugs:
# - network
# OpenStack Service Configuration
configure:
command: configure-openstack
# plugs:
# - network
# Keystone
keystone-uwsgi:
command: snap-openstack keystone-uwsgi
daemon: simple
# plugs:
# - network-bind
keystone-manage:
command: snap-openstack keystone-manage
# plugs:
# - network
# Nova
nova-uwsgi:
command: snap-openstack nova-uwsgi
daemon: simple
# plugs:
# - network-bind
nova-api:
command: snap-openstack nova-api-os-compute
daemon: simple
# plugs:
# - network-bind
nova-conductor:
command: snap-openstack nova-conductor
daemon: simple
# plugs:
# - network
nova-scheduler:
command: snap-openstack nova-scheduler
daemon: simple
# plugs:
# - network
nova-compute:
command: snap-openstack nova-compute
daemon: simple
# plugs:
# - network-bind
# - network-control
# - firewall-control
# - hardware-observe
# - libvirt
# - openvswitch
nova-api-metadata:
command: snap-openstack nova-api-metadata
daemon: simple
# plugs:
# - network-bind
# - firewall-control
nova-manage:
command: snap-openstack nova-manage
# plugs:
# - network
# Neutron
neutron-api:
command: snap-openstack neutron-server
daemon: simple
# plugs:
# - network-bind
neutron-openvswitch-agent:
command: snap-openstack neutron-openvswitch-agent
daemon: simple
# plugs:
# - network-bind
# - network-control
# - network-observe
# - firewall-control
# - process-control
# - system-observe
# - openvswitch
neutron-l3-agent:
command: snap-openstack neutron-l3-agent
daemon: simple
# plugs:
# - network-bind
# - network-control
# - network-observe
# - firewall-control
# - process-control
# - system-observe
# - openvswitch
neutron-dhcp-agent:
command: snap-openstack neutron-dhcp-agent
daemon: simple
# plugs:
# - network
# - network-bind
# - network-control
# - network-observe
# - process-control
# - system-observe
# - openvswitch
neutron-metadata-agent:
command: snap-openstack neutron-metadata-agent
daemon: simple
# plugs:
# - network
# - network-bind
# - network-control
neutron-ovs-cleanup:
command: snap-openstack neutron-ovs-cleanup
# plugs:
# - network
# - network-control
# - openvswitch
neutron-netns-cleanup:
command: snap-openstack neutron-netns-cleanup
# plugs:
# - network
# - network-control
neutron-db-manage:
command: snap-openstack neutron-db-manage
# plugs:
# - network
# Glance
glance-api:
command: snap-openstack glance-api
daemon: simple
# plugs:
# - network-bind
registry:
command: snap-openstack glance-registry
daemon: simple
# plugs:
# - network
# - network-bind
glance-manage:
command: snap-openstack glance-manage
# plugs:
# - network
# Openstack Shared Services
nginx:
command: snap-openstack nginx
daemon: forking
# plugs:
# - network-bind
# Openvswitch
ovs-vswitchd:
command: ovs-wrapper $SNAP/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server --no-monitor --system-id=random start
stop-command: ovs-wrapper $SNAP/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server stop
passthrough:
after: [ovsdb-server]
daemon: forking
# plugs:
# - network
# - network-bind
# - network-control
# - openvswitch-support
# - process-control
# - system-trace
ovsdb-server:
command: ovs-wrapper $SNAP/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd --no-monitor --system-id=random start
stop-command: ovs-wrapper $SNAP/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd stop
daemon: forking
# plugs:
# - network
# - network-bind
# - network-control
# - openvswitch-support
# - process-control
# - system-trace
ovs-vsctl:
command: ovs-wrapper $SNAP/bin/ovs-vsctl
# plugs:
# - network
ovs-appctl:
command: ovs-wrapper $SNAP/bin/ovs-appctl
# plugs:
# - network
ovs-ofctl:
command: ovs-wrapper $SNAP/bin/ovs-ofctl
# plugs:
# - network
ovs-dpctl:
command: ovs-wrapper $SNAP/bin/ovs-dpctl
# plugs:
# - network
external-bridge:
command: bin/setup-br-ex
daemon: oneshot
passthrough:
after: [ovs-vswitchd]
# plugs:
# - network
# Libvirt/Qemu
libvirtd:
command: libvirtd
daemon: simple
environment:
LD_LIBRARY_PATH: $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
virsh:
command: virsh
# MySQL
mysqld:
command: mysql-start-server
daemon: simple
# plugs:
# - process-control
# - network
# - network-bind
mysql:
command: mysql-start-client
# plugs:
# - process-control
# - network
# RabbitMQ
rabbitmq-server:
command: rabbitmq-server
daemon: simple
# plugs:
# - network-bind
environment:
HOME: $SNAP_COMMON/lib/rabbitmq
rabbitmqctl:
command: rabbitmqctl
# plugs:
# - network
environment:
HOME: $SNAP_COMMON/lib/rabbitmq
rabbitmq-plugins:
command: rabbitmq-plugins
environment:
HOME: $SNAP_COMMON/lib/rabbitmq
# Memcached
memcached:
command: memcached -u root -v
daemon: simple
# plugs:
# - network-bind
# Cinder
cinder-uwsgi:
command: snap-openstack cinder-uwsgi
# daemon: simple
# plugs:
# - network-bind
cinder-backup:
command: snap-openstack cinder-backup
# daemon: simple
# plugs:
# - network
cinder-manage:
command: snap-openstack cinder-manage
# plugs:
# - network
cinder-scheduler:
command: snap-openstack cinder-scheduler
# daemon: simple
# plugs:
# - network
cinder-volume:
command: snap-openstack cinder-volume
# daemon: simple
# plugs:
# - network
# Horizon
horizon-uwsgi:
command: snap-openstack horizon-uwsgi
daemon: simple
# plugs:
# - network-bind
launch:
command: bin/launch.sh
# plugs:
# - network
parts:
# OpenStack Python Projects, keyed off Keystone
openstack-projects:
plugin: python
python-version: python2
constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt
source: http://tarballs.openstack.org/keystone/keystone-stable-rocky.tar.gz
python-packages:
- libvirt-python
- oslo.cache[dogpile]
- pymysql
- uwsgi
- git+https://github.com/openstack/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
- http://tarballs.openstack.org/cinder/cinder-stable-rocky.tar.gz
- http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz
- python-cinderclient
- python-openstackclient
- python-swiftclient
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
- libvirt-dev
stage-packages:
- conntrack
- coreutils
- haproxy
override-build: |
# Ensure libvirt is discovered from previous built part
export PKG_CONFIG_PATH=$SNAPCRAFT_STAGE/lib/pkgconfig
snapcraftctl build
override-prime: |
snapcraftctl prime
# Now that everything is built, let's disable user site-packages
# as stated in PEP-0370
sed -i usr/lib/python2.7/site.py -e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/'
# This is the last step, let's now compile all our pyc files.
# Ignore errors due to syntax issues in foobar python 2.
./usr/bin/python2.7 -m compileall . || true
keystone-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/keystone/keystone-stable-rocky.tar.gz
organize:
etc/*.conf: etc/keystone/
etc/*.ini: etc/keystone/
etc/*.json: etc/keystone/
etc/*.templates: etc/keystone/
filesets:
etc:
- etc/keystone/*
stage: [$etc]
prime: [$etc]
nova-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/nova/nova-stable-rocky.tar.gz
filesets:
etc:
- etc/nova/*
stage: [$etc]
prime: [$etc]
neutron-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/neutron/neutron-stable-rocky.tar.gz
organize:
etc/*.conf: etc/neutron/
etc/*.ini: etc/neutron/
etc/*.json: etc/neutron/
etc/rootwrap.d/*: etc/neutron/rootwrap.d/
filesets:
etc:
- etc/neutron/*
stage: [$etc]
prime: [$etc]
glance-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/glance/glance-stable-rocky.tar.gz
organize:
etc/*.conf: etc/glance/
etc/*.ini: etc/glance/
etc/*.json: etc/glance/
filesets:
etc:
- etc/glance/*
stage: [$etc]
prime: [$etc]
cinder-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/cinder/cinder-stable-rocky.tar.gz
organize:
etc/*.conf: etc/cinder/
etc/*.ini: etc/cinder/
etc/*.json: etc/cinder/
etc/*.templates: etc/cinder/
filesets:
etc:
- etc/cinder/*
stage: [$etc]
prime: [$etc]
horizon-config:
after: [openstack-projects]
plugin: dump
source: http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz
organize:
etc/*.conf: etc/horizon/
filesets:
etc:
- etc/horizon/*
stage: [$etc]
prime: [$etc]
# Snap patches
patches:
source: patches/
plugin: dump
organize:
'*' : patches/
prime:
- -*
openvswitch:
# TODO: figure out a better way to fetch the version
source: http://openvswitch.org/releases/openvswitch-2.10.1.tar.gz
plugin: autotools
build-packages:
- libssl-dev
- try: [libnuma-dev]
- libcap-ng-dev
- libpcap-dev
- libunbound-dev
- python-all
- python-six
- python-setuptools
stage-packages:
- uuid-runtime
- libunbound2
configflags:
- "--localstatedir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common"
- "--sysconfdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/etc"
after:
- patches
override-build: |
# Apply patches
for patch in ${SNAPCRAFT_STAGE}/patches/openvswitch/*.patch; do
echo "Applying $(basename "$patch") ..."
patch \
--batch \
--forward \
--strip 1 \
--input "$patch"
echo
done
snapcraftctl build
ovs-wrapper:
source: ./snap-wrappers/ovs
plugin: dump
after:
- openvswitch
organize:
ovs-wrapper: bin/ovs-wrapper
nginx:
source: http://www.nginx.org/download/nginx-1.13.0.tar.gz
plugin: autotools
after:
- patches
configflags:
- --prefix=/usr
- "--http-log-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/log/nginx-access.log"
- "--error-log-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/log/nginx-error.log"
- "--lock-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lock/nginx.lock"
- "--pid-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/run/nginx.pid"
- "--http-client-body-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_client_body"
- "--http-proxy-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_proxy"
- "--http-fastcgi-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_fastcgi"
- "--http-uwsgi-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_uwsgi"
- "--http-scgi-temp-path=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/lib/nginx_scgi"
- --with-http_ssl_module
build-packages:
- libpcre3-dev
- libssl-dev
- python-six
override-build: |
# Apply patches
for patch in ${SNAPCRAFT_STAGE}/patches/nginx/*.patch; do
echo "Applying $(basename "$patch") ..."
patch \
--batch \
--forward \
--strip 1 \
--input "$patch"
echo
done
snapcraftctl build
libxml2:
source: http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz
plugin: autotools
# libvirt/qemu
qemu:
source: .
source-subdir: qemu-2.5+dfsg
plugin: autotools
stage-packages:
- seabios
- ipxe-qemu
- try:
- libnuma1
- libspice-server1
- libasound2
- libasyncns0
- libbluetooth3
- libboost-iostreams1.58.0
- libboost-random1.58.0
- libboost-system1.58.0
- libboost-thread1.58.0
- libcaca0
- libfdt1
- libflac8
- libiscsi2
- libjpeg-turbo8
- libnspr4
- libnss3
- libogg0
- libopus0
- libpixman-1-0
- libpulse0
- librados2
- librbd1
- libsdl1.2debian
- libsndfile1
- libusb-1.0-0
- libusbredirparser1
- libvorbis0a
- libvorbisenc2
- libx11-6
- libxau6
- libxcb1
- libxdmcp6
- libxext6
build-packages:
- acpica-tools
- libaio-dev
- libasound2-dev
- libattr1-dev
- libbluetooth-dev
- libcap-dev
- libcap-ng-dev
- libcurl4-gnutls-dev
- libfdt-dev
- gnutls-dev
- libiscsi-dev
- libncurses5-dev
- try: [libnuma-dev]
- libpixman-1-dev
- libpulse-dev
- librados-dev
- librbd-dev
- libsasl2-dev
- libsdl1.2-dev
- try: [libspice-server-dev, libspice-protocol-dev]
- libusb-1.0-0-dev
- libusbredirparser-dev
- linux-libc-dev
- uuid-dev
- xfslibs-dev
- libjpeg-dev
- zlib1g-dev
- libpng-dev
- wget
- dpkg-dev
- gcc
configflags:
- --disable-blobs
- --prefix=/snap/$SNAPCRAFT_PROJECT_NAME/current
- --localstatedir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- --sysconfdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- --extra-cflags=-DCONFIG_QEMU_DATAPATH='"/snap/$SNAPCRAFT_PROJECT_NAME/current/share/qemu:/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/share/seabios:/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib/ipxe/qemu"'
- --disable-user
- --disable-linux-user
- --enable-system
- --target-list=x86_64-softmmu
override-build: |
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg.orig.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.33.debian.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.33.dsc
dpkg-source -x qemu_*.dsc
snapcraftctl build
organize:
# Hack to shift installed qemu back to root of snap
# required to ensure that pathing to files etc works at
# runtime
# * is not used to avoid directory merge conflicts
snap/microstack/current/: ./
kvm-support:
plugin: nil
stage-packages:
- try: [msr-tools]
libvirt:
source: .
source-subdir: libvirt-1.3.1
plugin: autotools
build-packages:
- libxml2-dev
- libxml-libxml-perl
- libcurl4-gnutls-dev
- libncurses5-dev
- libreadline-dev
- zlib1g-dev
- libgcrypt20-dev
- libgnutls28-dev
- libyajl-dev
- libpcap0.8-dev
- libaudit-dev
- libdevmapper-dev
- libpciaccess-dev
- libnl-3-dev
- libnl-route-3-dev
- uuid-dev
- try: [libnuma-dev]
- wget
- dpkg-dev
stage-packages:
- try: [dmidecode]
- dnsmasq
- dnsmasq-utils
- ebtables
- libxml2
- libyajl2
- try: [libnuma1]
- libcurl3-gnutls
- libpciaccess0
configflags:
- --with-qemu
- --without-bhyve
- --without-xen
- --without-openvz
- --without-vmware
- --without-xenapi
- --without-esx
- --without-hyperv
- --without-lxc
- --without-vz
- --without-vbox
- --without-uml
- --without-sasl
- --without-storage-iscsi
- --without-storage-sheepdog
- --without-storage-rbd
- --without-storage-lvm
- --without-selinux
- --prefix=/snap/$SNAPCRAFT_PROJECT_NAME/current
- --localstatedir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- --sysconfdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- DNSMASQ=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/sbin/dnsmasq
- DMIDECODE=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/sbin/dmidecode
- OVSVSCTL=/snap/$SNAPCRAFT_PROJECT_NAME/current/bin/ovs-vsctl
- EBTABLES_PATH=/snap/$SNAPCRAFT_PROJECT_NAME/current/sbin/ebtables
- IPTABLES_PATH=/snap/$SNAPCRAFT_PROJECT_NAME/current/sbin/iptables
override-build: |
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_1.3.1.orig.tar.gz
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_1.3.1-1ubuntu10.24.debian.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/libv/libvirt/libvirt_1.3.1-1ubuntu10.24.dsc
dpkg-source -x libvirt*.dsc
snapcraftctl build
organize:
# Hack to shift installed libvirt back to root of snap
# required to ensure that pathing to files etc works at
# runtime
# * is not used to avoid directory merge conflicts
snap/microstack/current/: ./
# MySQL
mysql-server:
plugin: dump
source: ./snap-wrappers/mysql
stage-packages:
- mysql-server
- mysql-client
organize:
mysql-start-server: bin/mysql-start-server
mysql-start-client: bin/mysql-start-client
# RabbitMQ
rabbitmq-server:
source: ./snap-wrappers/rabbitmq
plugin: dump
stage-packages:
- rabbitmq-server
override-build: |
rm -f $SNAPCRAFT_PART_INSTALL/usr/bin/erl
rm -f $SNAPCRAFT_PART_INSTALL/usr/lib/rabbitmq/bin/rabbitmq-script-wrapper
# NOTE(jamespage): The versioned path below is brittle.
rm -f $SNAPCRAFT_PART_INSTALL/usr/lib/rabbitmq/lib/rabbitmq_server-3.5.7/sbin/rabbitmq-defaults
snapcraftctl build
organize:
rabbitmq-script-wrapper: usr/lib/rabbitmq/bin/rabbitmq-script-wrapper
rabbitmq-defaults: usr/lib/rabbitmq/lib/rabbitmq_server-3.5.7/sbin/rabbitmq-defaults
erl: usr/bin/erl
# Memcached Token Caching
memcached:
plugin: autotools
source: https://memcached.org/files/memcached-1.5.10.tar.gz
build-packages:
- libevent-dev
- gcc
- make
stage-packages:
- libevent-2.0-5
override-build: |
./configure --prefix=$SNAPCRAFT_PART_INSTALL
make
make install
# Cinder LVM backend
lvm2:
source: http://www.sourceware.org/pub/lvm2/releases/LVM2.2.02.172.tgz
plugin: autotools
configflags:
- --with-confdir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/etc/
- --with-default-system-dir=/var/snap/$SNAPCRAFT_PROJECT_NAME/common/etc/
build-attributes: [no-patchelf]
# Misc utils for hypervisor networking
bridge-utils:
source: https://www.kernel.org/pub/linux/utils/net/bridge-utils/bridge-utils-1.6.tar.gz
plugin: autotools
iproute2:
source: https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.9.0.tar.gz
plugin: autotools
build-packages:
- bison
- flex
- libdb5.3-dev
iptables:
source: http://iptables.netfilter.org/projects/iptables/files/iptables-1.6.0.tar.bz2
plugin: autotools
build-packages:
- libnftnl-dev
configflags:
- --disable-nftables
- --prefix=/snap/$SNAPCRAFT_PROJECT_NAME/current
install: |
cp --remove-destination $SNAPCRAFT_PART_INSTALL/snap/$SNAPCRAFT_PROJECT_NAME/current/sbin/xtables-multi \
$SNAPCRAFT_PART_INSTALL/snap/$SNAPCRAFT_PROJECT_NAME/current/bin/iptables-xml
organize:
# Hack to shift installed iptables back to root of snap
# required to ensure that pathing to files etc works at
# runtime
# * is not used to avoid directory merge conflicts
snap/microstack/current/: ./
ipset:
source: http://ipset.netfilter.org/ipset-6.30.tar.bz2
plugin: autotools
build-packages:
- libltdl-dev
- libmnl-dev
configflags:
- "--with-kmod=no"
launch:
plugin: dump
source: src/launch
organize:
launch.sh: bin/launch.sh
# Openstack Shared Parts
overlay:
plugin: dump
source: snap-overlay
configure-the-things:
plugin: dump
source: src/experiments