SafeExamBrowser / seb-server-setup

Cotains resources and packages to setup and install SEB-Server. Currently only docker-based setup is supported
Mozilla Public License 2.0
8 stars 13 forks source link

SEB Server fails to start #11

Closed swissclash79 closed 2 years ago

swissclash79 commented 2 years ago

Describe the bug I tried to install a demo instance for SEB Server and followed the instructions https://seb-server-setup.readthedocs.io/en/latest/install-demo.html#basic-demo.

I successfully built the Docker images but when I try to start SEB Server (Step 5: Start the services) I get the following error:

java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=seb-server-mariadb)(port=3306)(type=master) : Socket fail to connect to host:seb-server-mariadb, port:3306. seb-server-mariadb
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
    at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
    at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
    at org.mariadb.jdbc.Driver.connect(Driver.java:89)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
    at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:261)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:400)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:574)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:361)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
    at ch.ethz.seb.sebserver.webservice.servicelayer.dao.impl.WebserviceInfoDAOImpl$$EnhancerBySpringCGLIB$$b64e72fb.isInitialized(<generated>)
    at ch.ethz.seb.sebserver.webservice.WebserviceInit.onApplicationEvent(WebserviceInit.java:81)
    at ch.ethz.seb.sebserver.webservice.WebserviceInit.onApplicationEvent(WebserviceInit.java:30)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
    at org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:108)
    at org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:77)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:330)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at ch.ethz.seb.sebserver.SEBServer.main(SEBServer.java:48)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.sql.SQLNonTransientConnectionException: Socket fail to connect to host:seb-server-mariadb, port:3306. seb-server-mariadb
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:183)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createSocket(AbstractConnectProtocol.java:255)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:512)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
    ... 41 common frames omitted
Caused by: java.net.UnknownHostException: seb-server-mariadb
    at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
    at java.base/java.net.Socket.connect(Unknown Source)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createSocket(AbstractConnectProtocol.java:250)
    ... 43 common frames omitted

To Reproduce Steps to reproduce the behavior:

  1. Follow instruction here https://seb-server-setup.readthedocs.io/en/latest/install-demo.html#basic-demo2.
  2. Go to step 5 and try to start services3.

Expected behavior SEB Server is up and running.

Setup (please complete the following information):

Additional context When I view the log of the MariaDB container it shows the following errors:

ubuntu@seb-server:~/sebserver/seb-server-setup/docker/demo/basic$ docker logs --follow seb-server-mariadb
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
anhefti commented 2 years ago

Hi and thanks for the additional context, this is important. It seems that in your case (IT environment: Ubuntu 20.04 LTS running in a VM on a MacBook Pro (M1)) the MariaDB container is not starting up properly and the SEB Server connection error to the DB is just a side effect of none running DB server.

The MariaDB docker image is not created by the SEB Server setup but just fetched from the Docker-Hub repository ("mariadb/server:10.5"). Usually the MariaDB image works with the setup given in the docker-compose file within native linux and windows machines. But we have never tested it on Mac or even Ubuntu VM on Mac.

So you have to figure out first, why the mariadb/server:10.5 image is not working within your setup and throwing the above error. My first assumption is, that since the mariadb container uses some docker volume, there is going something wrong with that since this is a MacOS filesystem mapped to a VM, mapped to a container... Please try to check the volume creation on docker side with:

docker volume ls and docker volume inspect seb-server-mariadb

If this gives no clue, i suggest to try to install SEB Server on native Mac with Docker Desktop for Mac.

swissclash79 commented 2 years ago

Hi and thanks for the additional context, this is important. It seems that in your case (IT environment: Ubuntu 20.04 LTS running in a VM on a MacBook Pro (M1)) the MariaDB container is not starting up properly and the SEB Server connection error to the DB is just a side effect of none running DB server.

The MariaDB docker image is not created by the SEB Server setup but just fetched from the Docker-Hub repository ("mariadb/server:10.5"). Usually the MariaDB image works with the setup given in the docker-compose file within native linux and windows machines. But we have never tested it on Mac or even Ubuntu VM on Mac.

So you have to figure out first, why the mariadb/server:10.5 image is not working within your setup and throwing the above error. My first assumption is, that since the mariadb container uses some docker volume, there is going something wrong with that since this is a MacOS filesystem mapped to a VM, mapped to a container... Please try to check the volume creation on docker side with:

docker volume ls and docker volume inspect seb-server-mariadb

If this gives no clue, i suggest to try to install SEB Server on native Mac with Docker Desktop for Mac.

Hi Andreas

Thanks for your quick answer! Here is the output of the suggested commands:

ubuntu@seb-server-ubuntu:~/sebserver/seb-server-setup/docker/demo/basic$ docker volume ls
DRIVER    VOLUME NAME
local     basic_seb-server-logs
local     basic_seb-server-mariadb-data
ubuntu@seb-server-ubuntu:~/sebserver/seb-server-setup/docker/demo/basic$ docker volume inspect basic_seb-server-mariadb-data
[
    {
        "CreatedAt": "2022-05-19T08:52:17+02:00",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "basic",
            "com.docker.compose.version": "2.5.0",
            "com.docker.compose.volume": "seb-server-mariadb-data"
        },
        "Mountpoint": "/var/lib/docker/volumes/basic_seb-server-mariadb-data/_data",
        "Name": "basic_seb-server-mariadb-data",
        "Options": null,
        "Scope": "local"
    }
]

I successfully installed SEB Server on my MacBook Pro natively, so it seems your assumption was correct.