From 01f721787847c016f025cefcd72bc63c54211a47 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 22 Jun 2023 15:03:16 +0200 Subject: [PATCH] queueserver as debian package --- qserv-deploy/.gitignore | 4 + qserv-deploy/pom.xml | 127 ++++++++++++++++++ qserv-deploy/src/deb/bin/qserv.sh | 3 + qserv-deploy/src/deb/control/control | 9 ++ qserv-deploy/src/deb/etc/jndi.properties | 3 + qserv-deploy/src/deb/etc/logging.properties | 33 +++++ qserv-deploy/src/deb/etc/qserv.properties | 12 ++ .../de/hsadmin/core/qserv/QueueServer.java | 12 +- 8 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 qserv-deploy/.gitignore create mode 100644 qserv-deploy/pom.xml create mode 100755 qserv-deploy/src/deb/bin/qserv.sh create mode 100644 qserv-deploy/src/deb/control/control create mode 100644 qserv-deploy/src/deb/etc/jndi.properties create mode 100644 qserv-deploy/src/deb/etc/logging.properties create mode 100644 qserv-deploy/src/deb/etc/qserv.properties diff --git a/qserv-deploy/.gitignore b/qserv-deploy/.gitignore new file mode 100644 index 0000000..d98981c --- /dev/null +++ b/qserv-deploy/.gitignore @@ -0,0 +1,4 @@ +/target/ +/.classpath +/.project +/.settings/ diff --git a/qserv-deploy/pom.xml b/qserv-deploy/pom.xml new file mode 100644 index 0000000..0182bbc --- /dev/null +++ b/qserv-deploy/pom.xml @@ -0,0 +1,127 @@ + + 4.0.0 + de.hsadmin + hsadmin-qserv + 4.0.6 + jar + + HSAdmin-QServ + + + + de.hsadmin.core + hsadmin-qserv + 4.0.6 + + + org.apache.activemq + activemq-client + 5.18.1 + + + mysql + mysql-connector-java + 8.0.33 + + + org.postgresql + postgresql + 42.6.0 + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + de.hsadmin.core.qserv.QueueServer + + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + org.vafer + jdeb + 1.5 + + true + + + + ${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar + hsadmin-qserv-full.jar + file + + perm + /usr/local/lib/hostsharing/hsadmin + + + + src/deb/bin/qserv.sh + file + + perm + /usr/local/sbin + 744 + + + + src/deb/etc/jndi.properties + file + + perm + /etc/hsadmin/qserv + 640 + + + + src/deb/etc/logging.properties + file + + perm + /etc/hsadmin/qserv + 640 + + + + src/deb/etc/qserv.properties + file + + perm + /etc/hsadmin/qserv + 640 + + + + + + + make-jdeb + package + + jdeb + + + + + + hsadmin-qserv + + diff --git a/qserv-deploy/src/deb/bin/qserv.sh b/qserv-deploy/src/deb/bin/qserv.sh new file mode 100755 index 0000000..94d7461 --- /dev/null +++ b/qserv-deploy/src/deb/bin/qserv.sh @@ -0,0 +1,3 @@ +#!/bin/bash +JAVA_OPTS="-Xbootclasspath/a:/etc/hsadmin/qserv/" +/usr/bin/java $JAVA_OPTS -jar /usr/local/lib/hostsharing/hsadmin/hsadmin-qserv-full.jar /etc/hsadmin/qserv/qserv.properties \ No newline at end of file diff --git a/qserv-deploy/src/deb/control/control b/qserv-deploy/src/deb/control/control new file mode 100644 index 0000000..2392bc3 --- /dev/null +++ b/qserv-deploy/src/deb/control/control @@ -0,0 +1,9 @@ +Package: hsadmin-qserv +Version: [[version]] +Section: misc +Priority: optional +Architecture: all +Depends: default-jre +Maintainer: Peter Hormanns +Description: hostsharing hsadmin queue worker +Distribution: hostsharing diff --git a/qserv-deploy/src/deb/etc/jndi.properties b/qserv-deploy/src/deb/etc/jndi.properties new file mode 100644 index 0000000..85b5b1b --- /dev/null +++ b/qserv-deploy/src/deb/etc/jndi.properties @@ -0,0 +1,3 @@ +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=ssl://hsh02.hostsharing.net:61617 +connectionFactoryNames=QueueCF diff --git a/qserv-deploy/src/deb/etc/logging.properties b/qserv-deploy/src/deb/etc/logging.properties new file mode 100644 index 0000000..9dc46b8 --- /dev/null +++ b/qserv-deploy/src/deb/etc/logging.properties @@ -0,0 +1,33 @@ +# Der ConsoleHandler gibt die Nachrichten auf std.err aus +.handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler + +# Festlegen des Standard Loglevels +.level=INFO + + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# Die Nachrichten in eine Datei im Log-Verzeichnis schreiben +java.util.logging.FileHandler.pattern=hsar-qserv.log +java.util.logging.FileHandler.limit=500000 +java.util.logging.FileHandler.count=5 +java.util.logging.FileHandler.level=ALL +java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter + +# Zusätzlich zu den normalen Logleveln kann für jeden Handler noch ein eigener Filter +# vergeben werden. Das ist nützlich wenn beispielsweise alle Nachrichten auf der Konsole ausgeben werden sollen +# aber nur ab INFO in das Logfile geschrieben werden soll. +java.util.logging.ConsoleHandler.level=INFO +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter + + +############################################################ +# Extraeinstellungen für einzelne Logger +############################################################ + +# Für einzelne Logger kann ein eigenes Loglevel festgelegt werden. +de.hsadmin.core.qserv.level = FINEST + diff --git a/qserv-deploy/src/deb/etc/qserv.properties b/qserv-deploy/src/deb/etc/qserv.properties new file mode 100644 index 0000000..3cfa6a2 --- /dev/null +++ b/qserv-deploy/src/deb/etc/qserv.properties @@ -0,0 +1,12 @@ +hsadmin.jms.factory=QueueCF +hsadmin.jms.status-queue=hsadminStatus +hsadmin.jms.system-queue=hsadminSystem-h98 +hsadmin.jms.username=user-h98 +hsadmin.jms.password=**** +hsadmin.log.config=conf/logging.properties +hsadmin.log.email=service@hostsharing.net +hsadmin.log.from=qserv@h98.hostsharing.net +mysqladmin.user=root +mysqladmin.password=**** +pgsqladmin.user=postgres +pgsqladmin.password=**** diff --git a/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java b/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java index 5a5b8f1..76b0157 100644 --- a/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java +++ b/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java @@ -52,7 +52,13 @@ public class QueueServer extends QueueCommons implements MessageListener, Except throw new Exception(userHelp(propFile)); } } - FileInputStream propStream = new FileInputStream(propFile); + FileInputStream propStream = null; + try { + propStream = new FileInputStream(propFile); + } catch (Exception e) { + System.out.println("couldn't read config file " + propFile.getAbsolutePath()); + System.exit(1); + } Properties props = new Properties(System.getProperties()); props.load(propStream); propStream.close(); @@ -105,7 +111,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except private void setServiceEMail(String emailAddress) { if (emailAddress == null || emailAddress.isEmpty()) { - serviceEMail = "peter@ostwall195.de"; + serviceEMail = "service@example.com"; } else { serviceEMail = emailAddress; } @@ -113,7 +119,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except private void setFromEMail(String emailAddress) { if (emailAddress == null || emailAddress.isEmpty()) { - fromEMail = "hsadmin@hostsharing.net"; + fromEMail = "hsadmin@example.com"; } else { fromEMail = emailAddress; }