diff --git a/docker/demo/Dockerfile b/docker/demo/Dockerfile index 5a66f7af..85f12814 100644 --- a/docker/demo/Dockerfile +++ b/docker/demo/Dockerfile @@ -1,18 +1,28 @@ FROM alpine/git + +ARG GIT_TAG + WORKDIR /demo -RUN git clone https://github.com/SafeExamBrowser/seb-server.git +RUN git clone -b "$GIT_TAG" --depth 1 https://github.com/SafeExamBrowser/seb-server.git FROM maven:3.5-jdk-8-alpine + +ARG JAR_VERSION + WORKDIR /demo COPY --from=0 /demo/seb-server /demo RUN mvn clean install -e -P Demo -DskipTests FROM openjdk:8-jre-alpine + +ARG JAR_VERSION +ENV JAR_VERSION ${JAR_VERSION} + WORKDIR /demo -COPY --from=1 /demo/target/seb-server-0.1.0-SNAPSHOT.jar /demo +COPY --from=1 /demo/target/seb-server-"$JAR_VERSION".jar /demo ENTRYPOINT ["sh", "-c"] -CMD ["java -jar seb-server-0.1.0-SNAPSHOT.jar --spring.config.location=classpath:/config/,file:/demo/externalResources/ --server.address=0.0.0.0 --spring.profiles.active=demo"] +CMD ["java -jar seb-server-${JAR_VERSION}.jar --spring.config.location=classpath:/config/,file:/demo/externalResources/ --server.address=0.0.0.0 --spring.profiles.active=demo"] EXPOSE 8080 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6b786a57..a025fe0d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ ch.ethz.seb seb-server - 0.1.0-SNAPSHOT + 0.4.0-SNAPSHOT seb-server web-service for SEB maintenance and monitoring active SEB sessions diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java index 6cc246f2..1be8d22c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java @@ -51,7 +51,7 @@ public final class Exam implements GrantEntity, Activatable { // TODO make this a configurable exam attribute /** The number of hours to add at the start- and end-time of the exam * To add a expanded time-frame in which the exam state is running on SEB-Server side */ - public static final int EXAM_RUN_TIME_EXPAND_HOURS = 2; + public static final int EXAM_RUN_TIME_EXPAND_HOURS = 1; public static final String ATTR_STATUS = "examStatus"; public static final String FILTER_ATTR_TYPE = "type"; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/OAuth2AuthorizationContextHolder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/OAuth2AuthorizationContextHolder.java index d2c1d54b..4d985629 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/OAuth2AuthorizationContextHolder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/OAuth2AuthorizationContextHolder.java @@ -66,7 +66,7 @@ public class OAuth2AuthorizationContextHolder implements AuthorizationContextHol @Autowired public OAuth2AuthorizationContextHolder( @Value("${sebserver.webservice.api.admin.clientId}") final String guiClientId, - @Value("${sebserver.webservice.api.admin.clientId}") final String guiClientSecret, + @Value("${sebserver.webservice.api.admin.clientSecret}") final String guiClientSecret, final WebserviceURIService webserviceURIService, final ClientHttpRequestFactory clientHttpRequestFactory) { diff --git a/src/main/resources/config/application-demo.properties b/src/main/resources/config/application-demo.properties index 15af4463..40c7d567 100644 --- a/src/main/resources/config/application-demo.properties +++ b/src/main/resources/config/application-demo.properties @@ -1,17 +1,25 @@ +# 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 -spring.h2.console.enabled=true -spring.datasource.platform=h2 -spring.datasource.url=jdbc:h2:mem:demo;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE -spring.datasource.driver-class-name=org.h2.Driver +# data source configuration + +# spring.h2.console.enabled=true +# spring.datasource.platform=h2 +# spring.datasource.url=jdbc:h2:mem:demo;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +# spring.datasource.driver-class-name=org.h2.Driver + +spring.datasource.initialize=true +spring.datasource.initialization-mode=always +# NOTE: try to connect to a mariadb server on a docker container named seb-server-mariadb within the same (docker)network +spring.datasource.url=jdbc:mariadb://seb-server-mariadb:6603/SEBServer?useSSL=false&createDatabaseIfNotExist=true +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.platform=demo -logging.file=log/sebserver.log - +# webservice configuration sebserver.webservice.http.scheme=http sebserver.webservice.http.server.name=ralph.ethz.ch sebserver.webservice.http.redirect.gui=${sebserver.gui.entrypoint} @@ -26,11 +34,14 @@ 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} diff --git a/src/main/resources/config/application-dev-ws.properties b/src/main/resources/config/application-dev-ws.properties index 10ca2005..ba35f101 100644 --- a/src/main/resources/config/application-dev-ws.properties +++ b/src/main/resources/config/application-dev-ws.properties @@ -4,10 +4,10 @@ server.servlet.context-path=/ logging.file=log/sebserver.log -# +# data source configuration spring.datasource.initialize=true spring.datasource.initialization-mode=always -spring.datasource.url=jdbc:mariadb://localhost:6603/SEBServer?useSSL=false&createDatabaseIfNotExist=true +spring.datasource.url=jdbc:mariadb://ralph.ethz.ch:6603/SEBServer?useSSL=false&createDatabaseIfNotExist=true spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.platform=dev spring.datasource.hikari.max-lifetime=600000 @@ -16,6 +16,7 @@ spring.datasource.hikari.max-lifetime=600000 sebserver.webservice.distributed=true sebserver.webservice.http.scheme=http sebserver.webservice.http.server.name=${server.address} + sebserver.webservice.http.redirect.gui=/gui sebserver.webservice.api.admin.endpoint=/admin-api/v1 sebserver.webservice.api.admin.accessTokenValiditySeconds=3600 diff --git a/src/main/resources/config/application.properties b/src/main/resources/config/application.properties index 09fc503e..c90f67dd 100644 --- a/src/main/resources/config/application.properties +++ b/src/main/resources/config/application.properties @@ -5,6 +5,6 @@ spring.mandatory-file-encoding=UTF-8 spring.http.encoding.charset=UTF-8 spring.http.encoding.enabled=true -sebserver.version=0.3.5 pre-beta +sebserver.version=0.4.0 beta sebserver.supported.languages=en,de diff --git a/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java b/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java index cf8f59ba..2abab0b8 100644 --- a/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java +++ b/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java @@ -78,8 +78,8 @@ public class HTTPClientBot { public HTTPClientBot(final Map args) { - //this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://ralph.ethz.ch:8080"); - this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080"); + this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://ralph.ethz.ch:8080"); + //this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080"); this.accessTokenEndpoint = args.getOrDefault("accessTokenEndpoint", "/oauth/token"); this.clientId = args.getOrDefault("clientId", "TO_SET");