Added service file

Created build config
Changed default port
This commit is contained in:
genuineparts 2024-10-29 18:49:00 +01:00
parent 5565fd2201
commit 67866265ba
3 changed files with 65 additions and 3 deletions

14
OebbApi.service Normal file
View file

@ -0,0 +1,14 @@
[Unit]
Description=A App reading and Collating OEBB Delays for Info Orbs
After=network.target
[Service]
WorkingDirectory=/opt/OebbApi
SyslogIdentifier=OebbApi
ExecStart=/usr/bin/java -jar /opt/OebbApi/OebbApi.jar
Type=simple
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target

50
pom.xml
View file

@ -14,8 +14,56 @@
</dependency>
</dependencies>
<build>
<finalName>OebbApi</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>be.jaud.Main</mainClass>
</manifest>
</archive>
<excludes>
<exclude>**/commands/*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>be.jaud.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}
</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>

View file

@ -21,7 +21,7 @@ public class Main {
public static void main(String[] args) throws IOException {
refresh();
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0);
HttpServer server = HttpServer.create(new InetSocketAddress(8111), 0);
server.createContext("/oebbapi", new OebbHandler());
server.setExecutor(null); // creates a default executor
server.start();