Major restructure
This commit is contained in:
parent
7bbcfd6dd9
commit
0f590885e4
@ -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}
|
|
@ -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
|
|
@ -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 $@
|
|
@ -8,7 +8,7 @@ description: |
|
|||||||
grade: devel
|
grade: devel
|
||||||
confinement: classic
|
confinement: classic
|
||||||
environment:
|
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
|
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
|
||||||
LC_ALL: C
|
LC_ALL: C
|
||||||
OS_PLACEMENT_CONFIG_DIR: $SNAP/etc/nova/
|
OS_PLACEMENT_CONFIG_DIR: $SNAP/etc/nova/
|
||||||
@ -215,13 +215,10 @@ apps:
|
|||||||
|
|
||||||
# Libvirt/Qemu
|
# Libvirt/Qemu
|
||||||
libvirt-bin:
|
libvirt-bin:
|
||||||
command: bin/launch-libvirtd
|
command: sbin/libvirtd
|
||||||
daemon: simple
|
daemon: simple
|
||||||
virsh:
|
virsh:
|
||||||
command: bin/virsh
|
command: virsh
|
||||||
environment:
|
|
||||||
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
|
|
||||||
LC_ALL: C
|
|
||||||
|
|
||||||
# MySQL
|
# MySQL
|
||||||
# MySQL
|
# MySQL
|
||||||
@ -464,10 +461,12 @@ parts:
|
|||||||
snapcraftctl build
|
snapcraftctl build
|
||||||
|
|
||||||
ovs-wrapper:
|
ovs-wrapper:
|
||||||
source: conf
|
source: ./snap-wrappers/ovs
|
||||||
plugin: dump
|
plugin: dump
|
||||||
after:
|
after:
|
||||||
- openvswitch
|
- openvswitch
|
||||||
|
organize:
|
||||||
|
ovs-wrapper: bin/ovs-wrapper
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
source: http://www.nginx.org/download/nginx-1.13.0.tar.gz
|
source: http://www.nginx.org/download/nginx-1.13.0.tar.gz
|
||||||
@ -489,9 +488,16 @@ parts:
|
|||||||
- libssl-dev
|
- libssl-dev
|
||||||
- python-six
|
- python-six
|
||||||
override-build: |
|
override-build: |
|
||||||
export SNAP_ROOT="../../.."
|
# Apply patches
|
||||||
export SNAP_SOURCE="$SNAP_ROOT/parts/nginx/build"
|
for patch in ${SNAPCRAFT_STAGE}/patches/nginx/*.patch; do
|
||||||
patch -d $SNAP_SOURCE -p1 < $SNAP_ROOT/patches/drop-nginx-setgroups.patch
|
echo "Applying $(basename "$patch") ..."
|
||||||
|
patch \
|
||||||
|
--batch \
|
||||||
|
--forward \
|
||||||
|
--strip 1 \
|
||||||
|
--input "$patch"
|
||||||
|
echo
|
||||||
|
done
|
||||||
snapcraftctl build
|
snapcraftctl build
|
||||||
|
|
||||||
libxml2:
|
libxml2:
|
||||||
@ -553,6 +559,7 @@ parts:
|
|||||||
- try: [libnuma1]
|
- try: [libnuma1]
|
||||||
- libcurl3-gnutls
|
- libcurl3-gnutls
|
||||||
- libpciaccess0
|
- libpciaccess0
|
||||||
|
- libxml2-utils
|
||||||
configflags:
|
configflags:
|
||||||
- --with-qemu
|
- --with-qemu
|
||||||
- --without-bhyve
|
- --without-bhyve
|
||||||
@ -589,7 +596,7 @@ parts:
|
|||||||
# MySQL
|
# MySQL
|
||||||
mysql-server:
|
mysql-server:
|
||||||
plugin: dump
|
plugin: dump
|
||||||
source: ./scripts/mysql
|
source: ./snap-wrappers/mysql
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- mysql-client
|
- mysql-client
|
||||||
@ -599,7 +606,7 @@ parts:
|
|||||||
|
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
rabbitmq-server:
|
rabbitmq-server:
|
||||||
source: ./scripts/rabbitmq
|
source: ./snap-wrappers/rabbitmq
|
||||||
plugin: dump
|
plugin: dump
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- rabbitmq-server
|
- rabbitmq-server
|
||||||
@ -666,7 +673,7 @@ parts:
|
|||||||
- "--with-kmod=no"
|
- "--with-kmod=no"
|
||||||
|
|
||||||
# Openstack Shared Parts
|
# Openstack Shared Parts
|
||||||
templates:
|
overlay:
|
||||||
after:
|
after:
|
||||||
- keystone-config
|
- keystone-config
|
||||||
- nova-config
|
- nova-config
|
||||||
@ -682,7 +689,7 @@ parts:
|
|||||||
- rabbitmq-server
|
- rabbitmq-server
|
||||||
- memcached
|
- memcached
|
||||||
plugin: dump
|
plugin: dump
|
||||||
source: snap
|
source: snap-overlay
|
||||||
|
|
||||||
configure-the-things:
|
configure-the-things:
|
||||||
plugin: dump
|
plugin: dump
|
||||||
|
@ -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…
Reference in New Issue
Block a user