demo update

This commit is contained in:
anhefti 2019-09-02 08:59:41 +02:00
parent 59c437e61d
commit bdd2b668e5
8 changed files with 164 additions and 20 deletions

View file

@ -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
EXPOSE $SERVER_PORT 9090

View file

@ -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

View file

@ -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:

View file

@ -247,6 +247,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
@ -305,6 +309,7 @@
<version>1.2.0</version>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>

View file

@ -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();
}
}

View file

@ -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);
}
}

View file

@ -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

View file

@ -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