Skip to content
Permalink
Browse files

Merge pull request #2560 from OpenNMS/jira/NMS-12133

NMS-12133: Allow to install Horizon from a tarball
  • Loading branch information...
indigo423 committed Jul 9, 2019
2 parents fbfe86a + 0a41d1d commit 3822aa86c063ef30d7de6bd205a8ffe9258cb0e0
Showing with 24 additions and 7 deletions.
  1. +1 −0 .gitignore
  2. +15 −6 opennms-container/horizon/Dockerfile
  3. +1 −0 opennms-container/horizon/tarball/.gitkeep
  4. +7 −1 smoke-test/README.md
@@ -38,6 +38,7 @@ yarn-error.log
# Ignore Docker OCI image files
*.oci
opennms-container/horizon/rpms/*.rpm
opennms-container/horizon/tarball/*.tar.gz
opennms-container/minion/rpms/*.rpm
opennms-container/sentinel/rpms/*.rpm

@@ -33,24 +33,33 @@ ARG ONMS_PACKAGES="opennms-core opennms-webapp-jetty opennms-webapp-remoting ope
ARG ADD_YUM_PACKAGES

COPY ./rpms /tmp/rpms
COPY ./tarball /tmp/tarball

SHELL ["/bin/bash", "-c"]

# Install repositories, system and OpenNMS packages and do some cleanup
RUN if [[ "$(ls -1 /tmp/rpms/*.rpm 2>/dev/null | wc -l)" != 0 ]]; then yum -y localinstall /tmp/rpms/*.rpm; else yum install -y ${ONMS_PACKAGES}; fi && \
# 1. Try to install from tarball
# 2. Try to install from local RPMS
# 3. Try to install from public yum repository
RUN if [[ "$(ls -1 /tmp/tarball/*.tar.gz 2>/dev/null | wc -l)" != 0 ]]; then \
mkdir -p /opt/opennms && tar xzf /tmp/tarball/opennms-*.tar.gz -C /opt/opennms && \
cp -r /opt/opennms/etc /opt/opennms/share/etc-pristine; \
elif [[ "$(ls -1 /tmp/rpms/*.rpm 2>/dev/null | wc -l)" != 0 ]]; then \
yum -y localinstall /tmp/rpms/*.rpm; \
else yum install -y ${ONMS_PACKAGES}; fi && \
if [[ -n ${ADD_YUM_PACKAGES} ]]; then yum -y install ${ADD_YUM_PACKAGES}; fi && \
rm -rf /tmp/rpms && \
rm -rf /tmp/rpms /tmp/tarball && \
yum clean all && \
rm -rf /var/cache/yum && \
rm -rf /opt/opennms/logs \
/var/opennms/rrd \
/var/opennms/reports && \
/opt/opennms/share/rrd \
/opt/opennms/share/reports && \
mkdir -p /opennms-data/logs \
/opennms-data/rrd \
/opennms-data/reports && \
ln -s /opennms-data/logs /opt/opennms/logs && \
ln -s /opennms-data/rrd /var/opennms/rrd && \
ln -s /opennms-data/reports /var/opennms/reports
ln -s /opennms-data/rrd /opt/opennms/share/rrd && \
ln -s /opennms-data/reports /opt/opennms/share/reports

# Add templates replaced at runtime and entrypoint
COPY ./assets/*.tpl /root/
@@ -0,0 +1 @@
gitkeep
@@ -68,6 +68,12 @@ To fix this issue you have change the tmpdir path for Java with:
mvn -DskipITs=false integration-test -Djava.io.tmpdir=/tmp
```

### Run tests from local tarball

If you have the code compiled and assembled locally, you can use the tarball build for container images, so you don't have to wait for the CI/CD to download the container image artifact.
Drop the assembled OpenNMS-tar.gz file in `opennms-container/horizon/tarball` and run `docker build -t horizon .`
Smoke tests will run the image named `horizon` in your local Docker image repo.

## Writing system tests

When writing a new test, use the stack rule to setup the environment:
@@ -108,7 +114,7 @@ If a test is failing and we have a patched .jar we want to deploy, how can we re
#### OSGi

1. Link m2s by setting `-Dorg.opennms.dev.m2=/home/jesse/.m2/repository`
1. Set a breakpoink in the test before the exercised feature is used and re-run it in debug mode
2. Set a breakpoink in the test before the exercised feature is used and re-run it in debug mode
3. Reload the bundles in Karaf using: `bundle:watch *`

#### Filesystem

0 comments on commit 3822aa8

Please sign in to comment.
You can’t perform that action at this time.