Compare commits

...

31 Commits
master ... dev

Author SHA1 Message Date
santic-zombie edc73d3159 opennebula-node-kvm deploy 4 months ago
santic-zombie 533b86cbbe Small Fix APKBUILD 5 months ago
santic-zombie 28e808b1e7 deinstall appends 5 months ago
santic-zombie 5b9da58c55 Checksums 5 months ago
santic-zombie 25941d046c Added sudoers file 5 months ago
santic-zombie 9f6750f9b7 Final fixes 5 months ago
santic-zombie 83f25d4af1 Test chown 5 months ago
santic-zombie 4f18e8f762 Test chown 5 months ago
santic-zombie 93d4c3a23b gitignore 5 months ago
santic-zombie 8015653416 Fixed chown 5 months ago
santic-zombie 7d15950dc4 Fixed post-install and APKBUILD 5 months ago
santic-zombie 8988b764d3 Fixed post-install 5 months ago
santic-zombie f6282e3371 Fixed deinstall 5 months ago
santic-zombie 40cf35d1e1 Renamed script 5 months ago
santic-zombie 08154d989c Fixed post-install script and added post-install 5 months ago
santic-zombie cf1221e089 Modifed post-install script 5 months ago
santic-zombie 991c0a7fe9 fixed post-install script 5 months ago
santic-zombie 0091a9e7d0 fix APKBUILD target dir 5 months ago
santic-zombie 5c2c0317e8 fix APKBUILD email 5 months ago
santic-zombie b7885ab7d4 fix APKBUILD 5 months ago
santic-zombie 84cb4e967b Added opennebula-common package abuild 5 months ago
santic-zombie b505ad5d5a New 1 year ago
santic-zombie 16e9a65fb1 - Added new APKBUILD for deploying ruby-gems 2 years ago
santic-zombie 01b098ee80 RM depricated files 2 years ago
santic-zombie 6a940d30c9 MV README 2 years ago
santic-zombie 6e372a5d4e Changes in structure 2 years ago
santic-zombie c6e95bcc08 APKBUILD small changes 2 years ago
santic-zombie d6437fcf63 Formated text files 2 years ago
santic-zombie 38c26d3580 - Fixed services; \n -Changed APKBUILD 2 years ago
santic-zombie 12c741a477 Small Fixes 2 years ago
santic-zombie 0182e0adf3 New patches, README addings 2 years ago
  1. 1
      .gitignore
  2. 26
      README.md
  3. 46
      opennebula
  4. 31
      opennebula-common/APKBUILD
  5. 18
      opennebula-common/one-sudoers
  6. 14
      opennebula-common/opennebula-common.post-deinstall
  7. 57
      opennebula-common/opennebula-common.post-install
  8. 28
      opennebula-common/ssh-config
  9. 36
      opennebula-flow
  10. 36
      opennebula-gate
  11. 36
      opennebula-hem
  12. 52
      opennebula-node-kvm/APKBUILD
  13. 4
      opennebula-node-kvm/etc/cron.d/opennebula-node
  14. 30
      opennebula-node-kvm/etc/init.d/opennebula-gate-proxy
  15. 11
      opennebula-node-kvm/etc/logrotate.d/opennebula-gate-proxy
  16. 1
      opennebula-node-kvm/etc/sudoers.d/opennebula-node-kvm
  17. 3
      opennebula-node-kvm/etc/sysctl.d/bridge-nf-call.conf
  18. 13
      opennebula-node-kvm/opennebula-node-kvm.post-deinstall
  19. 140
      opennebula-node-kvm/opennebula-node-kvm.post-install
  20. 120
      opennebula-node-kvm/usr/bin/onegate-proxy
  21. 120
      opennebula-node-kvm/usr/bin/qemu-kvm-one-gen
  22. 309
      opennebula-node-kvm/usr/lib/one/onegate-proxy/onegate-proxy.rb
  23. 28
      opennebula-novnc
  24. 57
      opennebula-rubygems/APKBUILD
  25. 36
      opennebula-scheduler
  26. 30
      opennebula-sunstone
  27. 88
      opennebula/APKBUILD
  28. 22
      opennebula/Gruntfile.patch
  29. 48
      opennebula/opennebula
  30. 30
      opennebula/opennebula-flow
  31. 30
      opennebula/opennebula-gate
  32. 30
      opennebula/opennebula-hem
  33. 28
      opennebula/opennebula-novnc
  34. 30
      opennebula/opennebula-scheduler
  35. 28
      opennebula/opennebula-ssh-agent
  36. 31
      opennebula/opennebula-sunstone
  37. 0
      opennebula/opennebula.logrotate
  38. 0
      opennebula/opennebula.post-deinstall
  39. 0
      opennebula/opennebula.post-install
  40. 0
      opennebula/opennebula.post-upgrade
  41. 0
      opennebula/opennebula.pre-deinstall
  42. 0
      opennebula/opennebula.pre-install
  43. 13
      opennebula/package.patch
  44. 0
      opennebula/svn.patch
  45. 82
      txt/README.md

1
.gitignore vendored

@ -0,0 +1 @@
deploy.sh

@ -1,7 +1,9 @@
# APKBUILD # APKBUILD
## Prepare
``` ```
# apk add alpine-sdk sudo # apk add alpine-sdk sudo atools
# visudo # visudo
``` ```
@ -14,7 +16,29 @@
# chmod a+w /var/cache/distfiles # chmod a+w /var/cache/distfiles
``` ```
```
vi /etc/abuild.conf
```
``` ```
abuild-keygen -a -i abuild-keygen -a -i
``` ```
```
apk add shadow
```
```
useradd -m -g cloud -c "OpenNebula administrator account" -s /bin/ash oneadmin
```
## Build
```
abuild checksum
```
```
abuild -r
```

@ -1,46 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula management"
command="/usr/bin/oned"
command_args="-f"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need mariadb
after syslog networking localmount netmount
want opennebula-scheduler opennebula-hem opennebula-ssh-agent
}
start_pre() {
/bin/mkdir -p /var/log/one
/bin/mkdir -p /var/lock/one
/bin/mkdir -p /run/one
/bin/chown $command_user -R /var/log/one /run/one /var/lock/one
/usr/sbin/logrotate -s /tmp/logrotate.state -f /etc/logrotate.d/opennebula.logrotate
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start -- $command_args
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--retry TERM/10/KILL/10 \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}
stop_post() {
/bin/rm -f /var/lock/one/one
/usr/share/one/follower_cleanup
}

@ -0,0 +1,31 @@
# Contributor: Santic <email@santic-zombie.ru>
# Maintainer: Santic <email@santic-zombie.ru>
pkgname=opennebula-common
pkgver=6.8.0
pkgrel=1
pkgdesc="Common OpenNebula package shared by various components (Community Edition)"
url="https://opennebula.io/"
arch="noarch"
options="!check"
license="Apache"
depends="
jq
openssh-client
sudo"
install="
${pkgname}.post-install
${pkgname}.post-deinstall"
source="
ssh-config
one-sudoers"
package() {
install -Dm755 "${srcdir}/ssh-config" "${pkgdir}/usr/share/one/ssh/config"
install -Dm750 "${srcdir}/one-sudoers" "${pkgdir}/etc/sudoers.d/one-sudoers"
}
sha512sums="
71c4ebfa1b1c32c59b0fead99730604e0edba617f6d6b9a4e9a4d9671fbe75c60f9f4d53fb5e2f35d7c632c7e308bd047af2f1db769de4134eb078d7b0fc3486 ssh-config
1ad8bc352282e613717e66f4bef7887058fea3e729a2907dc1fc3c560f1051e060859e865248d57108b8002c09e7e48212bd9176defc21465b07e98d65f74214 one-sudoers"

@ -0,0 +1,18 @@
Defaults:oneadmin !requiretty
Defaults:oneadmin secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Cmnd_Alias ONE_CEPH = /usr/bin/rbd
Cmnd_Alias ONE_FIRECRACKER = /usr/bin/jailer, /usr/sbin/one-clean-firecracker-domain, /usr/sbin/one-prepare-firecracker-domain
Cmnd_Alias ONE_HA = /bin/systemctl start opennebula-showback.timer, /bin/systemctl stop opennebula-showback.timer, /usr/sbin/service opennebula-flow start, /usr/sbin/service opennebula-flow stop, /usr/sbin/service opennebula-gate start, /usr/sbin/service opennebula-gate stop, /usr/sbin/service opennebula-hem start, /usr/sbin/service opennebula-hem stop, /usr/bin/arping, /sbin/ip address *
Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvs, /sbin/vgdisplay, /sbin/lvchange, /sbin/lvscan, /sbin/lvextend
Cmnd_Alias ONE_LXC = /bin/mount, /bin/umount, /usr/bin/bindfs, /sbin/losetup, /usr/bin/qemu-nbd, /usr/bin/lxc-attach, /usr/bin/lxc-config, /usr/bin/lxc-create, /usr/bin/lxc-destroy, /usr/bin/lxc-info, /usr/bin/lxc-ls, /usr/bin/lxc-start, /usr/bin/lxc-stop, /usr/bin/lxc-console, /sbin/e2fsck, /sbin/resize2fs, /usr/sbin/xfs_growfs, /usr/bin/rbd-nbd
Cmnd_Alias ONE_LXD = /snap/bin/lxc, /usr/bin/catfstab, /bin/mount, /bin/umount, /bin/mkdir, /bin/lsblk, /sbin/losetup, /sbin/kpartx, /usr/bin/qemu-nbd, /sbin/blkid, /sbin/e2fsck, /sbin/resize2fs, /usr/sbin/xfs_growfs, /usr/bin/rbd-nbd, /usr/sbin/xfs_admin, /sbin/tune2fs
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh, /usr/lib/one/sh/create_docker_image.sh
Cmnd_Alias ONE_NET = /sbin/ebtables, /sbin/iptables, /sbin/ip6tables, /sbin/ipset, /sbin/ip link *, /sbin/ip tuntap *, /sbin/ip route *, /sbin/ip neighbour *
Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /usr/bin/ovs-appctl
Cmnd_Alias ONE_MEM = /sbin/sysctl vm.drop_caches=3 vm.compact_memory=1
Cmnd_Alias ONE_VGPU = /var/tmp/one/vgpu
## Command aliases are enabled individually in dedicated
## sudoers files by each OpenNebula component (server, node).
# oneadmin ALL=(ALL) NOPASSWD: ONE_CEPH, ONE_FIRECRACKER, ONE_HA, ONE_LVM, ONE_LXC, ONE_LXD, ONE_MARKET, ONE_NET, ONE_OVS, ONE_MEM

@ -0,0 +1,14 @@
#!/bin/sh
set -e
ONE_GROUP=cloud
ONE_USER=oneadmin
userdel -r ${ONE_USER} 2>/dev/null && echo ">> User '${ONE_USER}' has been removed."
groupdel ${ONE_GROUP} 2>/dev/null && echo ">> Group '${ONE_GROUP}' has been removed."
rm -rf /var/lib/one /var/run/one /var/log/one /var/lock/one 2>/dev/null
rm -rf /etc/sudoers.d/one-sudoers 2>/dev/null
exit 0

@ -0,0 +1,57 @@
#!/bin/sh
set -e
ONEHOME=/var/lib/one
ONE_GROUP=cloud
ONE_USER=oneadmin
ONE_UID=9869
ONE_GID=9869
ONE_COMMENT="OpenNebula administrator account"
create_cloudgroup() {
if ! getent group $ONE_GROUP > /dev/null 2>&1; then
addgroup --system --gid $ONE_GID $ONE_GROUP
fi
}
create_oneuser() {
if ! getent passwd $ONE_USER > /dev/null 2>&1; then
adduser --system --gecos "$ONE_COMMENT" --uid $ONE_UID --ingroup $ONE_GROUP --home $ONEHOME --shell /bin/ash $ONE_USER
else
ONEHOME=`getent passwd $ONE_USER | cut -f6 -d:`
# Renable user (give him a shell)
usermod --shell /bin/ash $ONE_USER
fi
if ! getent group disk | grep "\b$ONE_USER\b" &>/dev/null; then
usermod -a -G disk $ONE_USER
fi
}
create_cloudgroup
create_oneuser
# Install ~oneadmin/.ssh/config if not present on a fresh install only
if [ ! -e "${ONEHOME}/.ssh/config" ] && [ -z "$2" ]; then
if [ ! -d "${ONEHOME}/.ssh" ]; then
mkdir -p "${ONEHOME}/.ssh"
chmod 0700 "${ONEHOME}/.ssh"
chown "$ONE_USER:$ONE_GROUP" "${ONEHOME}/.ssh"
fi
cp /usr/share/one/ssh/config "${ONEHOME}/.ssh/config"
chmod 0600 "${ONEHOME}/.ssh/config"
chown "$ONE_USER:$ONE_GROUP" "${ONEHOME}/.ssh/config"
fi
# Set permissions and owner oneadmin:cloud
for F in /var/lock/one /var/log/one /var/run/one /usr/lib/one
do
if [ ! -d "${F}" ]; then
mkdir -p "${F}"
chmod 0750 "${F}"
chown "${ONE_USER}:${ONE_GROUP}" "${F}"
fi
done
exit 0

@ -0,0 +1,28 @@
# Initial default configuration placed by opennebula-common
# package. Latest default configurations are located in
# /usr/share/one/ssh/.
###############################################################################
# WARNING: This configuration file is ONLY for OpenSSH 7.6 and newer!
###############################################################################
Host *
StrictHostKeyChecking accept-new
ServerAliveInterval 10
#############################################################################
# 'ControlMaster' is overriden by OpenNebula's drivers when needed
ControlMaster no
# The following options must be aligned with the accompanying timer/cronjob:
# opennebula-ssh-socks-cleaner (if present) which implements workaround for
# OpenSSH race condition during the closing of the master socket.
#
# 'ControlPersist' should be set to more than twice the period after which
# timer or cronjob is run - to offset the delay - e.g.: timer job is run each
# 30s then 'ControlPersist' should be at least one minute. It will also not
# change the behavior even if it set much higher or to the infinity (0) - it
# is limited by the timer/cronjob *AND* the command which is executed inside.
#
# (+) Add another 10s to give timer/cronjob a room for cleanup
ControlPersist 70s
# 'ControlPath' must be in-sync with the script run by timer/cronjob above!
ControlPath /run/one/ssh-socks/ctl-M-%C.sock

@ -1,36 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Flow Service"
command="/usr/bin/ruby /usr/lib/one/oneflow/oneflow-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
after syslog networking netmount opennebula
}
start_pre() {
/bin/mkdir -p /var/log/one
/bin/mkdir -p /var/lock/one
/bin/mkdir -p /run/one
/bin/chown $command_user -R /var/log/one /run/one /var/lock/one
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -1,36 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Gate Daemon"
command="/usr/bin/ruby /usr/lib/one/onegate/onegate-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
after syslog networking netmount opennebula
}
start_pre() {
/bin/mkdir -p /var/log/one
/bin/mkdir -p /var/lock/one
/bin/mkdir -p /run/one
/bin/chown $command_user -R /var/log/one /run/one /var/lock/one
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -1,36 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Hook Execution Service"
command="/usr/bin/ruby /usr/lib/one/onehem/onehem-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
after syslog networking netmount opennebula
}
start_pre() {
/bin/mkdir -p /var/log/one
/bin/mkdir -p /var/lock/one
/bin/mkdir -p /run/one
/bin/chown $command_user -R /var/log/one /run/one /var/lock/one
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -0,0 +1,52 @@
# Contributor: Santic <email@santic-zombie.ru>
# Maintainer: Santic <email@santic-zombie.ru>
pkgname=opennebula-node-kvm
pkgver=6.8.0
pkgrel=1
pkgdesc="Services for OpenNebula KVM node (Community Edition)"
url="https://opennebula.io/"
arch="noarch"
options="!check"
license="Apache"
depends="
opennebula-common
libvirt-daemon
qemu-img
qemu-system-x86_64
ruby
vlan
ipset
pciutils
rsync
tar
cronie
logrotate
augeas
libxml2
iptables"
install="
${pkgname}.post-install
${pkgname}.post-deinstall"
source="
/etc/cron.d/opennebula-node
/etc/init.d/opennebula-gate-proxy
/etc/logrotate.d/opennebula-gate-proxy
/etc/sudoers.d/opennebula-node-kvm
/etc/sysctl.d/bridge-nf-call.conf
/usr/bin/onegate-proxy
/usr/bin/qemu-kvm-one-gen
/usr/lib/one/onegate-proxy/onegate-proxy.rb
"
package() {
install -Dm700 "${srcdir}/etc/cron.d/opennebula-node" "${pkgdir}/etc/cron.d/opennebula-node"
install -Dm755 "${srcdir}/etc/init.d/opennebula-gate-proxy" "${pkgdir}/etc/init.d/opennebula-gate-proxy"
install -Dm644 "${srcdir}/etc/logrotate.d/opennebula-gate-proxy" "${pkgdir}/etc/logrotate.d/opennebula-gate-proxy"
install -Dm400 "${srcdir}/etc/sudoers.d/opennebula-node-kvm" "${pkgdir}/etc/sudoers.d/opennebula-node-kvm"
install -Dm644 "${srcdir}/etc/sysctl.d/bridge-nf-call.conf" "${pkgdir}/etc/sysctl.d/bridge-nf-call.conf"
install -Dm744 "${srcdir}/usr/bin/onegate-proxy" "${pkgdir}/usr/bin/onegate-proxy"
install -Dm744 "${srcdir}/usr/bin/qemu-kvm-one-gen" "${pkgdir}/usr/bin/qemu-kvm-one-gen"
install -Dm744 -o oneadmin -g cloud "${srcdir}/usr/lib/one/onegate-proxy/onegate-proxy.rb" "${pkgdir}/usr/lib/one/onegate-proxy/onegate-proxy.rb"

@ -0,0 +1,4 @@
SHELL=/bin/sh
# activate LVM volumes on reboot
@reboot oneadmin test -x /var/tmp/one/tm/fs_lvm/activate && /var/tmp/one/tm/fs_lvm/activate >/dev/null 2>&1

@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Gate Proxy Service"
command="/usr/bin/ruby /usr/lib/one/onegate-proxy/onegate-proxy.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -0,0 +1,11 @@
/var/log/one/onegate-proxy.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
weekly
rotate 52
missingok
notifempty
copytruncate
}

@ -0,0 +1 @@
oneadmin ALL=(ALL:ALL) NOPASSWD: ONE_CEPH, ONE_NET, ONE_OVS, ONE_LVM, ONE_MEM, ONE_VGPU

@ -0,0 +1,3 @@
net.bridge.bridge-nf-call-arptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

@ -0,0 +1,13 @@
#!/bin/sh
set -e
ONE_GROUP=cloud
ONE_USER=oneadmin
userdel -r ${ONE_USER} 2>/dev/null && echo ">> User '${ONE_USER}' has been removed."
groupdel ${ONE_GROUP} 2>/dev/null && echo ">> Group '${ONE_GROUP}' has been removed."
rm -rf /var/lib/one /var/run/one /var/log/one /var/lock/one 2>/dev/null
exit 0

@ -0,0 +1,140 @@
#!/bin/sh
set -e
ONEHOME=/var/lib/one
ONE_GROUP=cloud
ONE_USER=oneadmin
# Add oneadmin user into libvirt group
if getent group libvirt >/dev/null && ! getent group libvirt | cut -f4 -d: | grep -q "\<$ONE_USER\>"; then
adduser $ONE_USER libvirt
fi
# Add oneadmin user into kvm group
if getent group kvm >/dev/null && ! getent group kvm | cut -f4 -d: | grep -q "\<$ONE_USER\>"; then
adduser $ONE_USER kvm
fi
# Backup libvirt/QEMU configuration, reconfigure for OpenNebula
if [ -e /etc/libvirt/qemu.conf ]; then
cp -f /etc/libvirt/qemu.conf "/etc/libvirt/qemu.conf.$(date +'%Y-%m-%d_%H:%M:%S')"
fi
AUGTOOL=$(augtool -A 2>/dev/null <<EOF
set /augeas/load/Libvirtd_qemu/lens Libvirtd_qemu.lns
set /augeas/load/Libvirtd_qemu/incl /etc/libvirt/qemu.conf
load
set /files/etc/libvirt/qemu.conf/user oneadmin
set /files/etc/libvirt/qemu.conf/group cloud
set /files/etc/libvirt/qemu.conf/dynamic_ownership 0
save
EOF
)
# generate generic qemu-kvm-one symlink
/usr/bin/qemu-kvm-one-gen
if [ -n "${AUGTOOL}" ] && [ -z "${AUGTOOL##*Saved *}" ]; then
systemctl try-restart libvirtd 2>/dev/null || true
fi
# # Automatically added by dh_systemd_enable/12.10ubuntu1
# if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# if deb-systemd-helper debian-installed 'opennebula-gate-proxy.service'; then
# # This will only remove masks created by d-s-h on package removal.
# deb-systemd-helper unmask 'opennebula-gate-proxy.service' >/dev/null || true
#
# if deb-systemd-helper --quiet was-enabled 'opennebula-gate-proxy.service'; then
# # Create new symlinks, if any.
# deb-systemd-helper enable 'opennebula-gate-proxy.service' >/dev/null || true
# fi
# fi
#
# # Update the statefile to add new symlinks (if any), which need to be cleaned
# # up on purge. Also remove old symlinks.
# deb-systemd-helper update-state 'opennebula-gate-proxy.service' >/dev/null || true
# fi
# # End automatically added section
create_cloudgroup() {
if ! getent group $ONE_GROUP > /dev/null 2>&1; then
addgroup --system --gid $ONE_GID $ONE_GROUP
fi
}
create_oneuser() {
if ! getent passwd $ONE_USER > /dev/null 2>&1; then
adduser --system --gecos "$ONE_COMMENT" --uid $ONE_UID --ingroup $ONE_GROUP --home $ONEHOME --shell /bin/ash $ONE_USER
else
ONEHOME=`getent passwd $ONE_USER | cut -f6 -d:`
# Renable user (give him a shell)
usermod --shell /bin/ash $ONE_USER
fi
if ! getent group disk | grep "\b$ONE_USER\b" &>/dev/null; then
usermod -a -G disk $ONE_USER
fi
}
create_cloudgroup
create_oneuser
# Install ~oneadmin/.ssh/config if not present on a fresh install only
if [ ! -e "${ONEHOME}/.ssh/config" ] && [ -z "$2" ]; then
if [ ! -d "${ONEHOME}/.ssh" ]; then
mkdir -p "${ONEHOME}/.ssh"
chmod 0700 "${ONEHOME}/.ssh"
chown "$ONE_USER:$ONE_GROUP" "${ONEHOME}/.ssh"
fi
cp /usr/share/one/ssh/config "${ONEHOME}/.ssh/config"
chmod 0600 "${ONEHOME}/.ssh/config"
chown "$ONE_USER:$ONE_GROUP" "${ONEHOME}/.ssh/config"
fi
# Set permissions and owner oneadmin:cloud
for F in /var/lock/one /var/log/one /var/run/one
do
if [ ! -d "${F}" ]; then
mkdir -p "${F}"
chmod 0750 "${F}"
chown "${ONE_USER}:${ONE_GROUP}" "${F}"
fi
done
exit 0

@ -0,0 +1,120 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
if [ -z "$ONE_LOCATION" ]; then
ONEGATE_PROXY_PID=/var/run/one/onegate-proxy.pid
ONEGATE_PROXY_SERVER=/usr/lib/one/onegate-proxy/onegate-proxy.rb
ONEGATE_PROXY_LOCK_FILE=/var/lock/one/.onegate-proxy.lock
ONEGATE_PROXY_LOG=/var/log/one/onegate-proxy.log
ONEGATE_PROXY_LOG_ERROR=/var/log/one/onegate-proxy.error
else
ONEGATE_PROXY_PID=$ONE_LOCATION/var/onegate-proxy.pid
ONEGATE_PROXY_SERVER=$ONE_LOCATION/lib/onegate-proxy/onegate-proxy.rb
ONEGATE_PROXY_LOCK_FILE=$ONE_LOCATION/var/.onegate-proxy.lock
ONEGATE_PROXY_LOG=$ONE_LOCATION/var/onegate-proxy.log
ONEGATE_PROXY_LOG_ERROR=$ONE_LOCATION/var/onegate-proxy.error
fi
setup()
{
if [ -f $ONEGATE_PROXY_LOCK_FILE ]; then
if [ -f $ONEGATE_PROXY_PID ]; then
ONEGATEPID=`cat $ONEGATE_PROXY_PID`
ps $ONEGATEPID &> /dev/null
if [ $? -eq 0 ]; then
echo -n "OneGate Server is still running (PID:$ONEGATEPID). Please "
echo "try 'onegate-proxy stop' first."
exit 1
fi
fi
echo "Stale .lock detected. Erasing it."
rm $ONEGATE_PROXY_LOCK_FILE
fi
}
start()
{
if [ ! -f "$ONEGATE_PROXY_SERVER" ]; then
echo "Cannot find $ONEGATE_PROXY_SERVER."
exit 1
fi
# Start the onegate daemon
touch $ONEGATE_PROXY_LOCK_FILE
ruby $ONEGATE_PROXY_SERVER > $ONEGATE_PROXY_LOG 2>$ONEGATE_PROXY_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then
echo "Error executing onegate-proxy."
echo "Check $ONEGATE_PROXY_LOG_ERROR and $ONEGATE_PROXY_LOG for more information"
exit 1
else
echo $LASTPID > $ONEGATE_PROXY_PID
fi
sleep 1
ps $LASTPID &> /dev/null
if [ $? -ne 0 ]; then
echo "Error executing onegate-proxy."
echo "Check $ONEGATE_PROXY_LOG_ERROR and $ONEGATE_PROXY_LOG for more information"
exit 1
fi
echo "onegate-proxy started"
}
#
# Function that stops the daemon/service
#
stop()
{
if [ ! -f $ONEGATE_PROXY_PID ]; then
echo "Couldn't find onegate-proxy process pid."
exit 1
fi
# Kill the onegate daemon
kill -INT `cat $ONEGATE_PROXY_PID` &> /dev/null
# Remove pid files
rm -f $ONEGATE_PROXY_LOCK_FILE &> /dev/null
rm -f $ONEGATE_PROXY_PID &> /dev/null
echo "onegate-proxy stopped"
}
case "$1" in
start)
setup
start
;;
stop)
stop
;;
restart)
stop
setup
start
;;
*)
echo "Usage: onegate-proxy {start|stop|restart}" >&2
exit 3
;;
esac

@ -0,0 +1,120 @@
#!/bin/sh
# -------------------------------------------------------------------------- #
# Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
set -e
CMD=$(basename ${0})
# file path to the new qemu-kvm symlink
QEMU_ONE="/usr/bin/qemu-kvm-one"
#
# functions
#
print_usage()
{
cat <<EOF
NAME:
${CMD} - System agnostic QEMU/KVM symlink generator
It will try to find a qemu-kvm binary in the system from a list of known
paths and if successful - it will create a proper symlink:
'${QEMU_ONE}'
USAGE:
${CMD} [-f|--force]
Find the system QEMU binary and create the symlink
-f|--force: This option will overwrite existing symlink or file
${CMD} -h|--help
Print this help
EOF
}
#
# main
#
FORCE_CREATE=
case "$1" in
'')
:
;;
-h|--help)
print_usage
exit 0
;;
-f|--force)
FORCE_CREATE=yes
;;
*)
echo "ERROR: ${CMD}: Unknown option '${1}' !" >&2
print_usage >&2
exit 1
;;
esac
# find cpu arch or default to x86_64
if command -v arch >/dev/null 2>&1 ; then
ARCH=$(arch)
else
ARCH="x86_64"
fi
# verify that symlink is not already created
if [ -L "${QEMU_ONE}" ] ; then
# symlink already exists
qemu_target=$(readlink "${QEMU_ONE}")
if [ -e "${qemu_target}" ] && [ -z "${FORCE_CREATE}" ] ; then
# symlink is valid
exit 0
fi
elif [ -e "${QEMU_ONE}" ] ; then
# there is a file of the same name and it is not a symlink
if [ -z "${FORCE_CREATE}" ] ; then
echo "ERROR: ${CMD}: File '${QEMU_ONE}' already exists but it is not a symlink !" >&2
exit 1
else
# --force is used
rm -f "${QEMU_ONE}"
fi
fi
# search the known paths for qemu binary
#
# NOTE: you can add new supported paths here in the future
for QEMU_BIN in \
/usr/libexec/qemu-kvm \
/usr/bin/qemu-kvm \
/usr/bin/qemu-system-${ARCH} \
;
do
if [ -e "${QEMU_BIN}" ] ; then
ln -s ${FORCE_CREATE:+-f} "${QEMU_BIN}" "${QEMU_ONE}"
exit 0
fi
done
# no qemu binary found -> we signal error and exit
echo "ERROR: ${CMD}: No qemu kvm binary found !" >&2
exit 1

@ -0,0 +1,309 @@
#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
# frozen_string_literal: true
# rubocop:disable Lint/MissingCopEnableDirective
# rubocop:disable Lint/RedundantRequireStatement
# rubocop:disable Layout/FirstHashElementIndentation
# rubocop:disable Layout/HashAlignment
# rubocop:disable Layout/HeredocIndentation
# rubocop:disable Layout/IndentationWidth
# rubocop:disable Style/HashSyntax
# rubocop:disable Style/ParallelAssignment
ONE_LOCATION = ENV['ONE_LOCATION']
if !ONE_LOCATION
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION = '/usr/share/one/gems'
ETC_LOCATION = '/etc/one'
REMOTES_LOCATION = '/var/tmp/one'
else
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
ETC_LOCATION = ONE_LOCATION + '/etc'
REMOTES_LOCATION = ONE_LOCATION + '/var/remotes'
end
CONFIGURATION_FILE = REMOTES_LOCATION + '/etc/onegate-proxy.conf'
# %%RUBYGEMS_SETUP_BEGIN%%
if File.directory?(GEMS_LOCATION)
real_gems_path = File.realpath(GEMS_LOCATION)
if !defined?(Gem) || Gem.path != [real_gems_path]
$LOAD_PATH.reject! {|p| p =~ /vendor_ruby/ }
# Suppress warnings from Rubygems
# https://github.com/OpenNebula/one/issues/5379
begin
verb = $VERBOSE
$VERBOSE = nil
require 'rubygems'
Gem.use_paths(real_gems_path)
ensure
$VERBOSE = verb
end
end
end
# %%RUBYGEMS_SETUP_END%%
$LOAD_PATH << RUBY_LIB_LOCATION
require 'async/io'
require 'async/io/stream'
require 'async/io/trap'
require 'etc'
require 'pp'
require 'rb-inotify'
require 'socket'
require 'yaml'
$stdout.sync = true
$stderr.sync = true
DEFAULT_OPTIONS = {
:debug_level => 2, # 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
:process_owner => 'oneadmin',
:onegate_addr => '127.0.0.1',
:onegate_port => '5030',
:service_addr => '169.254.16.9'
}.freeze
# Proxy-class for converting log levels between OpenNebula and
# the socketry/console library. It also splits specific log levels
# into separate stdout and stderr loggers.
class Logger
LOG_LEVEL_MAP = {
0 => '3', # ERROR
1 => '2', # WARN
2 => '1', # INFO
3 => '0' # DEBUG
}.freeze
def initialize(log_level = 2)
@out = Console::Logger.default_logger $stdout, {
'CONSOLE_LEVEL' => LOG_LEVEL_MAP[log_level]
}
@err = Console::Logger.default_logger $stderr, {
'CONSOLE_LEVEL' => LOG_LEVEL_MAP[log_level]
}
end
# rubocop:disable Style/ArgumentsForwarding
def error(*args, &block)
@err.error(*args, &block)
end
def warn(*args, &block)
@err.warn(*args, &block)
end
def info(*args, &block)
@out.info(*args, &block)
end
def debug(*args, &block)
@err.debug(*args, &block)
end
# rubocop:enable Style/ArgumentsForwarding
end
# Class that implements a classic two-way TCP socket proxy (async).
class OneGateProxy
def initialize(options = {})
@options = DEFAULT_OPTIONS.dup.merge! options
@options.each {|k, v| instance_variable_set("@#{k}", v) }
@logger = Logger.new options[:debug_level]
@sigint = Async::IO::Trap.new :INT
@sigint.install!
@inotify = setup_inotify
@inotify_io = Async::IO::Generic.new @inotify.to_io
@proxy_ep = Async::IO::Endpoint.socket setup_socket
end
def run
# NOTE: At this point all config should be set in stone,
# we can drop root privileges..
drop_privileges
Async do |task|
# Make CTRL-C work..
task.async do
@sigint.wait { exit 0 }
end
# Handle filesystem notifications..
task.async do
@inotify.process while @inotify_io.wait_readable
end
glue_peers task
end
end
private
def drop_privileges
new_gid, new_uid = Etc.getpwnam(@process_owner).gid,
Etc.getpwnam(@process_owner).uid
@logger.info(self) do
"Drop root privileges -> #{@process_owner}"
end
Process::Sys.setgid new_gid
Process::Sys.setuid new_uid
end
def setup_inotify
inotify = INotify::Notifier.new
inotify.watch(CONFIGURATION_FILE, :modify) do
@logger.info(self) do
"#{CONFIGURATION_FILE} has been just updated, exiting.."
end
# We assume here that the service will be restarted by
# the service manager.
exit 0
end
inotify
rescue Errno::ENOENT => e
@logger.error(self) do
e.message
end
# We assume here that the service will be restarted by
# the service manager.
exit e.class::Errno
end
def setup_service_addr
# NOTE: We need the service_addr to be defined on one of the interfaces
# inside the host, one natural choice is the loopback interface (lo).
# Effectively we set it once, subsequent restarts of the service should
# honor the idempotence.
ip_address_add_cmd = lambda do |cidr_host, nic_device|
check = "[ -n \"$(ip a s to '#{cidr_host}' dev '#{nic_device}')\" ]"
apply = "ip a a '#{cidr_host}' dev '#{nic_device}'"
"#{check.strip} >/dev/null 2>&1 || #{apply.strip}"
end
system ip_address_add_cmd.call "#{@service_addr}/32", 'lo'
end
def setup_socket(listen = Socket::SOMAXCONN)
# NOTE: Must be executed before calling bind(), otherwise it fails..
setup_service_addr
sock = Socket.new Socket::AF_INET, Socket::SOCK_STREAM, 0
sock.setsockopt Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1
@logger.info(self) do
"Bind #{Addrinfo.tcp(@service_addr, @onegate_port).inspect}"
end
sock.bind Socket.pack_sockaddr_in(@onegate_port, @service_addr)
sock.listen listen
sock
end
def glue_streams(stream1, stream2, task)
Async do
concurrent = []
concurrent << task.async do
while (chunk = stream1.read_partial)
stream2.write chunk
stream2.flush
end
end
concurrent << task.async do
while (chunk = stream2.read_partial)
stream1.write chunk
stream1.flush
end
end
concurrent.each(&:wait)
end
end
def glue_peers(task)
@proxy_ep.accept do |vm_peer|
@logger.debug(self) do
"Accept #{vm_peer.remote_address.inspect}"
end
begin
gate_ep = Async::IO::Endpoint.tcp @onegate_addr,
@onegate_port
gate_ep.connect do |gate_peer|
vm_stream, gate_stream = Async::IO::Stream.new(vm_peer),
Async::IO::Stream.new(gate_peer)
glue_streams(vm_stream, gate_stream, task).wait
@logger.debug(self) do
"Close #{gate_peer.remote_address.inspect}"
end
gate_peer.close
end
rescue Errno::ECONNREFUSED,
Errno::ECONNRESET,
Errno::EHOSTUNREACH,
Errno::ETIMEDOUT => e
@logger.error(self) do
e.message
end
end
@logger.debug(self) do
"Close #{vm_peer.remote_address.inspect}"
end
vm_peer.close
end
end
end
if caller.empty?
options = DEFAULT_OPTIONS.dup
# NOTE: The "CONFIGURATION_FILE" is updated during the host sync procedure.
begin
options.merge! YAML.load_file(CONFIGURATION_FILE)
rescue StandardError => e
warn "Error parsing config file #{CONFIGURATION_FILE}: #{e.message}"
exit 1
end
puts <<~HEADER
--------------------------------------
Proxy configuration
--------------------------------------
#{options.pretty_inspect.strip}
--------------------------------------
HEADER
service = OneGateProxy.new options
service.run
end

@ -1,28 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula noVNC Server"
command="/usr/bin/novnc-server"
command_user="oneadmin:cloud"
supervisor="supervise-daemon"
depend() {
before opennebula-sunstone
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon \
--exec $command \
--user $command_user \
--start -- start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
$command stop
/bin/rm -f /var/lock/one/.novnc.lock
eend $?
}

@ -0,0 +1,57 @@
# Contributor: Santic <email@santic-zombie.ru>
# Maintainer: Santic <email@santic-zombie.ru>
pkgname=opennebula-rubygems
pkgver=6.4.0
pkgrel=1
pkgdesc="Ruby dependencies for OpenNebula (Community Edition)"
url="https://opennebula.io/"
arch="x86_64"
options="!check"
license="Apache"
depends="augeas
augeas-libs
libcurl
libffi
libgcc
libpq
libssl1.1
libstdc++
libxslt
opennebula
ruby
ruby-augeas
ruby-libs
ruby-pg
ruby-rake
sqlite-libs
libxml2"
makedepends="augeas-dev
curl-dev
g++
gcc
libffi-dev
libpq-dev
libxml2-dev
libxslt-dev
make
mariadb-dev
openssl-dev
patch
ruby-dev
sqlite-dev
sudo"
source=""
builddir="$srcdir/"
build() {
cd "opennebula-rubygems-${pkgver}"
bundle config set --local path "$srcdir/gems"
bundle install --gemfile /usr/share/one/Gemfile
}
package() {
cd "opennebula-rubygems-${pkgver}"
install -D -m755 "${srcdir}/opennebula" "${pkgdir}/etc/init.d/opennebula"
}

@ -1,36 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Cloud Scheduler Daemon"
command="/usr/bin/mm_sched"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
after syslog networking netmount opennebula
}
start_pre() {
/bin/mkdir -p /var/log/one
/bin/mkdir -p /var/lock/one
/bin/mkdir -p /run/one
/bin/chown $command_user -R /var/log/one /run/one /var/lock/one
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -1,30 +0,0 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Web UI Server"
command="/usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
after syslog networking netmount opennebula
want opennebula-novnc
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -1,65 +1,77 @@
# Contributor: Santic <email@santic-zombie.ru> # Contributor: Santic <email@santic-zombie.ru>
# Maintainer: Santic <email@santic-zombie.ru> # Maintainer: Santic <email@santic-zombie.ru>
pkgname=opennebula pkgname=opennebula
pkgver=6.2.2 pkgver=6.4.0
pkgrel=1 pkgrel=1
pkgdesc="OpenNebula Server and Scheduler (Community Edition)" pkgdesc="OpenNebula Server and Scheduler (Community Edition)"
url="https://opennebula.io/" url="https://opennebula.io/"
arch="x86_64" arch="x86_64"
options="!check"
license="Apache" license="Apache"
depends="augeas depends="augeas
augeas-libs
curl curl
czmq czmq
g++
gnutls gnutls
libpq g++
libcurl
libffi
libgcc
libvncserver libvncserver
libnsl libnsl
libpg_query libpg_query
libpq
libssl1.1
libstdc++
libxml2
libxslt
logrotate logrotate
ronn
mariadb mariadb
mariadb-client mariadb-client
mariadb-server-utils mariadb-server-utils
npm npm
xmlrpc-c
libxml2
xmlrpc-c
openssl openssl
ruby ruby
ruby-augeas
ruby-bundler
ruby-libs
ruby-nokogiri ruby-nokogiri
ruby-pg
ruby-rexml ruby-rexml
ruby-xmlrpc ruby-xmlrpc
ruby-bundler
ruby-pg
ruby-augeas
shadow shadow
sqlite" sqlite
sqlite-libs
sqlite-static
xmlrpc-c"
makedepends="alpine-sdk makedepends="alpine-sdk
augeas-dev augeas-dev
bash bash
curl-dev
czmq-dev czmq-dev
gnutls-dev gnutls-dev
python2 libnsl-dev
libpq-dev
libvncserver-dev libvncserver-dev
libxml2-dev
linux-headers linux-headers
libnsl-dev
openssl-dev
sqlite-dev
mariadb-dev mariadb-dev
make
openssl-dev
python3
ronn
ruby-dev ruby-dev
libxml2-dev
xmlrpc-c-dev
scons scons
make sqlite-dev
curl-dev xmlrpc-c-dev"
libpq-dev"
install="${pkgname}.pre-install install="${pkgname}.pre-install
${pkgname}.post-install ${pkgname}.post-install
${pkgname}.post-upgrade ${pkgname}.post-upgrade
${pkgname}.pre-deinstall ${pkgname}.pre-deinstall
${pkgname}.post-deinstall" ${pkgname}.post-deinstall"
source="https://github.com/OpenNebula/one/archive/release-${pkgver}.tar.gz source="https://downloads.opennebula.io/packages/opennebula-${pkgver}/opennebula-${pkgver}.tar.gz
Gruntfile.patch
package.patch
svn.patch svn.patch
opennebula opennebula
opennebula-scheduler opennebula-scheduler
@ -74,21 +86,29 @@ source="https://github.com/OpenNebula/one/archive/release-${pkgver}.tar.gz
builddir="$srcdir/" builddir="$srcdir/"
prepare() { prepare() {
cd "one-release-${pkgver}" cd "opennebula-${pkgver}"
patch -p0 < "${srcdir}/Gruntfile.patch"
patch -p0 < "${srcdir}/package.patch"
patch -p0 < "${srcdir}/svn.patch" patch -p0 < "${srcdir}/svn.patch"
npm config set prefix '~/.local/'
prefix=~/.local/ rm -rf "${HOME}/.npm-packages"
npm config set python python2.7 mkdir "${HOME}/.npm-packages"
npm config set prefix "${HOME}/.npm-packages"
NPM_PACKAGES="${HOME}/.npm-packages"
export PATH="$PATH:$NPM_PACKAGES/bin"
npm install bower grunt -g npm install bower grunt -g
} }
build() { build() {
cd "one-release-${pkgver}" cd "opennebula-${pkgver}"
CXXFLAGS="--std=c++14" scons -j2 new_xmlrpc=yes mysql=yes sqlite=yes sunstone=yes systemd=no CXXFLAGS="--std=c++14" scons -j2 new_xmlrpc=yes mysql=yes sqlite=yes sunstone=yes systemd=no
} }
package() { package() {
cd "one-release-${pkgver}" cd "opennebula-${pkgver}"
install -D -m755 "${srcdir}/opennebula" "${pkgdir}/etc/init.d/opennebula" install -D -m755 "${srcdir}/opennebula" "${pkgdir}/etc/init.d/opennebula"
install -D -m755 "${srcdir}/opennebula-scheduler" "${pkgdir}/etc/init.d/opennebula-scheduler" install -D -m755 "${srcdir}/opennebula-scheduler" "${pkgdir}/etc/init.d/opennebula-scheduler"
@ -102,17 +122,3 @@ package() {
DESTDIR="${pkgdir}" ./install.sh -u oneadmin -g cloud DESTDIR="${pkgdir}" ./install.sh -u oneadmin -g cloud
} }
sha512sums="
292a1a3a823d4ec3e6cdec59b0f9fbf81125d0541bc8a2e234343f59fc9c4e7f2f2f1cd14463211a8c750bb902021dc1389a47927ad491a1cee2fa064307e813 release-6.2.2.tar.gz
1e2c5da5c2ab49ab355550568985cc538d591198343ec468277d0bb5106275fb4cf7e2acdc26868c79803313a4aec935568370b723bce3384c7e056f26fa9066 svn.patch
121d43da2299a8f347dfff2124253617d2d4f175bafe5f14687a58e72ada60f08fbdcba1b5dbdc48434c226a6f75b46eb2e9203f8549733d1393ca348f5a00ff opennebula
c3d85c11a1e6f9ae05a45378ba398ac68ee2a8b961f0f24e394bbdf92c83c8fcc64c5619819afc1b2e563607e99bd6402744fba396bd3c6c4f48c0a8b09f897e opennebula-scheduler
6c5127d4b515777bba83236623066f300f0f8a6086a19848b72edb9cdb74fd906595d02b971de91d67585e79d8d419e5a66d3cc69c55d898561c4a5f74a303d3 opennebula-novnc
99510f519200d16b65c6fef50cfbc6f88950453759b8e2eab3e729bc8329fbb605dbe7fa6c11febccac6ded0cd1328aef9d1137028a0083e0a9de0a51d357dfc opennebula-sunstone
17a0d28b60301c59fc4a6fbeaf759c5d075981b000ef93f67e151f16c0ec339de3e0b4b6ead1ca33903428394abdea40eac907a419f136ba7a1b6fa8965e1422 opennebula-hem
1ac94e85f3ebe43e51d87a75560d7d7aa48f291326d7b049381329435a7ed575fbfd1dbf23ff9c055bbb900994aa61885a2b7efb7c3e92c21d1d203b8d047231 opennebula-flow
fdb1eeacb5767cae78829295551a0e924e31d6b47f899fb341652607b8efe5b630c0233835e940f5d8577632d223ab46a87eee2ebce36a1b43077aa561ac47e3 opennebula-gate
121d43da2299a8f347dfff2124253617d2d4f175bafe5f14687a58e72ada60f08fbdcba1b5dbdc48434c226a6f75b46eb2e9203f8549733d1393ca348f5a00ff opennebula-ssh-agent
a6c33276b527e8aafd39815688dbdf8dbfaa4e1ab5b708e44b48c6b358bba2dd4c2225a7e4647b438a2396ed6fd159a3421fe2798f0f954e250d3bef8a57a742 opennebula.logrotate
"

@ -0,0 +1,22 @@
Index: src/sunstone/public/Gruntfile.js
--- src/sunstone/public/Gruntfile.js
+++ src/sunstone/public/Gruntfile.js
@@ -14,6 +14,8 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
+const sass = require('node-sass');
+
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
@@ -24,7 +26,8 @@
},
dist: {
options: {
- outputStyle: "compressed"
+ outputStyle: "compressed",
+ implementation: sass
},
files: {
"css/app.css": "scss/app.scss"

@ -0,0 +1,48 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula management"
command="/usr/bin/oned"
command_args="-f"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need mariadb
after syslog networking localmount netmount
before opennebula-scheduler opennebula-hem opennebula-sunstone \
opennebula-flow opennebula-gate
# opennebula-ssh-agent
}
start_pre() {
/bin/mkdir -p /var/log/one
/bin/mkdir -p /var/lock/one
/bin/mkdir -p /run/one
/bin/chown $command_user -R /var/log/one /run/one /var/lock/one
/usr/sbin/logrotate -s /tmp/logrotate.state -f /etc/logrotate.d/opennebula.logrotate
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start -- $command_args
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--retry TERM/10/KILL/10 \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}
stop_post() {
/bin/rm -f /var/lock/one/one
/usr/share/one/follower_cleanup
}

@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Flow Service"
command="/usr/bin/ruby /usr/lib/one/oneflow/oneflow-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Gate Daemon"
command="/usr/bin/ruby /usr/lib/one/onegate/onegate-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Hook Execution Service"
command="/usr/bin/ruby /usr/lib/one/onehem/onehem-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -0,0 +1,28 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula noVNC Server"
command="/usr/bin/novnc-server"
command_user="oneadmin:cloud"
supervisor="supervise-daemon"
depend() {
before opennebula-sunstone
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon \
--exec $command \
--user $command_user \
--start -- start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
$command stop
/bin/rm -f /var/lock/one/.novnc.lock
eend $?
}

@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Cloud Scheduler Daemon"
command="/usr/bin/mm_sched"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -23,24 +23,24 @@ start_pre() {
} }
start() { start() {
ebegin "Starting $RC_SVCNAME" ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \ start-stop-daemon --background \
--exec $command \ --exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \ --make-pidfile --pidfile $pidfile --user $command_user \
--start -- $command_args --start -- $command_args
eend $? eend $?
} }
stop() { stop() {
ebegin "Stopping $RC_SVCNAME" ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \ start-stop-daemon --stop \
--retry TERM/10/KILL/10 \ --retry TERM/10/KILL/10 \
--exec $command \ --exec $command \
--pidfile $pidfile --user $command_user --pidfile $pidfile --user $command_user
eend $? eend $?
} }
stop_post() { stop_post() {
/bin/rm -f /var/lock/one/one /bin/rm -f /var/lock/one/one
/usr/share/one/follower_cleanup /usr/share/one/follower_cleanup
} }

@ -0,0 +1,31 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Web UI Server"
command="/usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
want opennebula-novnc
}
start() {
ebegin "Starting $RC_SVCNAME"
start-stop-daemon --background \
--exec $command \
--make-pidfile --pidfile $pidfile --user $command_user \
--start
eend $?
}
stop() {
ebegin "Stopping $RC_SVCNAME"
start-stop-daemon --stop \
--exec $command \
--pidfile $pidfile --user $command_user
eend $?
}

@ -0,0 +1,13 @@
Index: src/sunstone/public/package.json
--- src/sunstone/public/package.json
+++ src/sunstone/public/package.json
@@ -6,7 +6,7 @@
"grunt-cli": "1.3.2",
"grunt-contrib-requirejs": "1.0.0",
"grunt-contrib-watch": "1.1.0",
- "grunt-sass": "2.1.0",
- "node-sass": "4.14.1"
+ "grunt-sass": "3.1.0",
+ "node-sass": "7.0.1"
}
}

@ -0,0 +1,82 @@
Some notes
```
adduser oneadmin
apk add libvncserver-dev libvncserver \
gnutls gnutls-dev libnsl libnsl-dev \
alpine-sdk linux-headers openssl-dev \
make npm ronn sqlite-dev czmq-dev \
mariadb-dev mariadb-server-utils mariadb-client \
ruby-dev libxml2 libxml2-dev libxml2 libxml2-dev \
xmlrpc-c xmlrpc-c-dev g++ scons bash
apk add python2 ruby-nokogiri ruby-rexml \
ruby-xmlrpc ruby-bundler ruby-pg ruby-augeas augeas-dev \
libpg_query curl-dev libpq-dev
git clone https://github.com/OpenNebula/one.git
cd one
vim src/svncterm_server/genfont.c
```
#include <stdint.h>
typedef uint16_t u_int16_t;
```
#scons -j2 sqlite=no mysql=yes systemd=no svncterm=yes
npm config set python python2.7
npm install bower grunt -g
CXXFLAGS="--std=c++14" scons -j2 new_xmlrpc=yes mysql=yes sqlite=yes sunstone=yes systemd=no
cd /root/one/share/man/
./build.sh
cd ~/one/src/fireedge/
./build.sh
cd ~/one
./install.sh -u oneadmin -g oneadmin
# from local user
bundler install --gemfile /usr/share/one/Gemfile
apk add shadow
usermod -m -d /var/lib/one oneadmin
mkdir -p /var/lib/one/.one/
echo 'oneadmin:oneadm1n' >> /var/lib/one/.one/one_auth
chown oneadmin:oneadmin -R /var/log/one /var/lib/one /run/one /run/lock/one
###########################################
!!! apt install libczmq-dev !!!
apk add python2
npm config set python python2.7
cd /usr/lib/one/sunstone/public
CXXFLAGS="--std=c++14" npm install
# не обязательно(?)
npm audit fix --force
./build
echo 'oneadmin:black' > /var/lib/one/.one/one_auth
```
Loading…
Cancel
Save