Browse Source

Major restructure

configure-hook
James Page 3 years ago
parent
commit
0f590885e4
  1. 0
      patches/nginx/drop-nginx-setgroups.patch
  2. 75
      scripts/mysql/mysql-startup
  3. 0
      snap-overlay/bin/sudo
  4. 0
      snap-overlay/etc/cinder/cinder.conf
  5. 0
      snap-overlay/etc/glance/glance.conf.d/database.conf
  6. 0
      snap-overlay/etc/glance/glance.conf.d/keystone.conf
  7. 0
      snap-overlay/etc/horizon/horizon.conf
  8. 0
      snap-overlay/etc/keystone/keystone.conf
  9. 0
      snap-overlay/etc/keystone/keystone.conf.d/database.conf
  10. 0
      snap-overlay/etc/neutron/dhcp_agent.ini
  11. 0
      snap-overlay/etc/neutron/l3_agent.ini
  12. 0
      snap-overlay/etc/neutron/metadata_agent.ini
  13. 0
      snap-overlay/etc/neutron/neutron.conf
  14. 0
      snap-overlay/etc/neutron/neutron.conf.d/database.conf
  15. 0
      snap-overlay/etc/neutron/neutron.conf.d/keystone.conf
  16. 0
      snap-overlay/etc/neutron/neutron.conf.d/nova.conf
  17. 0
      snap-overlay/etc/neutron/neutron.conf.d/workers.conf
  18. 0
      snap-overlay/etc/neutron/plugins/ml2/ml2_conf.ini
  19. 0
      snap-overlay/etc/neutron/plugins/ml2/openvswitch_agent.ini
  20. 0
      snap-overlay/etc/nova/nova.conf
  21. 0
      snap-overlay/etc/nova/nova.conf.d/database.conf
  22. 0
      snap-overlay/etc/nova/nova.conf.d/glance.conf
  23. 0
      snap-overlay/etc/nova/nova.conf.d/hypervisor.conf
  24. 0
      snap-overlay/etc/nova/nova.conf.d/keystone.conf
  25. 0
      snap-overlay/etc/nova/nova.conf.d/neutron.conf
  26. 0
      snap-overlay/etc/nova/nova.conf.d/nova-placement.conf
  27. 0
      snap-overlay/etc/nova/nova.conf.d/rabbitmq.conf
  28. 0
      snap-overlay/etc/nova/nova.conf.d/scheduler.conf
  29. 0
      snap-overlay/etc/nova/nova.conf.d/workers.conf
  30. 0
      snap-overlay/etc/nova/policy.yaml
  31. 0
      snap-overlay/snap-openstack.yaml
  32. 0
      snap-overlay/templates/cinder-api.ini.j2
  33. 0
      snap-overlay/templates/cinder-nginx.conf.j2
  34. 0
      snap-overlay/templates/cinder-snap.conf.j2
  35. 0
      snap-overlay/templates/glance-snap.conf.j2
  36. 0
      snap-overlay/templates/horizon-nginx.conf.j2
  37. 0
      snap-overlay/templates/horizon-snap.conf.j2
  38. 0
      snap-overlay/templates/horizon.ini.j2
  39. 0
      snap-overlay/templates/keystone-api.ini.j2
  40. 0
      snap-overlay/templates/keystone-nginx.conf.j2
  41. 0
      snap-overlay/templates/keystone-snap.conf.j2
  42. 0
      snap-overlay/templates/neutron-snap.conf.j2
  43. 0
      snap-overlay/templates/nginx.conf.j2
  44. 0
      snap-overlay/templates/nova-nginx.conf.j2
  45. 0
      snap-overlay/templates/nova-placement-api.ini.j2
  46. 0
      snap-overlay/templates/nova-snap.conf.j2
  47. 0
      snap-wrappers/mysql/mysql-start-client
  48. 0
      snap-wrappers/mysql/mysql-start-server
  49. 0
      snap-wrappers/ovs/ovs-wrapper
  50. 0
      snap-wrappers/rabbitmq/erl
  51. 0
      snap-wrappers/rabbitmq/rabbitmq-defaults
  52. 0
      snap-wrappers/rabbitmq/rabbitmq-script-wrapper
  53. 14
      snap/bin/launch-libvirtd
  54. 16
      snap/bin/ovs-wrapper
  55. 35
      snapcraft.yaml
  56. 34
      stage_binaries.sh

0
patches/drop-nginx-setgroups.patch → patches/nginx/drop-nginx-setgroups.patch

75
scripts/mysql/mysql-startup

@ -1,75 +0,0 @@
#!/bin/bash
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
set -e
init_config() {
mkdir "${CONFDIR}"
echo "Generating config file in ${CONFFILE}..."
touch "${CONFFILE}"
echo "[mysqld]" >> ${CONFFILE}
echo "pid-file=${RUNDIR}/mysqld.pid" >> ${CONFFILE}
echo "socket=${RUNDIR}/mysqld.sock" >> ${CONFFILE}
echo "datadir=${DATADIR}" >> ${CONFFILE}
echo "log-error=${LOGDIR}/error.log" >> ${CONFFILE}
echo "secure-file-priv=${FILESDIR}" >> ${CONFFILE}
echo "basedir=${BASEDIR}" >> ${CONFFILE}
echo "[mysql]" >> ${CONFFILE}
echo "socket=${RUNDIR}/mysqld.sock" >> ${CONFFILE}
echo "Done"
}
init_database() {
echo "Initializing new database in ${DATADIR}..."
mkdir "${DATADIR}"
mysqld --defaults-file="${CONFFILE}" --initialize
echo "Done"
cat ${LOGDIR}/error.log | grep "temporary password"
}
USERID=$(id -u)
if [ "${USERID}" = "0" ];then
MYSQL_SNAPDIR="${SNAP_COMMON}"
else
MYSQL_SNAPDIR="${SNAP_USER_COMMON}"
fi
DATADIR="${MYSQL_SNAPDIR}/data"
RUNDIR="${MYSQL_SNAPDIR}/run"
LOGDIR="${MYSQL_SNAPDIR}/log"
CONFDIR="${MYSQL_SNAPDIR}/conf"
CONFFILE="${CONFDIR}/my.cnf"
FILESDIR="${MYSQL_SNAPDIR}/files"
BASEDIR="${SNAP}/usr"
[ -d "${LOGDIR}" ] || mkdir "${LOGDIR}"
[ -f "${LOGDIR}/error.log" ] || touch "${LOGDIR}/error.log"
[ -d "${FILESDIR}" ] || mkdir "${FILESDIR}"
[ -d "${RUNDIR}" ] || mkdir "${RUNDIR}"
[ -d "${CONFDIR}" ] || init_config
[ -d "${DATADIR}" ] || init_database
if [ "${USERID}" = "0" ];
then
# Ensure mysql user exists and that the correct permissions are set on various directories
getent group mysql || addgroup mysql
adduser --system --disabled-login --ingroup mysql --home /nonexistent --gecos "MySQL Server" --shell /bin/false mysql >/dev/null
chown -R mysql:mysql "${LOGDIR}" "${FILESDIR}" "${DATADIR}" "${RUNDIR}"
chmod 750 "${LOGDIR}" "${DATADIR}"
chmod 770 "${FILESDIR}"
chmod 755 "${RUNDIR}"
VARS="--user=mysql"
fi
echo "user=root" >> ${CONFFILE}
echo "password=`sudo cat /var/snap/microstack/common/log/error.log | grep "temporary password" | cut -d " " -f11`" >> ${CONFFILE}

0
snap/bin/sudo → snap-overlay/bin/sudo

0
snap/etc/cinder/cinder.conf → snap-overlay/etc/cinder/cinder.conf

0
snap/etc/glance/glance.conf.d/database.conf → snap-overlay/etc/glance/glance.conf.d/database.conf

0
snap/etc/glance/glance.conf.d/keystone.conf → snap-overlay/etc/glance/glance.conf.d/keystone.conf

0
snap/etc/horizon/horizon.conf → snap-overlay/etc/horizon/horizon.conf

0
snap/etc/keystone/keystone.conf → snap-overlay/etc/keystone/keystone.conf

0
snap/etc/keystone/keystone.conf.d/database.conf → snap-overlay/etc/keystone/keystone.conf.d/database.conf

0
snap/etc/neutron/dhcp_agent.ini → snap-overlay/etc/neutron/dhcp_agent.ini

0
snap/etc/neutron/l3_agent.ini → snap-overlay/etc/neutron/l3_agent.ini

0
snap/etc/neutron/metadata_agent.ini → snap-overlay/etc/neutron/metadata_agent.ini

0
snap/etc/neutron/neutron.conf → snap-overlay/etc/neutron/neutron.conf

0
snap/etc/neutron/neutron.conf.d/database.conf → snap-overlay/etc/neutron/neutron.conf.d/database.conf

0
snap/etc/neutron/neutron.conf.d/keystone.conf → snap-overlay/etc/neutron/neutron.conf.d/keystone.conf

0
snap/etc/neutron/neutron.conf.d/nova.conf → snap-overlay/etc/neutron/neutron.conf.d/nova.conf

0
snap/etc/neutron/neutron.conf.d/workers.conf → snap-overlay/etc/neutron/neutron.conf.d/workers.conf

0
snap/etc/neutron/plugins/ml2/ml2_conf.ini → snap-overlay/etc/neutron/plugins/ml2/ml2_conf.ini

0
snap/etc/neutron/plugins/ml2/openvswitch_agent.ini → snap-overlay/etc/neutron/plugins/ml2/openvswitch_agent.ini

0
snap/etc/nova/nova.conf → snap-overlay/etc/nova/nova.conf

0
snap/etc/nova/nova.conf.d/database.conf → snap-overlay/etc/nova/nova.conf.d/database.conf

0
snap/etc/nova/nova.conf.d/glance.conf → snap-overlay/etc/nova/nova.conf.d/glance.conf

0
snap/etc/nova/nova.conf.d/hypervisor.conf → snap-overlay/etc/nova/nova.conf.d/hypervisor.conf

0
snap/etc/nova/nova.conf.d/keystone.conf → snap-overlay/etc/nova/nova.conf.d/keystone.conf

0
snap/etc/nova/nova.conf.d/neutron.conf → snap-overlay/etc/nova/nova.conf.d/neutron.conf

0
snap/etc/nova/nova.conf.d/nova-placement.conf → snap-overlay/etc/nova/nova.conf.d/nova-placement.conf

0
snap/etc/nova/nova.conf.d/rabbitmq.conf → snap-overlay/etc/nova/nova.conf.d/rabbitmq.conf

0
snap/etc/nova/nova.conf.d/scheduler.conf → snap-overlay/etc/nova/nova.conf.d/scheduler.conf

0
snap/etc/nova/nova.conf.d/workers.conf → snap-overlay/etc/nova/nova.conf.d/workers.conf

0
snap/etc/nova/policy.yaml → snap-overlay/etc/nova/policy.yaml

0
snap/snap-openstack.yaml → snap-overlay/snap-openstack.yaml

0
snap/templates/cinder-api.ini.j2 → snap-overlay/templates/cinder-api.ini.j2

0
snap/templates/cinder-nginx.conf.j2 → snap-overlay/templates/cinder-nginx.conf.j2

0
snap/templates/cinder-snap.conf.j2 → snap-overlay/templates/cinder-snap.conf.j2

0
snap/templates/glance-snap.conf.j2 → snap-overlay/templates/glance-snap.conf.j2

0
snap/templates/horizon-nginx.conf.j2 → snap-overlay/templates/horizon-nginx.conf.j2

0
snap/templates/horizon-snap.conf.j2 → snap-overlay/templates/horizon-snap.conf.j2

0
snap/templates/horizon.ini.j2 → snap-overlay/templates/horizon.ini.j2

0
snap/templates/keystone-api.ini.j2 → snap-overlay/templates/keystone-api.ini.j2

0
snap/templates/keystone-nginx.conf.j2 → snap-overlay/templates/keystone-nginx.conf.j2

0
snap/templates/keystone-snap.conf.j2 → snap-overlay/templates/keystone-snap.conf.j2

0
snap/templates/neutron-snap.conf.j2 → snap-overlay/templates/neutron-snap.conf.j2

0
snap/templates/nginx.conf.j2 → snap-overlay/templates/nginx.conf.j2

0
snap/templates/nova-nginx.conf.j2 → snap-overlay/templates/nova-nginx.conf.j2

0
snap/templates/nova-placement-api.ini.j2 → snap-overlay/templates/nova-placement-api.ini.j2

0
snap/templates/nova-snap.conf.j2 → snap-overlay/templates/nova-snap.conf.j2

0
scripts/mysql/mysql-start-client → snap-wrappers/mysql/mysql-start-client

0
scripts/mysql/mysql-start-server → snap-wrappers/mysql/mysql-start-server

0
conf/bin/ovs-wrapper → snap-wrappers/ovs/ovs-wrapper

0
scripts/rabbitmq/erl → snap-wrappers/rabbitmq/erl

0
scripts/rabbitmq/rabbitmq-defaults → snap-wrappers/rabbitmq/rabbitmq-defaults

0
scripts/rabbitmq/rabbitmq-script-wrapper → snap-wrappers/rabbitmq/rabbitmq-script-wrapper

14
snap/bin/launch-libvirtd

@ -1,14 +0,0 @@
#!/bin/sh -e
if [ "$SNAP_ARCH" = "amd64" ]; then
ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" = "armhf" ]; then
ARCH="arm-linux-gnueabihf"
elif [ "$SNAP_ARCH" = "arm64" ]; then
ARCH="aarch64-linux-gnu"
else
ARCH="$SNAP_ARCH-linux-gnu"
fi
export LD_LIBRARY_PATH=$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
exec $SNAP/sbin/libvirtd

16
snap/bin/ovs-wrapper

@ -1,16 +0,0 @@
#!/bin/bash
set -e
export OVS_LOGDIR=${SNAP_COMMON}/log/openvswitch
export OVS_RUNDIR=${SNAP_COMMON}/run/openvswitch
export OVS_SYSCONFDIR=${SNAP_COMMON}/etc
export OVS_PKGDATADIR=${SNAP}/share/openvswitch
export OVS_BINDIR=${SNAP}/bin
export OVS_SBINDIR=${SNAP}/sbin
mkdir -p ${OVS_LOGDIR}
mkdir -p ${OVS_RUNDIR}
mkdir -p ${OVS_SYSCONFDIR}/openvswitch
exec $@

35
snapcraft.yaml

@ -8,7 +8,7 @@ description: |
grade: devel
confinement: classic
environment:
LD_LIBRARY_PATH: $SNAP/lib:$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu
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/
@ -215,13 +215,10 @@ apps:
# Libvirt/Qemu
libvirt-bin:
command: bin/launch-libvirtd
command: sbin/libvirtd
daemon: simple
virsh:
command: bin/virsh
environment:
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
LC_ALL: C
command: virsh
# MySQL
# MySQL
@ -464,10 +461,12 @@ parts:
snapcraftctl build
ovs-wrapper:
source: conf
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
@ -489,9 +488,16 @@ parts:
- libssl-dev
- python-six
override-build: |
export SNAP_ROOT="../../.."
export SNAP_SOURCE="$SNAP_ROOT/parts/nginx/build"
patch -d $SNAP_SOURCE -p1 < $SNAP_ROOT/patches/drop-nginx-setgroups.patch
# 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:
@ -553,6 +559,7 @@ parts:
- try: [libnuma1]
- libcurl3-gnutls
- libpciaccess0
- libxml2-utils
configflags:
- --with-qemu
- --without-bhyve
@ -589,7 +596,7 @@ parts:
# MySQL
mysql-server:
plugin: dump
source: ./scripts/mysql
source: ./snap-wrappers/mysql
stage-packages:
- mysql-server
- mysql-client
@ -599,7 +606,7 @@ parts:
# RabbitMQ
rabbitmq-server:
source: ./scripts/rabbitmq
source: ./snap-wrappers/rabbitmq
plugin: dump
stage-packages:
- rabbitmq-server
@ -666,7 +673,7 @@ parts:
- "--with-kmod=no"
# Openstack Shared Parts
templates:
overlay:
after:
- keystone-config
- nova-config
@ -682,7 +689,7 @@ parts:
- rabbitmq-server
- memcached
plugin: dump
source: snap
source: snap-overlay
configure-the-things:
plugin: dump

34
stage_binaries.sh

@ -1,34 +0,0 @@
#!/bin/sh
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SNAPDIR=$(pwd)
SNAPTMP=$(mktemp -d)
cd ${SNAPTMP}
MYSQL_VERSION_MAJOR=5.7
MYSQL_VERSION_FULL=5.7.17-1ubuntu16.04
FILENAME="mysql-server_${MYSQL_VERSION_FULL}_amd64.deb-bundle.tar"
wget "http://dev.mysql.com/get/Downloads/MySQL-{MYSQL_VERSION_MAJOR}/${FILENAME}"
tar -xvf "${FILENAME}"
ar x mysql-community-client_${MYSQL_VERSION_FULL}_amd64.deb
tar -xvf data.tar.xz
rm data.tar.xz
ar x mysql-community-server_${MYSQL_VERSION_FULL}_amd64.deb
tar -xvf data.tar.xz
mkdir staging-files
mv usr staging-files/
rm -rf ${SNAPDIR}/staging-files
mv staging-files ${SNAPDIR}
cd ${SNAPDIR}
Loading…
Cancel
Save