Merging dev to main #107
|
@ -67,8 +67,9 @@ services:
|
|||
- ./:/data/
|
||||
environment:
|
||||
mqtt.broker.uri: tcp://broker.hivemq.com:1883
|
||||
discovery.endpoint.uri: https://tapas-auction-house.86.119.35.213.nip.io/discovery/
|
||||
discovery.endpoint.uri: https://tapas-auction-house.86-119-34-242.nip.io
|
||||
auction.house.uri: https://tapas-auction-house.86-119-35-40.nip.io
|
||||
tasks.list.uri: https://tapas-tasks.86-119-35-40.nip.io
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.tapas-auction-house.rule=Host(`tapas-auction-house.${PUB_IP}.nip.io`)"
|
||||
|
|
3
.github/workflows/build-and-deploy.yml
vendored
3
.github/workflows/build-and-deploy.yml
vendored
|
@ -107,5 +107,6 @@ jobs:
|
|||
cd /home/${{ secrets.SSH_USER }}/
|
||||
touch acme.json
|
||||
sudo chmod 0600 acme.json
|
||||
sudo docker-compose down --remove-orphans
|
||||
sudo echo "PUB_IP=$(wget -qO- http://ipecho.net/plain | xargs echo)" | sed -e 's/\./-/g' > .env
|
||||
sudo docker-compose up -d --build --force-recreate
|
||||
sudo docker-compose up -d
|
||||
|
|
|
@ -67,6 +67,17 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.graalvm.js</groupId>
|
||||
<artifactId>js</artifactId>
|
||||
<version>21.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.graalvm.js</groupId>
|
||||
<artifactId>js-scriptengine</artifactId>
|
||||
<version>21.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</parent>
|
||||
<groupId>ch.unisg</groupId>
|
||||
<artifactId>executor-humidity</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>executor-humidity</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<properties>
|
||||
|
|
|
@ -21,7 +21,8 @@ public class Executor extends ExecutorBase {
|
|||
@Override
|
||||
protected
|
||||
String execution(String input) {
|
||||
return userToRobotPort.userToRobot();
|
||||
userToRobotPort.userToRobot();
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,11 @@ public class TapasAuctionHouseApplication {
|
|||
WebSubSubscriber subscriber = new WebSubSubscriber(ENVIRONMENT.getProperty("auction.house.uri"));
|
||||
|
||||
for (AuctionHouseDiscoveryInformation endpoint : AuctionHouseDiscovery.getInstance().getAuctionHouseDiscoveryList()) {
|
||||
System.out.println(endpoint.getWebSubUri().getValue());
|
||||
// Don't subscribe to our own auction house
|
||||
if (!endpoint.getWebSubUri().getValue().toString().equalsIgnoreCase("https://tapas-auction-house.86-119-35-40.nip.io/websub/auctions")) {
|
||||
subscriber.subscribeToAuctionHouseEndpoint(endpoint.getWebSubUri().getValue());
|
||||
}
|
||||
}
|
||||
// try {
|
||||
// subscriber.subscribeToAuctionHouseEndpoint(new URI("http://6b4e-130-82-250-227.ngrok.io/websub-discovery"));
|
||||
// } catch (URISyntaxException e) {
|
||||
|
|
|
@ -101,6 +101,9 @@ public class WebSubSubscriber {
|
|||
return;
|
||||
}
|
||||
|
||||
System.out.println("HUB: " + hub);
|
||||
System.out.println("TOPIC: " + topic);
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(hubURI)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
|
|
@ -22,11 +22,9 @@ import java.net.http.HttpResponse;
|
|||
public class ExternalAuctionStartedEventListenerMqttAdapter extends AuctionEventMqttListener{
|
||||
private static final Logger LOGGER = LogManager.getLogger(ExternalAuctionStartedEventListenerMqttAdapter.class);
|
||||
|
||||
// String auctionHouseURI = "https://tapas-auction-house.86-119-35-40.nip.io/";
|
||||
String auctionHouseURI = "http://a888-77-59-152-182.eu.ngrok.io";
|
||||
String auctionHouseURI = "https://tapas-auction-house.86-119-35-40.nip.io/";
|
||||
|
||||
// String taskListURI = "https://tapas-tasks.86-119-35-40.nip.io";
|
||||
String taskListURI = "http://e021-77-59-152-182.ngrok.io";
|
||||
String taskListURI = "https://tapas-tasks.86-119-35-40.nip.io";
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(MqttMessage message){
|
||||
|
|
|
@ -69,11 +69,9 @@ public class AuctionStartedEventListenerWebSubAdapter {
|
|||
// }
|
||||
|
||||
|
||||
// String auctionHouseURI = "https://tapas-auction-house.86-119-35-40.nip.io/";
|
||||
String auctionHouseURI = "http://b311-130-82-247-153.eu.ngrok.io";
|
||||
String auctionHouseURI = "https://tapas-auction-house.86-119-35-40.nip.io/";
|
||||
|
||||
// String taskListURI = "https://tapas-tasks.86-119-35-40.nip.io";
|
||||
String taskListURI = "http://c64f-130-82-247-153.ngrok.io";
|
||||
String taskListURI = "https://tapas-tasks.86-119-35-40.nip.io";
|
||||
|
||||
// TODO Sanitize URIs
|
||||
String auctionId = auction.getString("auctionId");
|
||||
|
|
|
@ -30,7 +30,7 @@ public class AuctionHouseDiscoveryWebController {
|
|||
this.auctionHouseDiscoveryUseCase = auctionHouseDiscoveryUseCase;
|
||||
}
|
||||
|
||||
@GetMapping(path="/discovery/", consumes = AuctionHouseDiscoveryJsonRepresentation.MEDIA_TYPE)
|
||||
@GetMapping(path="/discovery/")
|
||||
public ResponseEntity<String> auctionHouseDiscovery() {
|
||||
List<AuctionHouseDiscoveryInformation> auctionHouseDiscoveryInformation = auctionHouseDiscoveryUseCase.auctionHouseDiscovery();
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@ public class WinningBidWebController {
|
|||
|
||||
@PostMapping(path = "/taskwinner", consumes = TaskJsonRepresentation.MEDIA_TYPE)
|
||||
public ResponseEntity<String> winningBid(@RequestBody TaskJsonRepresentation payload){
|
||||
LOGGER.info("New Task Winner");
|
||||
try {
|
||||
var body = payload.serialize();
|
||||
LOGGER.info(body);
|
||||
LOGGER.info("Task Winner body: " + body);
|
||||
LOGGER.info("Task Winner taskListURI: " + taskListURI);
|
||||
var postURI = URI.create(taskListURI + "/tasks/");
|
||||
HttpRequest postRequest = HttpRequest.newBuilder()
|
||||
.uri(postURI)
|
||||
|
@ -40,7 +42,7 @@ public class WinningBidWebController {
|
|||
HttpClient client = HttpClient.newHttpClient();
|
||||
var postResponse = client.send(postRequest, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
LOGGER.info(postResponse.statusCode());
|
||||
LOGGER.info("Create task internally with status code: " + postResponse.statusCode());
|
||||
|
||||
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
|
|
|
@ -32,6 +32,7 @@ public class PublishAuctionStartedEventWebSubAdapter implements AuctionStartedEv
|
|||
@Override
|
||||
public void publishAuctionStartedEvent(AuctionStartedEvent event) {
|
||||
logger.info("AuctionHouse | Publish auction started over WebSub!");
|
||||
logger.info("AuctionHouse | AuctionHouseURI: " + auctionHouseUri + " WebSubHubUri: " + webSubHubUri);
|
||||
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
@ -22,16 +23,16 @@ public class AuctionHouseDiscoveryHttpAdapter implements AuctionHouseDiscoveryPo
|
|||
|
||||
public List<AuctionHouseDiscoveryInformation> fetchAuctionHouseInformation(URI auctionHouseURI){
|
||||
|
||||
System.out.println(auctionHouseURI);
|
||||
|
||||
try{
|
||||
var client = HttpClient.newHttpClient();
|
||||
var request = HttpRequest.newBuilder()
|
||||
.uri(auctionHouseURI)
|
||||
.GET()
|
||||
.build();
|
||||
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
LOGGER.info(response.body());
|
||||
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
LOGGER.info("Response status code: " + response.statusCode());
|
||||
LOGGER.info("Response body:" + response.body());
|
||||
if (response.statusCode() == HttpStatus.OK.value()) {
|
||||
var responseBody = new JSONObject(response.body());
|
||||
|
||||
var arrayOfInformation = responseBody.getJSONArray("auctionHouseInfo");
|
||||
|
@ -51,7 +52,8 @@ public class AuctionHouseDiscoveryHttpAdapter implements AuctionHouseDiscoveryPo
|
|||
}
|
||||
|
||||
return returnList;
|
||||
|
||||
}
|
||||
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
|
||||
|
|
|
@ -52,13 +52,18 @@ public class AuctionWonEventHttpAdapter implements AuctionWonEventPort {
|
|||
LOGGER.info(response.body());
|
||||
JSONObject responseBody = new JSONObject(response.body());
|
||||
|
||||
String inputData = "";
|
||||
if (!responseBody.isNull("inputData")) {
|
||||
inputData = responseBody.getString("inputData");
|
||||
}
|
||||
|
||||
var task = new Task(
|
||||
new Task.TaskName(responseBody.getString("taskName")),
|
||||
new Task.TaskType(responseBody.getString("taskType")),
|
||||
new Task.OriginalTaskUri(auction.get().getTaskUri().getValue().toString()),
|
||||
new Task.TaskStatus(ch.unisg.tapas.auctionhouse.domain.Task.Status.ASSIGNED),
|
||||
new Task.TaskId(responseBody.getString("taskId")),
|
||||
new Task.InputData(responseBody.getString("inputData")),
|
||||
new Task.InputData(inputData),
|
||||
new Task.ServiceProvider("TODO")
|
||||
);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ websub.hub.publish=https://websub.appspot.com/
|
|||
|
||||
group=tapas-group-1
|
||||
auction.house.uri=https://tapas-auction-house.86-119-35-40.nip.io
|
||||
# auction.house.uri=http://a888-77-59-152-182.eu.ngrok.io
|
||||
tasks.list.uri=http://localhost:8081
|
||||
|
||||
application.environment=development
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ExternalTaskExecutedWebAdapter implements ExternalTaskExecutedEvent
|
|||
op2 = new JSONObject()
|
||||
.put("op", "add")
|
||||
.put("path", "/outputData")
|
||||
.put("value", externalTaskExecutedEvent.getOutputData());
|
||||
.put("value", externalTaskExecutedEvent.getOutputData().getValue());
|
||||
} catch (JSONException e) {
|
||||
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
return;
|
||||
|
|
|
@ -2,7 +2,7 @@ server.port=8081
|
|||
spring.data.mongodb.uri=mongodb://root:password@localhost:27017/
|
||||
spring.data.mongodb.database=tapas-tasks
|
||||
# baseuri=http://e021-77-59-152-182.ngrok.io/
|
||||
baseuri=https://tapas-tasks.86-119-34-23.nip.io/
|
||||
baseuri=https://tapas-tasks.86-119-35-40.nip.io/
|
||||
|
||||
roster.uri=http://127.0.0.1:8082
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user