Skip to content

Commit

Permalink
Added basic structure, dependencies and Dockerfile for job-service.
Browse files Browse the repository at this point in the history
  • Loading branch information
RomaPrograms committed Apr 3, 2020
1 parent 0b243c5 commit d461687
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ build/
*-local.yml

/temp/

*local.conf
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ docker-compose up -d
Once you started stack you can use the following services:

* file storage service: http://localhost/api/file
* jobs service: http://localhost/api/jobs

To check service availability you can get its status using `/status` endpoint, e.g.: http://localhost/api/file/status
To check service availability you can get its status using `/status` endpoints, e.g.:
http://localhost/api/file/status
http://localhost/api/jobs/status

**Stop service stack**
```
Expand All @@ -47,3 +50,4 @@ containers.
Config assumes that you launch services on the following ports:

* file storage service: `8090`
* jobs service: `8091`
8 changes: 7 additions & 1 deletion docker/api-gateway/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}

location /api/jobs {
proxy_pass http://job-service:8080/api/job;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
8 changes: 7 additions & 1 deletion docker/api-gateway/conf.d/dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}

location /api/jobs {
proxy_pass http://host.docker.internal:8091/api/job;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
3 changes: 3 additions & 0 deletions docker/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ services:
profile: ${PROFILE}
ports:
- 80:80
depends_on:
- local-storage-service
- job-service
5 changes: 5 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ services:
expose:
- 8080
restart: always
job-service:
build: ../job-service/server
expose:
- 8080
restart: always
15 changes: 15 additions & 0 deletions job-service/client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>job-service</artifactId>
<groupId>org.verapdf</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>job-service-client</artifactId>


</project>
13 changes: 13 additions & 0 deletions job-service/model/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>job-service</artifactId>
<groupId>org.verapdf</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>job-service-model</artifactId>
</project>
23 changes: 23 additions & 0 deletions job-service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>org.verapdf</groupId>
<artifactId>verapdf-webapp-server</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>

<artifactId>job-service</artifactId>
<version>0.1.0-SNAPSHOT</version>
<modules>
<module>client</module>
<module>model</module>
<module>server</module>
</modules>
<packaging>pom</packaging>

</project>
4 changes: 4 additions & 0 deletions job-service/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:11
COPY target/job-service-server.jar job-service-server.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "job-service-server.jar"]
53 changes: 53 additions & 0 deletions job-service/server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>job-service</artifactId>
<groupId>org.verapdf</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>job-service-server</artifactId>

<properties>
<java.version>11</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>job-service-server</finalName>
</configuration>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.verapdf.jobservice.server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class JobServiceServerApplication {
public static void main(String[] args) {
SpringApplication.run(JobServiceServerApplication.class, args);
}
}
7 changes: 7 additions & 0 deletions job-service/server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server:
servlet:
context-path: /api/jobs
management:
endpoints:
web:
base-path: /status
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.verapdf.jobservice.server;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@ExtendWith(SpringExtension.class)
@SpringBootTest
@ActiveProfiles("test")
public class JobServiceServerApplicationTest {
@Test
public void contextLoads() {
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<modules>
<module>local-storage-service</module>
<module>job-service</module>
</modules>

<parent>
Expand Down

0 comments on commit d461687

Please sign in to comment.