queueserver as debian package

This commit is contained in:
Peter Hormanns 2023-06-22 15:03:16 +02:00
parent 2dd11948ad
commit 01f7217878
8 changed files with 200 additions and 3 deletions

4
qserv-deploy/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/target/
/.classpath
/.project
/.settings/

127
qserv-deploy/pom.xml Normal file
View File

@ -0,0 +1,127 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.6</version>
<packaging>jar</packaging>
<name>HSAdmin-QServ</name>
<dependencies>
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>5.18.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>de.hsadmin.core.qserv.QueueServer</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>1.5</version>
<configuration>
<verbose>true</verbose>
<dataSet>
<data>
<src>
${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</src>
<dst>hsadmin-qserv-full.jar</dst>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/local/lib/hostsharing/hsadmin</prefix>
</mapper>
</data>
<data>
<src>src/deb/bin/qserv.sh</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/local/sbin</prefix>
<filemode>744</filemode>
</mapper>
</data>
<data>
<src>src/deb/etc/jndi.properties</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/hsadmin/qserv</prefix>
<filemode>640</filemode>
</mapper>
</data>
<data>
<src>src/deb/etc/logging.properties</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/hsadmin/qserv</prefix>
<filemode>640</filemode>
</mapper>
</data>
<data>
<src>src/deb/etc/qserv.properties</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/hsadmin/qserv</prefix>
<filemode>640</filemode>
</mapper>
</data>
</dataSet>
</configuration>
<executions>
<execution>
<id>make-jdeb</id>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>hsadmin-qserv</finalName>
</build>
</project>

View File

@ -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

View File

@ -0,0 +1,9 @@
Package: hsadmin-qserv
Version: [[version]]
Section: misc
Priority: optional
Architecture: all
Depends: default-jre
Maintainer: Peter Hormanns <peter.hormanns@hostsharing.net>
Description: hostsharing hsadmin queue worker
Distribution: hostsharing

View File

@ -0,0 +1,3 @@
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=ssl://hsh02.hostsharing.net:61617
connectionFactoryNames=QueueCF

View File

@ -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

View File

@ -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=****

View File

@ -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;
}