diff --git a/docker/demo/Dockerfile b/docker/demo/Dockerfile
index a5eef690..9d94fa81 100644
--- a/docker/demo/Dockerfile
+++ b/docker/demo/Dockerfile
@@ -3,7 +3,7 @@ FROM alpine/git
ARG GIT_TAG
ARG SEBSERVER_VERSION
-WORKDIR /demo
+WORKDIR /sebserver
RUN if [ "x${GIT_TAG}" = "x" ] ; \
then git clone --depth 1 https://github.com/SafeExamBrowser/seb-server.git ; \
else git clone -b "$GIT_TAG" --depth 1 https://github.com/SafeExamBrowser/seb-server.git ; fi
@@ -12,33 +12,35 @@ FROM maven:3.5-jdk-8-alpine
ARG SEBSERVER_VERSION
-WORKDIR /demo
-COPY --from=0 /demo/seb-server /demo
+WORKDIR /sebserver
+COPY --from=0 /sebserver/seb-server /sebserver
RUN mvn clean install -e -P Demo -DskipTests
FROM openjdk:8-jre-alpine
ARG SEBSERVER_VERSION
ENV SEBSERVER_VERSION=${SEBSERVER_VERSION}
-ENV SERVER_ADDRESS="0.0.0.0"
ENV SERVER_PORT="8080"
-ENV DBSERVER_ADDRESS="seb-server-mariadb"
-ENV DBSERVER_PORT="3306"
-ENV DBSERVER_PWD="[TO_SET]"
-ENV GUICLIENT_PWD="[TO_SET]"
-ENV INTERNAL_PWD="[TO_SET]"
+ENV DBSERVER_PWD=
+ENV GUICLIENT_PWD=
+ENV INTERNAL_PWD=
-WORKDIR /demo
-COPY --from=1 /demo/target/seb-server-"$SEBSERVER_VERSION"-SNAPSHOT.jar /demo
+WORKDIR /sebserver
+COPY --from=1 /sebserver/target/seb-server-"$SEBSERVER_VERSION"-SNAPSHOT.jar /sebserver
-ENTRYPOINT exec java -jar seb-server-"${SEBSERVER_VERSION}"-SNAPSHOT.jar \
+ENTRYPOINT exec java \
+ -Dcom.sun.management.jmxremote \
+ -Dcom.sun.management.jmxremote.port=9090 \
+ -Dcom.sun.management.jmxremote.rmi.port=9090 \
+ -Djava.rmi.server.hostname=127.0.0.1 \
+ -Dcom.sun.management.jmxremote.ssl=false \
+ -Dcom.sun.management.jmxremote.authenticate=false \
+ -jar seb-server-"${SEBSERVER_VERSION}"-SNAPSHOT.jar \
--server.port="${SERVER_PORT}" \
- --spring.config.location=classpath:/config/ \
- --datastore.mariadb.server.address="${DBSERVER_ADDRESS}" \
- --datastore.mariadb.server.port="${DBSERVER_PORT}" \
--spring.profiles.active=demo \
+ --spring.config.location=file:/sebserver/,classpath:/config/ \
--spring.datasource.password="${DBSERVER_PWD}" \
--sebserver.webservice.api.admin.clientSecret="${GUICLIENT_PWD}" \
--sebserver.webservice.internalSecret="${INTERNAL_PWD}"
-EXPOSE 8080
\ No newline at end of file
+EXPOSE $SERVER_PORT 9090
\ No newline at end of file
diff --git a/docker/demo/application-demo.properties b/docker/demo/application-demo.properties
new file mode 100644
index 00000000..afac8a9b
--- /dev/null
+++ b/docker/demo/application-demo.properties
@@ -0,0 +1,57 @@
+# overall server configuration
+server.address=0.0.0.0
+server.port=8080
+server.servlet.context-path=/
+server.servlet.session.cookie.http-only=true
+server.servlet.session.tracking-modes=cookie
+
+# database server
+datastore.mariadb.server.address=seb-server-mariadb
+datastore.mariadb.server.port=3306
+
+# data source configuration
+spring.datasource.username=root
+spring.datasource.initialize=true
+spring.datasource.initialization-mode=always
+spring.datasource.url=jdbc:mariadb://${datastore.mariadb.server.address}:${datastore.mariadb.server.port}/SEBServer?useSSL=false&createDatabaseIfNotExist=true
+spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
+spring.datasource.platform=demo
+
+# webservice configuration
+sebserver.test.property=This is a SEB Server Demo
+sebserver.webservice.distributed=false
+sebserver.webservice.http.scheme=http
+sebserver.webservice.http.server.name=ralph.ethz.ch
+sebserver.webservice.http.redirect.gui=${sebserver.gui.entrypoint}
+sebserver.webservice.api.admin.clientId=guiClient
+sebserver.webservice.api.admin.endpoint=/admin-api/v1
+sebserver.webservice.api.admin.accessTokenValiditySeconds=3600
+sebserver.webservice.api.admin.refreshTokenValiditySeconds=-1
+sebserver.webservice.api.exam.endpoint=/exam-api
+sebserver.webservice.api.exam.endpoint.discovery=${sebserver.webservice.api.exam.endpoint}/discovery
+sebserver.webservice.api.exam.endpoint.v1=${sebserver.webservice.api.exam.endpoint}/v1
+sebserver.webservice.api.exam.accessTokenValiditySeconds=86400
+sebserver.webservice.api.pagination.maxPageSize=500
+# comma separated list of known possible OpenEdX API access token request endpoints
+sebserver.webservice.lms.openedx.api.token.request.paths=/oauth2/access_token
+# write logs to
+logging.file=log/sebserver.log
+
+# actuator configuration
+management.endpoints.web.base-path=/actuator
+management.endpoints.web.exposure.include=logfile,loggers
+
+# GUI server configuration
+sebserver.gui.entrypoint=/gui
+sebserver.gui.webservice.protocol=http
+sebserver.gui.webservice.address=${server.address}
+sebserver.gui.webservice.port=8080
+sebserver.gui.webservice.apipath=/admin-api/v1
+sebserver.gui.theme=css/sebserver.css
+sebserver.gui.list.page.size=20
+sebserver.gui.date.displayformat=MM/dd/yyyy HH:mm
+sebserver.gui.date.displayformat.timezone=|ZZ
+sebserver.gui.multilingual=false
+sebserver.gui.languages=en
+sebserver.gui.seb.client.config.download.filename=SebClientSettings.seb
+sebserver.gui.seb.exam.config.download.filename=SebClientSettings.seb
diff --git a/docker/demo/docker-compose.yml b/docker/demo/docker-compose.yml
index ed659588..e539b9d0 100644
--- a/docker/demo/docker-compose.yml
+++ b/docker/demo/docker-compose.yml
@@ -20,15 +20,15 @@ services:
- SEBSERVER_VERSION=0.4.1-beta
container_name: seb-server
environment:
- - SERVER_ADDRESS=0.0.0.0
- SERVER_PORT=8080
- - DBSERVER_ADDRESS=seb-server-mariadb
- - DBSERVER_PORT=3306
- DBSERVER_PWD=somePW
- GUICLIENT_PWD=somePW
- INTERNAL_PWD=somePW
+ volumes:
+ - ./application-demo.properties:/sebserver/application-demo.properties
ports:
- 8080:8080
+ - 9090:9090
networks:
- ralph
depends_on:
diff --git a/pom.xml b/pom.xml
index f873ad42..18c4b595 100644
--- a/pom.xml
+++ b/pom.xml
@@ -247,6 +247,10 @@
org.springframework.boot
spring-boot-starter-cache
+
+ org.springframework.boot
+ spring-boot-starter-quartz
+
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
@@ -305,6 +309,7 @@
1.2.0
+
junit
diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/batch/BatchConfig.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/batch/BatchConfig.java
new file mode 100644
index 00000000..1e5cb5ba
--- /dev/null
+++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/batch/BatchConfig.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+package ch.ethz.seb.sebserver.webservice.servicelayer.batch;
+
+import org.quartz.CronScheduleBuilder;
+import org.quartz.JobBuilder;
+import org.quartz.JobDetail;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class BatchConfig {
+
+ @Bean
+ public JobDetail jobADetails() {
+ return JobBuilder
+ .newJob(SimpleBatchJob.class)
+ .withIdentity("sampleJobA")
+ .build();
+ }
+
+ @Bean
+ public Trigger jobATrigger(final JobDetail jobADetails) {
+
+ return TriggerBuilder
+ .newTrigger()
+ .forJob(jobADetails)
+ .withIdentity("sampleTriggerA")
+
+ .withSchedule(CronScheduleBuilder.cronSchedule("0/30 0 0 ? * * *"))
+ .startNow()
+ .build();
+ }
+
+}
diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/batch/SimpleBatchJob.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/batch/SimpleBatchJob.java
new file mode 100644
index 00000000..cdf0f7b8
--- /dev/null
+++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/batch/SimpleBatchJob.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+package ch.ethz.seb.sebserver.webservice.servicelayer.batch;
+
+import org.quartz.DisallowConcurrentExecution;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.stereotype.Component;
+
+import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientConnectionDAO;
+
+@Component
+@DisallowConcurrentExecution
+public class SimpleBatchJob implements Job {
+
+ private final ClientConnectionDAO clientConnectionDAO;
+
+ public SimpleBatchJob(final ClientConnectionDAO clientConnectionDAO) {
+ this.clientConnectionDAO = clientConnectionDAO;
+ }
+
+ @Override
+ public void execute(final JobExecutionContext context) throws JobExecutionException {
+ System.out.print("*********************** " + this.clientConnectionDAO);
+ }
+
+}
diff --git a/src/main/resources/config/application-dev-ws.properties b/src/main/resources/config/application-dev-ws.properties
index 7601db09..ac783bad 100644
--- a/src/main/resources/config/application-dev-ws.properties
+++ b/src/main/resources/config/application-dev-ws.properties
@@ -15,6 +15,9 @@ spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.idleTimeout=600000
spring.datasource.hikari.maxLifetime=1800000
+spring.quartz.job-store-type=memory
+spring.quartz.properties.org.quartz.threadPool.threadCount=2
+
# webservice configuration
sebserver.webservice.distributed=false
sebserver.webservice.http.scheme=http
diff --git a/src/main/resources/config/application.properties b/src/main/resources/config/application.properties
index 8fe4b9bb..d24325ce 100644
--- a/src/main/resources/config/application.properties
+++ b/src/main/resources/config/application.properties
@@ -1,5 +1,5 @@
spring.application.name=SEB Server
-spring.profiles.active=prod
+spring.profiles.active=dev
spring.mandatory-file-encoding=UTF-8
spring.http.encoding.charset=UTF-8