Skip to content

Commit

Permalink
Merge pull request #69 from indigo-dc/one5-packaging
Browse files Browse the repository at this point in the history
One5 packaging
  • Loading branch information
Alfonso Pérez authored Mar 28, 2017
2 parents b3b24bc + 3af2727 commit 4b4b0df
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 39 deletions.
3 changes: 1 addition & 2 deletions install/centos/install-docker
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOT
yum install -y yum-versionlock docker-engine-1.9.1-1.el7.centos
yum versionlock docker-engine
yum install -y docker-engine

systemctl start docker
systemctl enable docker
3 changes: 1 addition & 2 deletions install/ubuntu/install-docker
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ cat << EOT > /etc/apt/sources.list.d/docker.list
deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -sc) main
EOT
apt-get -y update
apt-get -y install linux-image-extra-$(uname -r) docker-engine=1.9.1-0~trusty
apt-mark hold docker-engine
apt-get -y install linux-image-extra-$(uname -r) docker-engine
cat > /etc/init.d/dockerrestart << EOT
#!/bin/bash
cgroups-umount
Expand Down
2 changes: 1 addition & 1 deletion install/ubuntu/install-onedock-one5
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
yum install -y xmlstarlet jq git
apt install -y xmlstarlet jq git
cd /tmp
git clone https://github.com/indigo-dc/onedock
cd onedock
Expand Down
2 changes: 1 addition & 1 deletion packaging/debian/build-dev.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
NODE=master
VERSION=1.0-2
VERSION=1.1
APP=onedock
BASE_FOLDER=.

Expand Down
4 changes: 2 additions & 2 deletions packaging/debian/master/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: onedock-master
Version: 1.0-2
Version: 1.1
Section: unknown
Priority: extra
Architecture: all
Depends: opennebula (>= 4.12.3+dfsg-3build1), xmlstarlet (>= 1.5.0-1), mount, jq (>= 1.3-1.1ubuntu1), qemu-utils, docker-engine (=1.9.1-0~trusty)
Depends: xmlstarlet (>= 1.5.0-1), mount, jq (>= 1.3-1.1ubuntu1), qemu-utils, docker-engine, bridge-utils
Maintainer: Indigo DC Project (https://github.com/indigo-dc/onedock)
Description: ONEDock
ONEDock is a set of extensions for OpenNebula to use containers as
Expand Down
72 changes: 61 additions & 11 deletions packaging/debian/master/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -1,32 +1,82 @@
#!/bin/bash
ONE_VER=$(dpkg -s opennebula | grep 'Version' | awk '{split($2,onev,"."); print onev[1]}')
set -e

function configure_one4 {
cat >> /etc/one/oned.conf << EOT
#*******************************************************************************
# ONEDOCK configuration
#*******************************************************************************
IM_MAD = [
name = "onedock",
executable = "one_im_ssh",
arguments = "-r 3 -t 15 onedock"
]
VM_MAD = [
name = "onedock",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 onedock",
type = "xml"
]
TM_MAD_CONF = [
name = "onedock", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "yes"
]
EOT

sed -i.bak-onedock '/^[ \t]*TM_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{
s/\(arguments[ ]*=[ ]*\"[^\"]*\)\(".*$\)/\1,onedock\2/};
/^[ \t]*DATASTORE_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{
s/\(arguments[ ]*=[ ]*\"[^\"]*\)\(".*$\)/\1,onedock\2/}' \
/etc/one/oned.conf
}

function configure_one5 {
cat >> /etc/one/oned.conf << EOT
#*******************************************************************************
# ONEDOCK configuration
#*******************************************************************************
IM_MAD = [
name = "onedock",
executable = "one_im_ssh",
arguments = "-r 3 -t 15 onedock" ]
NAME = "onedock",
SUNSTONE_NAME = "ONEDock",
EXECUTABLE = "one_im_ssh",
ARGUMENTS = "-r 3 -t 15 onedock"
]
VM_MAD = [
name = "onedock",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 onedock",
type = "xml" ]
NAME = "onedock",
SUNSTONE_NAME = "ONEDock",
EXECUTABLE = "one_vmm_exec",
ARGUMENTS = "-t 15 -r 0 onedock",
TYPE = "xml",
KEEP_SNAPSHOTS = "no",
IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, delete, reboot, reboot-hard"
]
TM_MAD_CONF = [
name = "onedock", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "yes"
NAME = "onedock", LN_TARGET = "SELF", CLONE_TARGET = "SELF", SHARED = "YES", DS_MIGRATE = "NO"
]
DS_MAD_CONF = [
NAME = "onedock", REQUIRED_ATTRS = "", PERSISTENT_ONLY = "NO"
]
EOT

echo "Cmnd_Alias ONEDOCK = /var/tmp/one/docker-manage-network,\
/usr/bin/qemu-nbd, /sbin/losetup, /bin/mount" >> /etc/sudoers.d/opennebula
sed -i.bak-onedock 's/^\(oneadmin ALL=.*\)$/\1, ONEDOCK/' /etc/sudoers.d/opennebula
sed -i.bak '/^[ \t]*TM_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{s/\(ARGUMENTS[ ]*=[ ]*\"[^\"]*\)\(".*$\)/\1,onedock\2/};/^[ \t]*DATASTORE_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{s/\(ARGUMENTS[ ]*=[ ]*\"[^\"]*-d [^\"]*\)\( -s [^\"]*\)\(".*$\)/\1,onedock\2,onedock\3/}' /etc/one/oned.conf
}

if [ $ONE_VER -eq 5 ]; then
configure_one5
else
configure_one4
fi

sed -i.bkp -e "s/export LOCAL_SERVER=.*/export LOCAL_SERVER=$(hostname):5000/g" /var/lib/one/remotes/onedock.conf
sed -i.bak-onedock 's/^\(oneadmin ALL=.*\)$/\1, ONEDOCK/' /etc/sudoers.d/opennebula
echo "Cmnd_Alias ONEDOCK = /var/tmp/one/docker-manage-network, /usr/bin/qemu-nbd, /sbin/losetup, /bin/mount" >> /etc/sudoers.d/opennebula
usermod -aG docker oneadmin
touch /var/log/onedock.log && chown oneadmin:oneadmin /var/log/onedock.log
chown -R oneadmin:oneadmin /var/lib/one/remotes
4 changes: 2 additions & 2 deletions packaging/debian/node/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: onedock-node
Version: 1.0-2
Version: 1.1
Section: unknown
Priority: extra
Architecture: all
Depends: opennebula-node (>= 4.12.3+dfsg-3build1), xmlstarlet (>= 1.5.0-1), mount, jq (>= 1.3-1.1ubuntu1), qemu-utils, docker-engine (=1.9.1-0~trusty)
Depends: xmlstarlet (>= 1.5.0-1), mount, jq (>= 1.3-1.1ubuntu1), qemu-utils, docker-engine, bridge-utils
Maintainer: Indigo DC Project (https://github.com/indigo-dc/onedock)
Description: ONEDock (for internal nodes)
ONEDock is a set of extensions for OpenNebula to use containers as
Expand Down
2 changes: 1 addition & 1 deletion packaging/rpm/build-rpm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
NODE=master
VERSION=1.0
VERSION=1.1
APP=onedock
BASE_FOLDER=.

Expand Down
79 changes: 65 additions & 14 deletions packaging/rpm/onedock-master.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Summary: ONEDock installation - EXPERIMENTAL. Please consider installing it by hand
Name: onedock-master
Version: 1.0
Release: 2
Version: 1.1
Release: 1
URL: https://github.com/indigo-dc/onedock
License: Apache-2.0
Group: unknown
BuildRoot: %{_tmppath}/%{name}-root
Requires: xmlstarlet jq opennebula docker-engine = 1.9.1-1.el7.centos
Requires: xmlstarlet jq opennebula docker-engine bridge-utils
Source0: onedock-master-%{version}.tar.gz
BuildArch: noarch

Expand All @@ -32,33 +32,84 @@ for f in $FILELIST; do
done

%post
ONE_VER=$(yum info opennebula | grep 'Vers*' | awk '{split($3,onev,"."); print onev[1]}')
set -e

function configure_one4 {
cat >> /etc/one/oned.conf << EOT
#*******************************************************************************
# ONEDOCK configuration
#*******************************************************************************

IM_MAD = [
name = "onedock",
executable = "one_im_ssh",
arguments = "-r 3 -t 15 onedock"
]

VM_MAD = [
name = "onedock",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 onedock",
type = "xml"
]

TM_MAD_CONF = [
name = "onedock", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "yes"
]
EOT

sed -i.bak-onedock '/^[ \t]*TM_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{
s/\(arguments[ ]*=[ ]*\"[^\"]*\)\(".*$\)/\1,onedock\2/};
/^[ \t]*DATASTORE_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{
s/\(arguments[ ]*=[ ]*\"[^\"]*\)\(".*$\)/\1,onedock\2/}' \
/etc/one/oned.conf
}

function configure_one5 {
cat >> /etc/one/oned.conf << EOT
#*******************************************************************************
# ONEDOCK configuration
#*******************************************************************************

IM_MAD = [
name = "onedock",
executable = "one_im_ssh",
arguments = "-r 3 -t 15 onedock" ]
NAME = "onedock",
SUNSTONE_NAME = "ONEDock",
EXECUTABLE = "one_im_ssh",
ARGUMENTS = "-r 3 -t 15 onedock"
]

VM_MAD = [
name = "onedock",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 onedock",
type = "xml" ]
NAME = "onedock",
SUNSTONE_NAME = "ONEDock",
XECUTABLE = "one_vmm_exec",
ARGUMENTS = "-t 15 -r 0 onedock",
TYPE = "xml",
KEEP_SNAPSHOTS = "no",
IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, delete, reboot, reboot-hard"
]

TM_MAD_CONF = [
name = "onedock", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "yes"
NAME = "onedock", LN_TARGET = "SELF", CLONE_TARGET = "SELF", SHARED = "YES", DS_MIGRATE = "NO"
]

DS_MAD_CONF = [
NAME = "onedock", REQUIRED_ATTRS = "", PERSISTENT_ONLY = "NO"
]
EOT

echo "Cmnd_Alias ONEDOCK = /var/tmp/one/docker-manage-network,\
/usr/bin/qemu-nbd, /sbin/losetup, /bin/mount" >> /etc/sudoers.d/opennebula
sed -i.bak-onedock 's/^\(oneadmin ALL=.*\)$/\1, ONEDOCK/' /etc/sudoers.d/opennebula
sed -i.bak '/^[ \t]*TM_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{s/\(ARGUMENTS[ ]*=[ ]*\"[^\"]*\)\(".*$\)/\1,onedock\2/};/^[ \t]*DATASTORE_MAD[ \t]*=[ \t]*\[/,/\][ \t]*$/{s/\(ARGUMENTS[ ]*=[ ]*\"[^\"]*-d [^\"]*\)\( -s [^\"]*\)\(".*$\)/\1,onedock\2,onedock\3/}' /etc/one/oned.conf
}

if [ $ONE_VER -eq 5 ]; then
configure_one5
else
configure_one4
fi

sed -i.bkp -e "s/export LOCAL_SERVER=.*/export LOCAL_SERVER=$(hostname):5000/g" /var/lib/one/remotes/onedock.conf
sed -i.bak-onedock 's/^\(oneadmin ALL=.*\)$/\1, ONEDOCK/' /etc/sudoers.d/opennebula
echo "Cmnd_Alias ONEDOCK = /var/tmp/one/docker-manage-network, /usr/bin/qemu-nbd, /sbin/losetup, /bin/mount" >> /etc/sudoers.d/opennebula
usermod -aG docker oneadmin
touch /var/log/onedock.log && chown oneadmin:oneadmin /var/log/onedock.log
chown -R oneadmin:oneadmin /var/lib/one/remotes
Expand Down
6 changes: 3 additions & 3 deletions packaging/rpm/onedock-node.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Summary: ONEDock installation - EXPERIMENTAL. Please consider installing it by hand
Name: onedock-node
Version: 1.0
Release: 2
Version: 1.1
Release: 1
URL: https://github.com/indigo-dc/onedock
License: Apache-2.0
Group: unknown
BuildRoot: %{_tmppath}/%{name}-root
Requires: xmlstarlet jq opennebula-node-kvm docker-engine = 1.9.1-1.el7.centos
Requires: xmlstarlet jq opennebula-node-kvm docker-engine bridge-utils
BuildArch: noarch

%description
Expand Down

0 comments on commit 4b4b0df

Please sign in to comment.