Persistence mongodb #84
|
@ -32,6 +32,8 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/data/
|
- ./:/data/
|
||||||
|
environment:
|
||||||
|
roster.uri: http://roster:8082
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.tapas-tasks.rule=Host(`tapas-tasks.${PUB_IP}.nip.io`)"
|
- "traefik.http.routers.tapas-tasks.rule=Host(`tapas-tasks.${PUB_IP}.nip.io`)"
|
||||||
|
@ -96,8 +98,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/data/
|
- ./:/data/
|
||||||
environment:
|
environment:
|
||||||
executor_pool_uri: executor-pool.86-119-35-40.nip.io
|
executor_pool_uri: http://executor-pool:8083
|
||||||
roster_uri: roster.86-119-35-40.nip.io"
|
roster_uri: http://roster:8082
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.executor-computation.rule=Host(`executor-computation.${PUB_IP}.nip.io`)"
|
- "traefik.http.routers.executor-computation.rule=Host(`executor-computation.${PUB_IP}.nip.io`)"
|
||||||
|
@ -116,8 +118,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/data/
|
- ./:/data/
|
||||||
environment:
|
environment:
|
||||||
executor_pool_uri: executor-pool.86-119-35-40.nip.io
|
executor_pool_uri: http://executor-pool:8083
|
||||||
roster_uri: roster.86-119-35-40.nip.io
|
roster_uri: http://roster:8082
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.executor-robot.rule=Host(`executor-robot.${PUB_IP}.nip.io`)"
|
- "traefik.http.routers.executor-robot.rule=Host(`executor-robot.${PUB_IP}.nip.io`)"
|
||||||
|
|
|
@ -34,8 +34,6 @@ public class NotifyExecutorPoolAdapter implements NotifyExecutorPoolPort {
|
||||||
@Override
|
@Override
|
||||||
public boolean notifyExecutorPool(ExecutorURI executorURI, ExecutorType executorType) {
|
public boolean notifyExecutorPool(ExecutorURI executorURI, ExecutorType executorType) {
|
||||||
|
|
||||||
System.out.println(server);
|
|
||||||
|
|
||||||
String body = new JSONObject()
|
String body = new JSONObject()
|
||||||
.put("executorTaskType", executorType)
|
.put("executorTaskType", executorType)
|
||||||
.put("executorUri", executorURI.getValue())
|
.put("executorUri", executorURI.getValue())
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ch.unisg.executorbase.executor.domain;
|
package ch.unisg.executorbase.executor.domain;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import ch.unisg.common.valueobject.ExecutorURI;
|
import ch.unisg.common.valueobject.ExecutorURI;
|
||||||
|
@ -41,8 +42,10 @@ public abstract class ExecutorBase {
|
||||||
// TODO do this in main
|
// TODO do this in main
|
||||||
// Notify executor-pool about existence. If executor-pools response is successfull start with getting an assignment, else shut down executor.
|
// Notify executor-pool about existence. If executor-pools response is successfull start with getting an assignment, else shut down executor.
|
||||||
if(!notifyExecutorPoolService.notifyExecutorPool(this.executorURI, this.executorType)) {
|
if(!notifyExecutorPoolService.notifyExecutorPool(this.executorURI, this.executorType)) {
|
||||||
|
logger.log(Level.WARNING, "Executor could not connect to executor pool! Shuting down!");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
logger.info("Executor conntected to executor pool");
|
||||||
this.status = ExecutorStatus.IDLING;
|
this.status = ExecutorStatus.IDLING;
|
||||||
getAssignment();
|
getAssignment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import ch.unisg.tapastasks.tasks.application.port.out.CanTaskBeDeletedPort;
|
||||||
import ch.unisg.tapastasks.tasks.domain.DeleteTaskEvent;
|
import ch.unisg.tapastasks.tasks.domain.DeleteTaskEvent;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -19,9 +21,8 @@ import java.util.HashMap;
|
||||||
@Primary
|
@Primary
|
||||||
public class CanTaskBeDeletedWebAdapter implements CanTaskBeDeletedPort {
|
public class CanTaskBeDeletedWebAdapter implements CanTaskBeDeletedPort {
|
||||||
|
|
||||||
// Base URI of the service interested in this event
|
@Value("${roster.uri}")
|
||||||
//Todo: Add the right IP address
|
String server;
|
||||||
String server = null;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void canTaskBeDeletedEvent(DeleteTaskEvent event){
|
public void canTaskBeDeletedEvent(DeleteTaskEvent event){
|
||||||
|
|
|
@ -4,6 +4,8 @@ import ch.unisg.tapastasks.tasks.application.port.out.NewTaskAddedEventPort;
|
||||||
import ch.unisg.tapastasks.tasks.domain.NewTaskAddedEvent;
|
import ch.unisg.tapastasks.tasks.domain.NewTaskAddedEvent;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -18,8 +20,8 @@ import java.util.HashMap;
|
||||||
@Primary
|
@Primary
|
||||||
public class PublishNewTaskAddedEventWebAdapter implements NewTaskAddedEventPort {
|
public class PublishNewTaskAddedEventWebAdapter implements NewTaskAddedEventPort {
|
||||||
|
|
||||||
//This is the base URI of the service interested in this event (in my setup, running locally as separate Spring Boot application)
|
@Value("${roster.uri}")
|
||||||
String server = "http://127.0.0.1:8082";
|
String server;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishNewTaskAddedEvent(NewTaskAddedEvent event) {
|
public void publishNewTaskAddedEvent(NewTaskAddedEvent event) {
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
server.port=8081
|
server.port=8081
|
||||||
baseuri=https://tapas-tasks.86-119-34-23.nip.io/
|
baseuri=https://tapas-tasks.86-119-34-23.nip.io/
|
||||||
|
roster.uri=http://127.0.0.1:8082
|
||||||
|
|
Loading…
Reference in New Issue
Block a user