Skip to content

Commit

Permalink
Merge pull request #6 from kvaps/release-5.12
Browse files Browse the repository at this point in the history
Release 5.12
  • Loading branch information
kvaps authored Jul 22, 2021
2 parents dd6da3e + 41fd649 commit 4a89717
Show file tree
Hide file tree
Showing 28 changed files with 613 additions and 800 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,29 @@ then disable debug

## Upgrade notes

The minor upgrades can be performed by standard way using rolling update, however major updates should be performed by fully chart reinstallation.
You have to remove the old chart, and install new one, however your data should be saved on persistent volumes, thus new images will perform database migration on their first start.
```
kubectl get pod -n opennebula -l role=leader
```

Perform backup:
```bash
# Find the leader pod
kubectl get pod -l role=leader
# Perform the backup
kubectl exec <leader_pod> -c oned -- bash -c 'mysqldump -h$DB_SERVER -u$DB_USER -p$DB_PASSWORD $DB_NAME | gzip -9' > backup.sql.gz
```
kubectl exec -n opennebula -c oned <leader_pod> -- sh -c 'mysqldump -h$DB_SERVER -u$DB_USER -p$DB_PASSWD $DB_NAME | gzip -9' > opennebula-db.sql.gz
```

**To restore**, redeploy release with `--set oned.debug=true` and:
```
kubectl exec -n opennebula -i -c oned <each_oned_pod> -- sh -c 'zcat | mysql -h$DB_SERVER -u$DB_USER -p$DB_PASSWD -D$DB_NAME' < opennebula-db.sql.gz
```

then disable debug


## Upgrade notes

The minor upgrades can be performed by standard way using rolling update, however major updates must be performed by fully chart reinstallation.
You have to remove the old chart, and install new one. No worry as your data should be saved on persistent volumes, thus new images will perform database migration on their first start.

> **Warning:** Don't forget to make backup before the upgrade!
Minor upgrade:
```bash
Expand Down
8 changes: 0 additions & 8 deletions dockerfiles/build.sh

This file was deleted.

111 changes: 10 additions & 101 deletions dockerfiles/opennebula-exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,119 +1,28 @@
# ------------------------------------------------------------------------------
# Common part
# ------------------------------------------------------------------------------
FROM ubuntu:20.04

# === Stage 1 ===

FROM ubuntu:18.04 as builder

# Setup environment variables
ENV VERSION=5.10.5 \
PKG_VERSION=1 \
CONTACT="Unsupported Community Build" \
GIT_VERSION="not known" \
DISTRO=ubuntu1804

# Install build dependencies
RUN apt-get update \
&& apt-get install -y debhelper ubuntu-dev-tools bash-completion \
bison default-jdk flex javahelper libxmlrpc3-client-java \
libxmlrpc3-common-java libxml2-dev ruby scons dh-systemd \
npm ruby-ronn rename

# Download sources
RUN wget -q -O - https://github.com/OpenNebula/one/archive/release-$VERSION.tar.gz | tar xzf - \
&& mv /one-release-$VERSION /opennebula-$VERSION \
&& wget -q -O - https://github.com/kvaps/packages/archive/release-$VERSION.tar.gz | tar xzf - \
&& mv /packages-release-$VERSION /packages-$VERSION

WORKDIR /opennebula-$VERSION

# Apply patches
RUN wget -q -O - https://github.com/OpenNebula/one/pull/4585.diff | patch -p1

# Build docs
RUN cd share/man \
&& ./build.sh

# Build Sunstone
RUN cd src/sunstone/public \
&& ./build.sh -d \
&& export PATH=$PATH:$PWD/node_modules/.bin \
&& ./build.sh \
&& rm -rf node_modules/

# Prepare sources
RUN tar -czf /opennebula_$VERSION.orig.tar.gz . \
&& cp -r /packages-$VERSION/templates/$DISTRO/ debian \
&& wget -q http://downloads.opennebula.org/extra/xmlrpc-c.tar.gz \
&& tar -czf build_opennebula.tar.gz -C /packages-$VERSION/sources build_opennebula.sh xml_parse_huge.patch

# Build Ruby gems
RUN "/packages-$VERSION/rubygems/build.sh" \
"/opennebula_$VERSION.orig.tar.gz" \
"/" \
"$(echo ${DISTRO} | sed 's/\b./\u\0/g')" \
"${VERSION}-${PKG_VERSION}" \
"${CONTACT}"

# Generate requirements for all Ruby gem packages and process control template
RUN for F in /opennebula-rubygem-*.deb; do \
_NAME=$(dpkg-deb -f "${F}" Package); \
_VERS=$(dpkg-deb -f "${F}" Version); \
RUBYGEMS_REQ="${RUBYGEMS_REQ}${_NAME} (= ${_VERS}), "; \
done \
&& m4 -D_VERSION_="${VERSION}" \
-D_PKG_VERSION_="${PKG_VERSION}" \
-D_CONTACT_="${CONTACT}" \
-D_DATE_="${DATE}" \
-D_RUBYGEMS_REQ_="${RUBYGEMS_REQ}" \
-D_WITH_RUBYGEMS_ \
debian/control.m4 > debian/control

# Generate changelog
RUN printf '%s\n\n' \
"opennebula (${VERSION}-${PKG_VERSION}) unstable; urgency=low" \
" * Build for ${VERSION}-${PKG_VERSION} (Git revision ${GIT_VERSION})" \
" -- ${CONTACT} $(date -R)" \
> debian/changelog

# Generate gitversion
RUN echo "${GIT_VERSION}" > debian/gitversion

# Build source package
RUN dpkg-source --include-binaries -b .

# Install dependencies
RUN apt-get install -y $(dpkg-checkbuilddeps 2>&1 | sed 's/.*Unmet build dependencies: //')

# Build binary package
RUN dpkg-buildpackage -us -uc

# === Stage 2 ===

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

# Install opennebula-common and rubygems
COPY --from=builder /opennebula-common_*.deb /ruby-opennebula_*_all.deb /opennebula-tools_*.deb /opennebula-rubygem*.deb /packages/
COPY --from=ghcr.io/kvaps/opennebula-packages:v5.12.0.4 /packages/opennebula-common_*.deb /packages/ruby-opennebula_*_all.deb /packages/opennebula-tools_*.deb /packages/opennebula-rubygems_*.deb /packages/opennebula-common-onescape_*.deb /packages/
RUN apt-get update \
&& ln -s /bin/true /usr/bin/systemd-tmpfiles \
&& apt-get -y install /packages/*.deb \
&& mkdir -p /var/log/one /var/lock/one /var/run/one \
&& apt-get -y clean \
&& chown oneadmin: /var/log/one /var/lock/one /var/run/one /var/run/one
&& rm -rf /var/lib/apt/lists/ \
&& chown oneadmin: /var/log/one /var/lock/one /var/run/one

# Logging to stdout
RUN for i in oned.log sched.log onehem.log sunstone.log novnc.log onegate.log oneflow.log; do ln -sf "/proc/1/fd/1" "/var/log/one/$i"; done

# ------------------------------------------------------------------------------
# Specific part
# ------------------------------------------------------------------------------

# Install opennebula-exporter dependencies
RUN apt-get update \
&& apt-get -y install xmlstarlet \
&& apt-get -y clean
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/

COPY --from=prom/node-exporter:v0.18.1 /bin/node_exporter /bin/node_exporter
ADD https://raw.githubusercontent.com/kvaps/opennebula-exporter/7b4c10ec07377d1b4b9094020c856b0b6c0b5c73/opennebula_exporter /bin/opennebula_exporter
ADD https://raw.githubusercontent.com/kvaps/opennebula-exporter/7b4c10ec07377d1b4b9094020c856b0b6c0b5c73/opennebula_exporter /usr/bin/opennebula_exporter
RUN chmod 755 /bin/opennebula_exporter \
&& mkdir -p /metrics \
&& chown oneadmin:oneadmin /metrics
Expand Down
112 changes: 9 additions & 103 deletions dockerfiles/opennebula-flow/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,121 +1,27 @@
# ------------------------------------------------------------------------------
# Common part
# ------------------------------------------------------------------------------
FROM ubuntu:20.04

# === Stage 1 ===

FROM ubuntu:18.04 as builder

# Setup environment variables
ENV VERSION=5.10.5 \
PKG_VERSION=1 \
CONTACT="Unsupported Community Build" \
GIT_VERSION="not known" \
DISTRO=ubuntu1804

# Install build dependencies
RUN apt-get update \
&& apt-get install -y debhelper ubuntu-dev-tools bash-completion \
bison default-jdk flex javahelper libxmlrpc3-client-java \
libxmlrpc3-common-java libxml2-dev ruby scons dh-systemd \
npm ruby-ronn rename

# Download sources
RUN wget -q -O - https://github.com/OpenNebula/one/archive/release-$VERSION.tar.gz | tar xzf - \
&& mv /one-release-$VERSION /opennebula-$VERSION \
&& wget -q -O - https://github.com/kvaps/packages/archive/release-$VERSION.tar.gz | tar xzf - \
&& mv /packages-release-$VERSION /packages-$VERSION

WORKDIR /opennebula-$VERSION

# Apply patches
RUN wget -q -O - https://github.com/OpenNebula/one/pull/4585.diff | patch -p1

# Build docs
RUN cd share/man \
&& ./build.sh

# Build Sunstone
RUN cd src/sunstone/public \
&& ./build.sh -d \
&& export PATH=$PATH:$PWD/node_modules/.bin \
&& ./build.sh \
&& rm -rf node_modules/

# Prepare sources
RUN tar -czf /opennebula_$VERSION.orig.tar.gz . \
&& cp -r /packages-$VERSION/templates/$DISTRO/ debian \
&& wget -q http://downloads.opennebula.org/extra/xmlrpc-c.tar.gz \
&& tar -czf build_opennebula.tar.gz -C /packages-$VERSION/sources build_opennebula.sh xml_parse_huge.patch

# Build Ruby gems
RUN "/packages-$VERSION/rubygems/build.sh" \
"/opennebula_$VERSION.orig.tar.gz" \
"/" \
"$(echo ${DISTRO} | sed 's/\b./\u\0/g')" \
"${VERSION}-${PKG_VERSION}" \
"${CONTACT}"

# Generate requirements for all Ruby gem packages and process control template
RUN for F in /opennebula-rubygem-*.deb; do \
_NAME=$(dpkg-deb -f "${F}" Package); \
_VERS=$(dpkg-deb -f "${F}" Version); \
RUBYGEMS_REQ="${RUBYGEMS_REQ}${_NAME} (= ${_VERS}), "; \
done \
&& m4 -D_VERSION_="${VERSION}" \
-D_PKG_VERSION_="${PKG_VERSION}" \
-D_CONTACT_="${CONTACT}" \
-D_DATE_="${DATE}" \
-D_RUBYGEMS_REQ_="${RUBYGEMS_REQ}" \
-D_WITH_RUBYGEMS_ \
debian/control.m4 > debian/control

# Generate changelog
RUN printf '%s\n\n' \
"opennebula (${VERSION}-${PKG_VERSION}) unstable; urgency=low" \
" * Build for ${VERSION}-${PKG_VERSION} (Git revision ${GIT_VERSION})" \
" -- ${CONTACT} $(date -R)" \
> debian/changelog

# Generate gitversion
RUN echo "${GIT_VERSION}" > debian/gitversion

# Build source package
RUN dpkg-source --include-binaries -b .

# Install dependencies
RUN apt-get install -y $(dpkg-checkbuilddeps 2>&1 | sed 's/.*Unmet build dependencies: //')

# Build binary package
RUN dpkg-buildpackage -us -uc

# === Stage 2 ===

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

# Install opennebula-common and rubygems
COPY --from=builder /opennebula-common_*.deb /ruby-opennebula_*_all.deb /opennebula-tools_*.deb /opennebula-rubygem*.deb /packages/
COPY --from=ghcr.io/kvaps/opennebula-packages:v5.12.0.4 /packages/opennebula-common_*.deb /packages/ruby-opennebula_*_all.deb /packages/opennebula-tools_*.deb /packages/opennebula-rubygems_*.deb /packages/opennebula-common-onescape_*.deb /packages/
RUN apt-get update \
&& ln -s /bin/true /usr/bin/systemd-tmpfiles \
&& apt-get -y install /packages/*.deb \
&& mkdir -p /var/log/one /var/lock/one /var/run/one \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/ \
&& chown oneadmin: /var/log/one /var/lock/one /var/run/one

# Logging to stdout
RUN for i in oned.log sched.log onehem.log sunstone.log novnc.log onegate.log oneflow.log; do ln -sf "/proc/1/fd/1" "/var/log/one/$i"; done

# ------------------------------------------------------------------------------
# Specific part
# ------------------------------------------------------------------------------

# Install opennebula-flow
COPY --from=builder /opennebula-flow_*.deb /packages/
COPY --from=ghcr.io/kvaps/opennebula-packages:v5.12.0.4 /packages/opennebula-flow_*.deb /packages/opennebula_*.deb /packages/
RUN apt-get -y update \
&& ln -s /bin/true /usr/bin/systemd-tmpfiles \
&& dpkg -i packages/opennebula-flow_*.deb || true \
&& apt-get -yf install \
&& apt-get -y install /packages/opennebula-flow_*.deb /packages/opennebula_*.deb \
&& rm -f /usr/bin/systemd-tmpfiles \
&& apt-get -y clean
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/

# Fix permissions
RUN chown -R oneadmin:oneadmin /etc/one
Expand Down
Loading

0 comments on commit 4a89717

Please sign in to comment.