tomcat deployment

This commit is contained in:
Patrick Haßel 2024-10-14 14:11:39 +02:00
parent 9bf3323346
commit d35f1a5509
3 changed files with 53 additions and 4 deletions

43
pom.xml
View File

@ -7,6 +7,7 @@
<groupId>de.ph87</groupId> <groupId>de.ph87</groupId>
<artifactId>Data</artifactId> <artifactId>Data</artifactId>
<version>0.1.0-SNAPSHOT</version> <version>0.1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties> <properties>
<maven.compiler.source>21</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
@ -37,6 +38,12 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.5</version>
</dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
@ -45,11 +52,41 @@
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.paho</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.2.5</version> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>scp</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./scp.sh</executable>
<arguments>
<argument>-P</argument>
<argument>2222</argument>
<argument>${project.build.directory}/${artifactId}.war</argument>
<argument>root@app.ph87.de:/srv/app.ph87.de/tomcat/webapps/</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

11
scp.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
echo -n "Upload to server [yes|NO]? "
read -r answer
if [ "$answer" == "yes" ]; then
echo -n "Uploading... "
scp "$@" && echo "DONE"
else
echo "NOT uploading!"
fi

View File

@ -2,9 +2,10 @@ package de.ph87.data;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication @SpringBootApplication
public class Backend { public class Backend extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(Backend.class, args); SpringApplication.run(Backend.class, args);