diff --git a/.deployment/docker-compose.yml b/.deployment/docker-compose.yml index 5a1329f..3fe4c2a 100644 --- a/.deployment/docker-compose.yml +++ b/.deployment/docker-compose.yml @@ -95,6 +95,9 @@ services: - roster volumes: - ./:/data/ + environment: + - executor_pool_uri: "executor-pool.86-119-35-40.nip.io" + - roster_uri: "roster.86-119-35-40.nip.io" labels: - "traefik.enable=true" - "traefik.http.routers.executor-computation.rule=Host(`executor-computation.${PUB_IP}.nip.io`)" @@ -103,7 +106,6 @@ services: - "traefik.http.routers.executor-computation.tls=true" - "traefik.http.routers.executor-computation.entryPoints=web,websecure" - "traefik.http.routers.executor-computation.tls.certresolver=le" - executor-robot: image: openjdk command: "java -jar /data/executor-robot-0.0.1-SNAPSHOT.jar" @@ -113,6 +115,9 @@ services: - roster volumes: - ./:/data/ + environment: + - executor_pool_uri: "executor-pool.86-119-35-40.nip.io" + - roster_uri: "roster.86-119-35-40.nip.io" labels: - "traefik.enable=true" - "traefik.http.routers.executor-robot.rule=Host(`executor-robot.${PUB_IP}.nip.io`)" diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java index e618c79..4321f72 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java @@ -9,16 +9,15 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Value; import ch.unisg.executorbase.executor.application.port.out.ExecutionFinishedEventPort; import ch.unisg.executorbase.executor.domain.ExecutionFinishedEvent; public class ExecutionFinishedEventAdapter implements ExecutionFinishedEventPort { - // TODO url doesn't get mapped bc no autowiring - @Value("${roster.url}") - String server = "http://localhost:8082"; + String server = System.getenv("roster_uri") == null ? + "http://localhost:8082" : System.getenv("roster_uri"); + Logger logger = Logger.getLogger(ExecutionFinishedEventAdapter.class.getName()); diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java index 92cea92..9d8013b 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java @@ -23,9 +23,8 @@ import org.json.JSONObject; @Primary public class GetAssignmentAdapter implements GetAssignmentPort { - // TODO Not working for now bc it doesn't get autowired - @Value("${roster.url}") - String server = "http://127.0.0.1:8082"; + String server = System.getenv("roster_uri") == null ? + "http://localhost:8082" : System.getenv("roster_uri"); Logger logger = Logger.getLogger(GetAssignmentAdapter.class.getName()); diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java index abc0cf5..ebb6fc6 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java @@ -22,9 +22,8 @@ import ch.unisg.executorbase.executor.domain.ExecutorType; @Primary public class NotifyExecutorPoolAdapter implements NotifyExecutorPoolPort { - // TODO Not working for now bc it doesn't get autowired - @Value("${executor.pool.url}") - String server = "http://127.0.0.1:8083"; + String server = System.getenv("executor_pool_uri") == null ? + "http://localhost:8083" : System.getenv("executor_pool_uri"); Logger logger = Logger.getLogger(NotifyExecutorPoolAdapter.class.getName()); @@ -35,6 +34,8 @@ public class NotifyExecutorPoolAdapter implements NotifyExecutorPoolPort { @Override public boolean notifyExecutorPool(ExecutorURI executorURI, ExecutorType executorType) { + System.out.println(server); + String body = new JSONObject() .put("executorTaskType", executorType) .put("executorUri", executorURI.getValue()) diff --git a/tapas-auction-house/pom.xml b/tapas-auction-house/pom.xml index df44681..dd29302 100644 --- a/tapas-auction-house/pom.xml +++ b/tapas-auction-house/pom.xml @@ -46,7 +46,7 @@ org.eclipse.paho org.eclipse.paho.client.mqttv3 - 1.2.0 + 1.2.5 javax.transaction diff --git a/tapas-tasks/pom.xml b/tapas-tasks/pom.xml index 39e1e67..715b947 100644 --- a/tapas-tasks/pom.xml +++ b/tapas-tasks/pom.xml @@ -75,7 +75,7 @@ org.eclipse.paho org.eclipse.paho.client.mqttv3 - 1.2.0 + 1.2.5