Skip to content

Commit

Permalink
base java 17 docker image and fix simulation #138
Browse files Browse the repository at this point in the history
  • Loading branch information
isuru89 committed Dec 29, 2023
1 parent baa3008 commit 0d4a325
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 31 deletions.
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 3,12 @@
echo "==============================================================================="
echo "Building Oasis..."
echo "==============================================================================="
mvn install -DskipTests
mvn clean install -DskipTests

echo "==============================================================================="
echo "Build the base java image"
echo "==============================================================================="
docker build -t oasis/base-java -f ./buildscripts/docker/Dockerfile-base-java .

cp externals/kafka-stream/target/libs/* buildscripts/modules
cp externals/kafka-stream/target/oasis-ext-kafkastream.jar buildscripts/modules
Expand Down Expand Up @@ -47,7 52,7 @@ mkdir -p .tmpdata/cache
echo "==============================================================================="
echo "Starting Oasis..."
echo "==============================================================================="
docker compose up
docker compose up --no-attach kafka --no-attach zookeeper --no-attach stats-api



9 changes: 9 additions & 0 deletions buildscripts/docker/Dockerfile-base-java
Original file line number Diff line number Diff line change
@@ -0,0 1,9 @@
# Apparently there is no jre 17 slim version. :(
# https://github.com/docker-library/openjdk/issues/468
FROM openjdk:17.0.2-jdk-slim

MAINTAINER Isuru Weerarathna <[email protected]>

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.8.0/wait /wait
RUN chmod x /wait
1 change: 1 addition & 0 deletions buildscripts/stats-api.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 10,6 @@ spring.liquibase.enabled=false
oasis.db.engine=redis
oasis.db.admin=jdbc

spring.h2.console.enabled=false

oasis.schema.dir=file:/etc/oasis/schema/oasis-changelog-master.yml
2 changes: 1 addition & 1 deletion engine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
FROM openjdk:11.0-jre-slim
FROM oasis/base-java

MAINTAINER Isuru Weerarathna <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion services/events-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
FROM openjdk:11.0-jre-slim
FROM oasis/base-java

MAINTAINER Isuru Weerarathna <[email protected]>

Expand Down
1 change: 0 additions & 1 deletion services/events-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 148,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifest>
Expand Down
2 changes: 1 addition & 1 deletion services/feeder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
FROM openjdk:11.0-jre-slim
FROM oasis/base-java

MAINTAINER Isuru Weerarathna <[email protected]>
## Add the wait script to the image
Expand Down
2 changes: 1 addition & 1 deletion services/stats-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
FROM openjdk:11.0-jre-slim
FROM oasis/base-java

MAINTAINER Isuru Weerarathna <[email protected]>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 62,7 @@
*/
public class Simulation implements Closeable {

static final String SOURCE_NAME = "oasis.simulation.internal";
static final String SOURCE_NAME = "oasis_simulation_internal";
static String SOURCE_TOKEN;
static int SOURCE_ID = 1;
static int GAME_ID = 1001;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 235,8 @@ protected void persistUsers(List<User> users) throws IOException {
"gameId", GAME_ID,
"teamId", teamId);

request = adminApiReq("/players/" dbUser.getId() "/teams")
.POST(HttpRequest.BodyPublishers.ofString(mapper.writeValueAsString(dataReq)))
request = adminApiReq("/players/" dbUser.getId() "/teams/" teamId)
.POST(HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<Void> resultTeamAdd = client.send(request, HttpResponse.BodyHandlers.discarding());
if (resultTeamAdd.statusCode() >= 400) {
Expand Down
2 changes: 1 addition & 1 deletion simulations/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,7 @@ oasis {
signal = 10
}
redis = {
host: "localhostxxx"
host: "localhost"
port: 6379

pool {
Expand Down
40 changes: 20 additions & 20 deletions simulations/stackoverflow/rules/badges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,7 @@ elements:
matchEvent: stackoverflow.question.asked
rewards:
badge:
attribute: 3
rank: 3

- name: First-Accepted
id: B-FACC
Expand All @@ -25,7 25,7 @@ elements:
expression: e['userId'] == e['askedBy'];
rewards:
badge:
attribute: 3
rank: 3

- name: Visit-Site
id: B-VSITE
Expand All @@ -46,15 46,15 @@ elements:
- streak: 50
rewards:
badge:
attribute: 3
rank: 3
- streak: 75
rewards:
badge:
attribute: 2
rank: 2
- streak: 100
rewards:
badge:
attribute: 1
rank: 1

- name: Popular-Question
id: B-POPQ
Expand All @@ -69,17 69,17 @@ elements:
condition: e['votes'] == 100
rewards:
badge:
attribute: 1
rank: 1
- priority: 2
condition: e['votes'] == 50
rewards:
badge:
attribute: 2
rank: 2
- priority: 3
condition: e['votes'] == 30
rewards:
badge:
attribute: 3
rank: 3

- name: Favourite-Question
id: B-FAVQ
Expand All @@ -94,17 94,17 @@ elements:
condition: e['favourites'] == 50
rewards:
badge:
attribute: 1
rank: 1
- priority: 2
condition: e['favourites'] == 25
rewards:
badge:
attribute: 2
rank: 2
- priority: 3
condition: e['favourites'] == 10
rewards:
badge:
attribute: 3
rank: 3

- name: Viewed-Question
id: B-VIEWQ
Expand All @@ -119,17 119,17 @@ elements:
condition: e['views'] == 10000
rewards:
badge:
attribute: 1
rank: 1
- priority: 2
condition: e['views'] == 5000
rewards:
badge:
attribute: 2
rank: 2
- priority: 3
condition: e['views'] == 1000
rewards:
badge:
attribute: 3
rank: 3

- name: Daily-Reputations
id: B-DREP
Expand All @@ -148,15 148,15 @@ elements:
- value: 200
rewards:
badge:
attribute: 1
rank: 1
- value: 150
rewards:
badge:
attribute: 2
rank: 2
- value: 100
rewards:
badge:
attribute: 3
rank: 3

- name: Max-Reputations
id: B-MAXREP
Expand All @@ -176,12 176,12 @@ elements:
- streak: 2
rewards:
badge:
attribute: 3
rank: 3
- streak: 5
rewards:
badge:
attribute: 2
rank: 2
- streak: 10
rewards:
badge:
attribute: 1
rank: 1

0 comments on commit 0d4a325

Please sign in to comment.