diff --git a/build.sh b/build.sh index 97980e10..a1ed4841 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!bin/bash +#!/bin/bash echo "===============================================================================" echo "Building Oasis..." @@ -8,7 +8,7 @@ mvn clean install -DskipTests echo "===============================================================================" echo "Build the base java image" echo "===============================================================================" -docker build -t oasis/base-java -f ./buildscripts/docker/Dockerfile-base-java . +docker build -t oasis/base-java -f ./buildscripts/docker/base-java.dockerfile . cp externals/kafka-stream/target/libs/* buildscripts/modules cp externals/kafka-stream/target/oasis-ext-kafkastream.jar buildscripts/modules diff --git a/buildscripts/docker/Dockerfile-base-java b/buildscripts/docker/base-java.dockerfile similarity index 100% rename from buildscripts/docker/Dockerfile-base-java rename to buildscripts/docker/base-java.dockerfile diff --git a/buildscripts/engine.conf b/buildscripts/engine.conf deleted file mode 100644 index a6fbd9f2..00000000 --- a/buildscripts/engine.conf +++ /dev/null @@ -1,61 +0,0 @@ -akka { - loggers = ["akka.event.slf4j.Slf4jLogger"] - loglevel = "DEBUG" - logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" -} - -oasis { - engine { - id: "local.engine" - } - - eventstream { - impl = "io.github.oasis.ext.kafkastream.KafkaStreamFactory" - configs = { - brokerUrls: "kafka:9092" - - maxConsumerThreadPoolSize: 4 - - gameEventsConsumer = { - # If not specified, this will be engine id - # instanceId = "" - - # These props will directly feed to Kafka property configs - # Check kafka consumer documentation for supported props. - props = { - #"max.poll.records": 10, - #"session.timeout.ms": 86400000 - } - } - - broadcastConsumer = { - # groupId = "" - - # These props will directly feed to Kafka property configs - # Check kafka consumer documentation for supported props. - props = { - } - } - - dispatcherConfigs = { - props = {} - } - - engineEventConsumer = { - props = {} - } - - } - } - - redis = { - host: "enginedb" - port: 6379 - - pool { - max: 16 - maxIdle: 8 - minIdle: 4 - } - } -} diff --git a/buildscripts/engine.yml b/buildscripts/engine.yml new file mode 100644 index 00000000..9d19e973 --- /dev/null +++ b/buildscripts/engine.yml @@ -0,0 +1,28 @@ +oasis: + engine: + id: "local.engine" + + eventstream: + impl: "io.github.oasis.ext.kafkastream.KafkaStreamFactory" + configs: + brokerUrls: "kafka:9092" + + maxConsumerThreadPoolSize: 4 + + gameEventsConsumer: + props: + broadcastConsumer: + props: + dispatcherConfigs: + props: + engineEventConsumer: + props: + + redis: + host: enginedb + port: 6379 + + pool: + max: 16 + maxIdle: 8 + minIdle: 4 \ No newline at end of file diff --git a/buildscripts/events-api.conf b/buildscripts/events-api.yml similarity index 67% rename from buildscripts/events-api.conf rename to buildscripts/events-api.yml index ca7c26ee..7804bc4b 100644 --- a/buildscripts/events-api.conf +++ b/buildscripts/events-api.yml @@ -1,6 +1,6 @@ -http = { - port = 8050 - ssl = false +http: + port: 8050 + ssl: false # Set this to true, if you want to disable event integrity check against valid event sources registered # through admin api. By default, this will be set to false and it means, event integrity will be enforced. @@ -8,12 +8,11 @@ http = { # Beware: Disabling integrity check should be done only if you can guarantee that this event api will # never be exposed as a public api. Otherwise, external users may send events which causes the # bad impact to the integrity of game play. - skipEventIntegrityCheck = false -} + skipEventIntegrityCheck: false -oasis = { - - adminApi = { +oasis: + + adminApi: baseUrl: "http://stats-api:8010/api" eventSourceGet: "/admin/event-source" @@ -22,16 +21,16 @@ oasis = { # authentication details of admin api apiKey: "eventapi" secretKey: "eventapi" - } - dispatcher = { - impl = "oasis:io.github.oasis.ext.kafkastream.KafkaStreamFactory" - configs = { + + dispatcher: + impl: "oasis:io.github.oasis.ext.kafkastream.KafkaStreamFactory" + configs: brokerUrls: "kafka:9092" maxConsumerThreadPoolSize: 4 - - gameEventsConsumer = { + + gameEventsConsumer: # groupId = "" # If not specified, this will take engine id @@ -39,45 +38,33 @@ oasis = { # These props will directly feed to Kafka property configs # Check kafka consumer documentation for supported props. - props = { - #"max.poll.records": 10, - #"session.timeout.ms": 86400000 - } - } + props: + #"max.poll.records": 10, + #"session.timeout.ms": 86400000 - broadcastConsumer = { + broadcastConsumer: # groupId = "" # These props will directly feed to Kafka property configs # Check kafka consumer documentation for supported props. - props = { - } - } - - dispatcherConfigs = { - props = {} - } + props: - engineEventConsumer = { - props = {} - } + dispatcherConfigs: + props: - } - } + engineEventConsumer: + props: - cache = { - impl = "oasis:io.github.oasis.services.events.db.RedisVerticle" - configs = { - connectionString: "redis://apicache:6381" - maxPoolSize: 16 - maxWaitingHandlers: 16 + cache: + impl: "oasis:io.github.oasis.services.events.db.RedisVerticle" + configs: + connectionString: "redis://apicache:6381" + maxPoolSize: 16 + maxWaitingHandlers: 16 # expiration seconds for once cached event source data. # Better to have a ttl based on your domain. # Longer TTLs will suffer from event source updates in admin api. # Shorter TTLs will suffer from unnecessary invocations to admin api. # If this value is not set, no expiration will set for cached entries. - eventSourcesTTL: 900 - } - } -} \ No newline at end of file + eventSourcesTTL: 900 diff --git a/buildscripts/feeder.conf b/buildscripts/feeder.yml similarity index 56% rename from buildscripts/feeder.conf rename to buildscripts/feeder.yml index 0f713b5a..36a0e298 100644 --- a/buildscripts/feeder.conf +++ b/buildscripts/feeder.yml @@ -1,6 +1,5 @@ -oasis = { - - adminApi = { +oasis: + adminApi: baseUrl: "http://stats-api:8010/api" eventSourceGet: "/admin/event-sources/" @@ -11,37 +10,30 @@ oasis = { # authentication details of admin api apiKey: "feeder" secretKey: "feeder" - } - delivery = { + delivery: # Specify the implementation class of FeedDeliverable - impl = "io.github.oasis.services.feeds.impl.ConsoleFeedDeliverable" + impl: "io.github.oasis.services.feeds.impl.ConsoleFeedDeliverable" - configs = { - # specific configurations for above mentioned implementation - } - } + configs: + # specific configurations for above mentioned implementation - eventstream = { - impl = "io.github.oasis.ext.kafkastream.KafkaStreamFactory" - configs = { + eventstream: + impl: "io.github.oasis.ext.kafkastream.KafkaStreamFactory" + configs: brokerUrls: "kafka:9092" - feedStreamConsumer = { - groupId = "feed-consumer-group" + feedStreamConsumer: + groupId: feed-consumer-group # These props will directly feed to Kafka property configs # Check kafka consumer documentation for supported props. - props = { - #"max.poll.records": 10, - #"session.timeout.ms": 86400000 - } - } - } - } + props: + #"max.poll.records": 10, + #"session.timeout.ms": 86400000 - cache = { - configs = { + cache: + configs: # Maximum number of seconds to keep a record once written to cache. # Set zero (0) to keep the object indefinitely. @@ -49,13 +41,8 @@ oasis = { expireAfter: 900 # Maximum number of players to be kept in memory at a time. - maxEntries = { + maxEntries: games: 10 eventSources: 10 teams: 100 - players: 250 - } - - } - } -} \ No newline at end of file + players: 250 \ No newline at end of file diff --git a/buildscripts/stats-api-spring.yml b/buildscripts/stats-api-spring.yml new file mode 100644 index 00000000..7dbb7f99 --- /dev/null +++ b/buildscripts/stats-api-spring.yml @@ -0,0 +1,21 @@ +server: + servlet: + context-path: /api + port: 8010 + +# Oasis config file path +oasis: + configs: + path: /etc/oasis/stats-api.yml + db: + engine: redis + admin: jdbc + schema: + dir: "file:/etc/oasis/schema/oasis-changelog-master.yml" + +spring: + h2: + console: + enabled: false + liquibase: + enabled: false diff --git a/buildscripts/stats-api.conf b/buildscripts/stats-api.conf deleted file mode 100644 index 69bbd593..00000000 --- a/buildscripts/stats-api.conf +++ /dev/null @@ -1,84 +0,0 @@ -oasis = { - db = { - engine: redis - admin: jdbc - } - - jdbc = { - url: "jdbc:h2:mem:test", - driver: "org.h2.Driver", - user: "sa", - password: "sa", - } - - defaultApiKey = "root:root,eventapi:eventapi,feeder:feeder:7" - - cache { - host: "apicache" - port: 6381 - - connectionRetries: 5 - connectionRetryDelay: 5000 - - pool = { - max: 16 - maxIdle: 16 - minIdle: 8 - } - } - - enginedb { - host: "enginedb" - port: 6379 - - connectionRetries: 5 - connectionRetryDelay: 5000 - - pool = { - max: 16 - maxIdle: 16 - minIdle: 4 - } - } - - dispatcher = { - impl = "io.github.oasis.ext.kafkastream.KafkaStreamFactory" - configs = { - brokerUrls: "kafka:9092" - - maxConsumerThreadPoolSize: 4 - - gameEventsConsumer = { - # groupId = "" - - # If not specified, this will take engine id - # instanceId = "" - - # These props will directly feed to Kafka property configs - # Check kafka consumer documentation for supported props. - props = { - #"max.poll.records": 10, - #"session.timeout.ms": 86400000 - } - } - - broadcastConsumer = { - # groupId = "" - - # These props will directly feed to Kafka property configs - # Check kafka consumer documentation for supported props. - props = { - } - } - - dispatcherConfigs = { - props = {} - } - - engineEventConsumer = { - props = {} - } - - } - } -} \ No newline at end of file diff --git a/buildscripts/stats-api.properties b/buildscripts/stats-api.properties deleted file mode 100644 index e23dbc20..00000000 --- a/buildscripts/stats-api.properties +++ /dev/null @@ -1,15 +0,0 @@ -server.servlet.context-path=/api - -server.port=8010 - -# Oasis config file path -oasis.configs.path=/etc/oasis/stats-api.conf - -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 \ No newline at end of file diff --git a/buildscripts/stats-api.yml b/buildscripts/stats-api.yml new file mode 100644 index 00000000..0e4696de --- /dev/null +++ b/buildscripts/stats-api.yml @@ -0,0 +1,68 @@ +oasis: + db: + engine: redis + admin: jdbc + + jdbc: + url: "jdbc:h2:mem:test" + driver: "org.h2.Driver" + user: "sa" + password: "sa" + + defaultApiKey: "root:root,eventapi:eventapi,feeder:feeder:7" + + cache: + host: "apicache" + port: 6379 + + connectionRetries: 5 + connectionRetryDelay: 5000 + + pool: + max: 16 + maxIdle: 16 + minIdle: 4 + + enginedb: + host: "enginedb" + port: 6379 + + connectionRetries: 5 + connectionRetryDelay: 5000 + + pool: + max: 16 + maxIdle: 16 + minIdle: 4 + + dispatcher: + impl: "io.github.oasis.ext.kafkastream.KafkaStreamFactory" + configs: + brokerUrls: "kafka:9092" + + maxConsumerThreadPoolSize: 4 + + gameEventsConsumer: + # groupId: "" + + # If not specified, this will take engine id + # instanceId: "" + + # These props will directly feed to Kafka property configs + # Check kafka consumer documentation for supported props. + # props: + #"max.poll.records": 10, + #"session.timeout.ms": 86400000 + + broadcastConsumer: + # groupId: "" + + # These props will directly feed to Kafka property configs + # Check kafka consumer documentation for supported props. + #props: + + dispatcherConfigs: + props: + + engineEventConsumer: + props: diff --git a/core/src/main/java/io/github/oasis/core/configs/OasisConfigs.java b/core/src/main/java/io/github/oasis/core/configs/OasisConfigs.java index 735c3e3d..e41ab4fe 100644 --- a/core/src/main/java/io/github/oasis/core/configs/OasisConfigs.java +++ b/core/src/main/java/io/github/oasis/core/configs/OasisConfigs.java @@ -57,6 +57,7 @@ public class OasisConfigs implements Serializable { private final Configuration jsonPathConf = Configuration.builder() .options(Option.DEFAULT_PATH_LEAF_TO_NULL) + .options(Option.SUPPRESS_EXCEPTIONS) .build(); private DocumentContext ctx; @@ -94,6 +95,10 @@ public Map getAll() { return Collections.unmodifiableMap(configValues); } + public boolean hasProperty(String property) { + return readFromEnvVar(property).orElseGet(() -> ctx.read(toQuery(property))) != null; + } + private String getValue(String property, String defaultValue) { return readFromEnvVar(property).orElseGet(() -> { String value = ctx.read(toQuery(property)); diff --git a/core/src/test/java/io/github/oasis/core/configs/OasisConfigTest.java b/core/src/test/java/io/github/oasis/core/configs/OasisConfigTest.java index 82bce71d..d62c5454 100644 --- a/core/src/test/java/io/github/oasis/core/configs/OasisConfigTest.java +++ b/core/src/test/java/io/github/oasis/core/configs/OasisConfigTest.java @@ -5,6 +5,7 @@ import java.util.HashMap; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; public class OasisConfigTest { @@ -15,7 +16,10 @@ void testConfigsWithoutEnvVariables() { var oc = new OasisConfigs.Builder().buildFromYamlResource("configs/sample.yaml", clsLoader); assertEquals("engine-name-test", oc.get("oasis.engine.id", "abc")); + assertFalse(oc.hasProperty("oasis.engine.idnx")); assertEquals("abc", oc.get("oasis.engine.idnx", "abc")); + assertFalse(oc.hasProperty("oasis.engine.id.name.ref")); + assertEquals("abc", oc.get("oasis.engine.id.name.ref", "abc")); } @Test @@ -29,8 +33,10 @@ void testConfigsWithEnvVariablesDefaultPrefix() { assertEquals("overridden-value", oc.get("oasis.engine.id", "abc")); assertEquals("abc", oc.get("oasis.engine.idnx", "abc")); + assertFalse(oc.hasProperty("oasis.engine.idnx")); assertTrue(oc.getBoolean("oasis.cache.printSql", false)); assertEquals("value-2", oc.get("nx.in.file", "xxx")); + assertTrue(oc.hasProperty("nx.in.file")); assertEquals(3, oc.getInt("oasis.engine.interval", 99)); assertEquals("item 2", oc.get("item-array[1]", "xxx")); assertEquals("val1", oc.get("it-obj-array[1].obj2.key1", "xxx")); diff --git a/docker-compose.yml b/docker-compose.yml index b7d7a231..af305238 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,7 +48,7 @@ services: ports: - "8050:8050" volumes: - - "./buildscripts/events-api.conf:/etc/oasis/events-api.conf" + - "./buildscripts/events-api.yml:/etc/oasis/events-api.yml" environment: - "WAIT_HOSTS=apicache:6381,kafka:9092" depends_on: @@ -60,8 +60,8 @@ services: ports: - "8010:8010" volumes: - - "./buildscripts/stats-api.conf:/etc/oasis/stats-api.conf" - - "./buildscripts/stats-api.properties:/etc/oasis/stats-api.properties" + - "./buildscripts/stats-api.yml:/etc/oasis/stats-api.yml" + - "./buildscripts/stats-api-spring.yml:/etc/oasis/stats-api-spring.yml" - "./buildscripts/modules:/etc/oasis/modules" environment: - "WAIT_HOSTS=apicache:6381,kafka:9092" @@ -74,7 +74,7 @@ services: environment: - "WAIT_HOSTS=enginedb:6379,kafka:9092" volumes: - - "./buildscripts/engine.conf:/etc/oasis/engine.conf" + - "./buildscripts/engine.yml:/etc/oasis/engine.yml" - "./buildscripts/modules:/etc/oasis/modules" depends_on: - enginedb @@ -85,7 +85,7 @@ services: environment: - "WAIT_HOSTS=kafka:9092" volumes: - - "./buildscripts/feeder.conf:/etc/oasis/feeder.conf" + - "./buildscripts/feeder.yml:/etc/oasis/feeder.yml" - "./buildscripts/modules:/etc/oasis/modules" depends_on: - kafka diff --git a/engine/Dockerfile b/engine/Dockerfile index 5e71c348..52a13584 100644 --- a/engine/Dockerfile +++ b/engine/Dockerfile @@ -2,15 +2,11 @@ FROM oasis/base-java MAINTAINER Isuru Weerarathna -## 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 - WORKDIR /usr/share/oasis-engine CMD /wait && exec java -classpath ./*:libs/*:/etc/oasis/modules/* io.github.oasis.engine.OasisEngineRunner RUN mkdir -p /etc/oasis -ENV ENGINE_CONFIG_FILE "/etc/oasis/engine.conf" +ENV ENGINE_CONFIG_FILE "/etc/oasis/engine.yml" # Add dependency library files ADD target/libs /usr/share/oasis-engine diff --git a/engine/pom.xml b/engine/pom.xml index 5b0b2ca9..f6d795c7 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -84,6 +84,11 @@ json-simple 1.1.1 + + com.typesafe + config + 1.4.2 + com.typesafe.akka akka-testkit_3 diff --git a/engine/src/main/resources/logback.xml b/engine/src/main/resources/logback.xml index 82e11ea7..dc20de1d 100644 --- a/engine/src/main/resources/logback.xml +++ b/engine/src/main/resources/logback.xml @@ -78,4 +78,5 @@ + \ No newline at end of file diff --git a/externals/rabbit-stream/src/main/java/io/github/oasis/ext/rabbitstream/FactoryInitializer.java b/externals/rabbit-stream/src/main/java/io/github/oasis/ext/rabbitstream/FactoryInitializer.java index f159f710..67c1f857 100644 --- a/externals/rabbit-stream/src/main/java/io/github/oasis/ext/rabbitstream/FactoryInitializer.java +++ b/externals/rabbit-stream/src/main/java/io/github/oasis/ext/rabbitstream/FactoryInitializer.java @@ -21,7 +21,7 @@ import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.RecoveryDelayHandler; -import com.typesafe.config.Config; +import io.github.oasis.core.configs.OasisConfigs; import javax.net.ssl.SSLSocketFactory; import java.util.Map; @@ -72,19 +72,19 @@ static ConnectionFactory createFrom(Map configs) { return factory; } - static ConnectionFactory createFrom(Config configs) throws Exception { + static ConnectionFactory createFrom(OasisConfigs configs) throws Exception { ConnectionFactory factory = new ConnectionFactory(); factory.setHost(getStringOrDefault(configs, CONFIG_HOST, DEFAULT_HOST)); factory.setPort(getIntOrDefault(configs, CONFIG_PORT, DEFAULT_PORT)); factory.setAutomaticRecoveryEnabled(true); - if (configs.hasPath(CONFIG_VIRTUAL_HOST)) { - factory.setVirtualHost(configs.getString(CONFIG_VIRTUAL_HOST)); + if (configs.hasProperty(CONFIG_VIRTUAL_HOST)) { + factory.setVirtualHost(configs.get(CONFIG_VIRTUAL_HOST, null)); } - if (configs.hasPath(CONFIG_USER)) { - factory.setUsername(configs.getString(CONFIG_USER)); - factory.setPassword(configs.getString(CONFIG_PASSWORD)); + if (configs.hasProperty(CONFIG_USER)) { + factory.setUsername(configs.get(CONFIG_USER, null)); + factory.setPassword(configs.get(CONFIG_PASSWORD, null)); } factory.setNetworkRecoveryInterval(getIntOrDefault(configs, RabbitConstants.CONFIG_RETRY_DELAY, 5000)); @@ -93,42 +93,30 @@ static ConnectionFactory createFrom(Config configs) throws Exception { return factory; } - private static void setupSSL(ConnectionFactory factory, Config config) throws Exception { - if (config.hasPath(RabbitConstants.CONFIG_SSL)) { - Config sslConfigs = config.getObject(RabbitConstants.CONFIG_SSL).toConfig(); - if (sslConfigs.getBoolean(RabbitConstants.CONFIG_SSL_ENABLED)) { - String protocol = getStringOrDefault(sslConfigs, RabbitConstants.CONFIG_SSL_PROTOCOL, "TLSv1.2"); - boolean trustAll = getBoolOrDefault(sslConfigs, RabbitConstants.CONFIG_SSL_TRUSTALL, false); - if (trustAll) { - factory.useSslProtocol(protocol); - factory.setSocketFactory(SSLSocketFactory.getDefault()); - } else { + private static void setupSSL(ConnectionFactory factory, OasisConfigs config) throws Exception { + if (config.hasProperty(RabbitConstants.CONFIG_SSL) && config.getBoolean("ssl.enabled", false)) { + String protocol = config.get("ssl.protocol", "TLSv1.2"); + boolean trustAll = config.getBoolean("ssl.trustAll", false); + if (trustAll) { + factory.useSslProtocol(protocol); + factory.setSocketFactory(SSLSocketFactory.getDefault()); + } else { - // @TODO create ssl context + // @TODO create ssl context - } } } } - private static String getStringOrDefault(Config configs, String key, String defValue) { - if (configs.hasPath(key)) { - return configs.getString(key); - } - return defValue; + private static String getStringOrDefault(OasisConfigs configs, String key, String defValue) { + return configs.get(key, defValue); } - private static int getIntOrDefault(Config configs, String key, int defValue) { - if (configs.hasPath(key)) { - return configs.getInt(key); - } - return defValue; + private static int getIntOrDefault(OasisConfigs configs, String key, int defValue) { + return configs.getInt(key, defValue); } - private static boolean getBoolOrDefault(Config configs, String key, boolean defValue) { - if (configs.hasPath(key)) { - return configs.getBoolean(key); - } - return defValue; + private static boolean getBoolOrDefault(OasisConfigs configs, String key, boolean defValue) { + return configs.getBoolean(key, defValue); } } diff --git a/pom.xml b/pom.xml index 0071aa0f..3165734e 100644 --- a/pom.xml +++ b/pom.xml @@ -55,11 +55,6 @@ ${lombok.version} provided - - com.typesafe - config - 1.4.2 - org.yaml snakeyaml diff --git a/services/events-api/Dockerfile b/services/events-api/Dockerfile index af3dc8b2..106bdc21 100644 --- a/services/events-api/Dockerfile +++ b/services/events-api/Dockerfile @@ -2,17 +2,13 @@ FROM oasis/base-java MAINTAINER Isuru Weerarathna -## 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 - WORKDIR /usr/share/oasis-events-api CMD /wait && exec java -classpath ./*:libs/* io.github.oasis.services.events.Main #ENTRYPOINT ["java", "-classpath", "./*:libs/*", "io.github.oasis.services.events.Main"] EXPOSE 8050 RUN mkdir -p /etc/oasis -ENV OASIS_CONFIG_FILE "/etc/oasis/events-api.conf" +ENV OASIS_CONFIG_FILE "/etc/oasis/events-api.yml" # Add dependency library files ADD target/libs /usr/share/oasis-events-api diff --git a/services/events-api/pom.xml b/services/events-api/pom.xml index c23e80c7..8508a949 100644 --- a/services/events-api/pom.xml +++ b/services/events-api/pom.xml @@ -35,7 +35,7 @@ io.vertx - vertx-config-hocon + vertx-config-yaml ${vertx.version} diff --git a/services/feeder/Dockerfile b/services/feeder/Dockerfile index 7caf7831..3d26ebc6 100644 --- a/services/feeder/Dockerfile +++ b/services/feeder/Dockerfile @@ -1,15 +1,12 @@ FROM oasis/base-java MAINTAINER Isuru Weerarathna -## 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 WORKDIR /usr/share/oasis-feeder CMD /wait && exec java -classpath ./*:libs/*:/etc/oasis/modules/* io.github.oasis.services.feeds.Feeder RUN mkdir -p /etc/oasis -ENV OASIS_CONFIG_FILE "/etc/oasis/feeder.conf" +ENV OASIS_CONFIG_FILE "/etc/oasis/feeder.yml" # Add dependency library files ADD target/libs /usr/share/oasis-feeder diff --git a/services/stats-api/Dockerfile b/services/stats-api/Dockerfile index 4600e9b7..23dacbb1 100644 --- a/services/stats-api/Dockerfile +++ b/services/stats-api/Dockerfile @@ -2,16 +2,12 @@ FROM oasis/base-java MAINTAINER Isuru Weerarathna -## 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 - WORKDIR /usr/share/oasis-stats-api -CMD /wait && exec java -classpath ./*:libs/*:/etc/oasis/modules/* io.github.oasis.core.services.api.StatsApiApplication --spring.config.location=file:/etc/oasis/stats-api.properties +CMD /wait && exec java -classpath ./*:libs/*:/etc/oasis/modules/* io.github.oasis.core.services.api.StatsApiApplication --spring.config.location=file:/etc/oasis/stats-api-spring.yml EXPOSE 8010 RUN mkdir -p /etc/oasis/schema -ENV OASIS_CONFIG_FILE "/etc/oasis/stats-api.conf" +ENV OASIS_CONFIG_FILE "/etc/oasis/stats-api.yml" ADD src/main/resources/io/github/oasis/db/schema /etc/oasis/schema RUN chmod -R 777 /etc/oasis diff --git a/services/stats-api/src/main/java/io/github/oasis/core/services/api/configs/StreamConfigs.java b/services/stats-api/src/main/java/io/github/oasis/core/services/api/configs/StreamConfigs.java index 044ae21a..7e5ef007 100644 --- a/services/stats-api/src/main/java/io/github/oasis/core/services/api/configs/StreamConfigs.java +++ b/services/stats-api/src/main/java/io/github/oasis/core/services/api/configs/StreamConfigs.java @@ -22,8 +22,6 @@ package io.github.oasis.core.services.api.configs; -import com.typesafe.config.Config; -import com.typesafe.config.ConfigValue; import io.github.oasis.core.configs.OasisConfigs; import io.github.oasis.core.external.EngineManagerSubscription; import io.github.oasis.core.external.EventDispatcher; @@ -34,7 +32,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.HashMap; import java.util.Map; import java.util.ServiceLoader; @@ -104,13 +101,4 @@ private EventStreamFactory loadFromServiceLoader(String dispatcherImpl) { .orElseThrow(() -> new IllegalStateException("Unknown dispatcher implementation provided! " + dispatcherImpl)); } - private Map toMap(Config config) { - Map destination = new HashMap<>(); - for (Map.Entry entry : config.entrySet()) { - destination.put(entry.getKey(), entry.getValue().unwrapped()); - } - return destination; - } - - } diff --git a/services/stats-api/src/main/resources/api.yml b/services/stats-api/src/main/resources/api.yml index ac05b6ee..e5a5378d 100644 --- a/services/stats-api/src/main/resources/api.yml +++ b/services/stats-api/src/main/resources/api.yml @@ -40,34 +40,34 @@ oasis: maxIdle: 16 minIdle: 4 - dispatcher: - impl: "io.github.oasis.ext.kafkastream.KafkaStreamFactory" - configs: - brokerUrls: "localhost:29092" + dispatcher: + impl: "io.github.oasis.ext.kafkastream.KafkaStreamFactory" + configs: + brokerUrls: "localhost:29092" - maxConsumerThreadPoolSize: 4 - - gameEventsConsumer: - # groupId = "" + maxConsumerThreadPoolSize: 4 + + gameEventsConsumer: + # groupId = "" - # If not specified, this will take engine id - # instanceId = "" + # If not specified, this will take engine id + # instanceId = "" - # These props will directly feed to Kafka property configs - # Check kafka consumer documentation for supported props. - # props: - #"max.poll.records": 10, - #"session.timeout.ms": 86400000 + # These props will directly feed to Kafka property configs + # Check kafka consumer documentation for supported props. + # props: + #"max.poll.records": 10, + #"session.timeout.ms": 86400000 - broadcastConsumer: - # groupId = "" + broadcastConsumer: + # groupId = "" - # These props will directly feed to Kafka property configs - # Check kafka consumer documentation for supported props. - #props: + # These props will directly feed to Kafka property configs + # Check kafka consumer documentation for supported props. + #props: - dispatcherConfigs: - props: + dispatcherConfigs: + props: - engineEventConsumer: - props: + engineEventConsumer: + props: