SORMAS-Foundation / SORMAS-Project

SORMAS (Surveillance, Outbreak Response Management and Analysis System) is an early warning and management system to fight the spread of infectious diseases.
https://sormas.org
GNU General Public License v3.0
293 stars 143 forks source link

SORMAS in a FreeBSD Jail #5182

Open chlarsen opened 3 years ago

chlarsen commented 3 years ago

The SORMAS installation process is well scripted, which comes at a price, as a bit of reverse engineering is required to get a functional installation going on related, but somewhat differing platforms, such as FreeBSD. What follows is a run down of my attempts so far:

The situation: FreeBSD 12.3, with SORMAS running in a jail behind an Nginx reverse proxy (in a different jail) and PostgreSQL 12.6 in yet another jail; PostgreSQL backups are an automated process there. Inside the java jail, we have OpenJDK8 and Payara 5.2020.4 as compiled FreeBSD ports; the folder layout follows the FreeBSD Payara port's default layout.

Create System User and Group

Enter the java jail and issue the following as root to create the non-privileged payara user:

qjail console java
setenv INSTANCE payara
setenv INSTANCE_UID_GID 6080
pw groupadd ${INSTANCE} -g ${INSTANCE_UID_GID}
pw useradd -c "${INSTANCE} user" -d /usr/local/${INSTANCE}/glassfish -n ${INSTANCE} -s /bin/sh -u ${INSTANCE_UID_GID} -w no

Create Database User, Databases and Database Schemas Exit to host and enter the pgsql jail:

exit
qjail console pgsql

Issue the following as root to create the temporal_tables extension from within the jail:

cd /tmp
git clone https://github.com/arkhipov/temporal_tables
cd temporal_tables
gmake
gmake install
rm -rf /tmp/temporal_tables

Issue the following as root from within the jail to create the sormas_user database user:

su - postgres
setenv INSTANCE sormassu - postgres
setenv INSTANCE sormas
createuser --encrypted --createdb --no-createrole --no-superuser --pwprompt ${INSTANCE}_user

Enter password for new role: [[instance]_user password] Enter it again: [[instance]_user password]

Issue the following as postgres user to create required databases and install required extensions:

cat > /tmp/setup.sql << EOF
CREATE DATABASE ${INSTANCE}_db WITH OWNER = '${INSTANCE}_user' ENCODING = 'UTF8';
CREATE DATABASE ${INSTANCE}_audit_db WITH OWNER = '${INSTANCE}_user' ENCODING = 'UTF8';
\\c ${INSTANCE}_db
CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;
ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO ${INSTANCE}_user;
CREATE EXTENSION temporal_tables;
CREATE EXTENSION pg_trgm;
CREATE EXTENSION pgcrypto;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO ${INSTANCE}_user;
\\c ${INSTANCE}_audit_db
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO ${INSTANCE}_user;
ALTER TABLE IF EXISTS schema_version OWNER TO ${INSTANCE}_user;
EOF
cat /tmp/setup.sql | psql
rm -f /tmp/setup.sql
exit
exit

Install SORMAS Enter the java jail and issue the following as root:

qjail console java
setenv INSTANCE sormas
setenv VIRTUAL_DOMAIN [my.domain]
setenv SORMAS_VERSION [1.58.3]
setenv PGSQL_PASSWORD [[instance]_user password]
setenv PORT_BASE 6080
setenv PORT_ADMIN 6048
setenv PAYARA_HOME "/usr/local/payara-5"
setenv DOMAINS_HOME "/var/payara/payara-5/domains"
setenv DOWNLOADS_PATH "/var/www/${VIRTUAL_DOMAIN}/${INSTANCE}/downloads"
setenv DB_JDBC_MAXPOOLSIZE 128
mkdir -p /root/packages/${INSTANCE}
cd /root/packages/${INSTANCE}
fetch https://github.com/hzi-braunschweig/SORMAS-Project/releases/download/v${SORMAS_VERSION}/sormas_${SORMAS_VERSION}.zip
chown -R root:wheel /root
chmod -R 600 /root
chmod -R u+X /root
chmod -R 700 /root/bin
cd /usr/local
unzip /root/packages/${INSTANCE}/sormas_${SORMAS_VERSION}.zip
mv /usr/local/deploy /usr/local/${INSTANCE}-setup
mkdir -p /usr/local/${INSTANCE}-setup/backup
chmod +x /usr/local/${INSTANCE}-setup/*.sh

! Replace placeholders in [brackets] with their appropriate values.

Create the SORMAS Domain

Issue the following as root from within the jail:

${PAYARA_HOME}/bin/asadmin create-domain --domaindir "${DOMAINS_HOME}" --portbase "${PORT_BASE}" --nopassword --template ${PAYARA_HOME}/glassfish/common/templates/gf/production-domain.jar "${INSTANCE}.${VIRTUAL_DOMAIN}"
${PAYARA_HOME}/bin/asadmin start-domain --domaindir ${DOMAINS_HOME} ${INSTANCE}.${VIRTUAL_DOMAIN}

! Replace placeholders in [brackets] with their appropriate values.

Configure the SORMAS Domain Issue the following as root from within the jail for runtime configuration:

${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} delete-jvm-options -Xms2g
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} delete-jvm-options -Xmx2g
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-jvm-options -Xmx4096m
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} set configs.config.server-config.admin-service.das-config.autodeploy-enabled=true
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} set configs.config.server-config.admin-service.das-config.dynamic-reload-enabled=true

Issue the following as root from within the jail for database configuration:

${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-jdbc-connection-pool --restype javax.sql.ConnectionPoolDataSource \
    --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource --isconnectvalidatereq true \
    --validationmethod custom-validation --validationclassname org.glassfish.api.jdbc.validatin.PostgresConnectionValidation \
    --maxpoolsize ${DB_JDBC_MAXPOOLSIZE} \
    --property \
"portNumber=5432:databaseName=${INSTANCE}_db:serverName=pgsql.jail.vlan:user=${INSTANCE}_user:password=${PGSQL_PASSWORD}" \
    ${INSTANCE}.${VIRTUAL_DOMAIN}DataPool
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-jdbc-resource --connectionpoolid ${INSTANCE}.${VIRTUAL_DOMAIN}DataPool \
    jdbc/sormasDataPool

Issue the following as root from within the jail for audit database configuration:

${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-jdbc-connection-pool --restype javax.sql.XADataSource \
    --datasourceclassname org.postgresql.xa.PGXADataSource --isconnectvalidatereq true --validationmethod custom-validation \
    --validationclassname org.glassfish.api.jdbc.validation.PostgresConnectionValidation --maxpoolsize ${DB_JDBC_MAXPOOLSIZE} \
    --property \    "portNumber=5432:databaseName=${INSTANCE}_audit_db:serverName=pgsql.jail.vlan:user=${INSTANCE}_user:password=${PGSQL_PASSWORD}" \
    ${INSTANCE}.${VIRTUAL_DOMAIN}AuditlogPool
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-jdbc-resource \
    --connectionpoolid ${INSTANCE}.${VIRTUAL_DOMAIN}AuditlogPool jdbc/AuditlogPool

Issue the following as root from within the jail for miscellaneous configuration:

${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-javamail-resource --mailhost mail.jail.vlan --mailuser user \
    --fromaddress "no-reply@synalinq.com" mail/MailSession
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-custom-resource --restype java.util.Properties \
    --factoryclass org.glassfish.resources.custom.factory.PropertiesFactory \
    --property 'org.glassfish.resources.custom.factory.PropertiesFactory.fileName=\${com.sun.aas.instanceRoot}/sormas.properties' \
    sormas/Properties

Issue the following as root from within the jail to configure logging:

${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} create-jvm-options \
    '-Dlogback.configurationFile=\${com.sun.aas.instanceRoot}/config/logback.xml'
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} \
    set-log-attributes com.sun.enterprise.server.logging.GFFileHandler.maxHistoryFiles=14
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} \
    set-log-attributes com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes=0
${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} \
    set-log-attributes com.sun.enterprise.server.logging.GFFileHandler.rotationOnDateChange=true
#${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} set-log-levels org.wamblee.glassfish.auth.HexEncoder=SEVERE
#${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN} set-log-levels javax.enterprise.system.util=SEVERE

Configure SORMAS Runtime

Issue the following as root from within the jail to create required folders and to copy deployment files:

mkdir -p ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/temp
mkdir -p ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/documents
mkdir -p ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/generated
mkdir -p ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/custom/about
mkdir -p ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/sormas2sormas
mkdir -p ${DOWNLOADS_PATH}
cp /usr/local/${INSTANCE}-setup/sormas.properties ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/sormas.properties
cp /usr/local/${INSTANCE}-setup/sormas.properties ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/sormas.properties.orig
cp /usr/local/${INSTANCE}-setup/logback.xml ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/config/
chown -R payara:payara ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}
chmod -R 640 ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}
chmod -R ug+X ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}

Issue the following as root from within the jail to delete default domains and to restart the server: rm -rf ${PAYARA_HOME}/glassfish/domains/domain1 ${PAYARA_HOME}/glassfish/domains/production Edit etc/rc.conf to start SORMAS inside Paraya start automatically on system boot-up:

cat >> /etc/rc.conf << EOF

# enable payara
payara_enable="YES"
payara_domain="${INSTANCE}.${VIRTUAL_DOMAIN}"
EOF

Edit ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/sormas.properties as follows (only changed sections are shown):

#country.epidprefix=
country.epidprefix=NIE
#country.name=
country.name=nigeria

! Do not change, until country-specific data have been loaded, because the sample data apply to Nigeria, only.

#country.center.latitude=
country.center.latitude=[latitude]

! Replace placeholders in [brackets] with their appropriate values.

#country.center.longitude=
country.center.longitude=[longitude]

! Replace placeholders in [brackets] with their appropriate values.

#map.zoom=
map.zoom=[6]

! Replace placeholders in [brackets] with their appropriate values.

#app.url=
app.url=https://[instance].[virtual domain]/downloads/sormas-%version-release.apk 

! Replace placeholders in [brackets] with their appropriate values.

#documents.path=/opt/sormas/documents/
documents.path=/var/paraya/paraya-5/[instance].[virtual_domain]/documents/

! Replace placeholders in [brackets] with their appropriate values.

#temp.path=/opt/sormas/temp/
temp.path=/var/paraya/paraya-5/[instance].[virtual_domain]/temp/

! Replace placeholders in [brackets] with their appropriate values.

#generated.path=/opt/sormas/generated/
generated.path=/var/paraya/paraya-5/[instance].[virtual_domain]/generated/

! Replace placeholders in [brackets] with their appropriate values.

#custom.path=/opt/sormas/custom/
custom.path=/var/paraya/paraya-5/[instance].[virtual_domain]/custom/

! Replace placeholders in [brackets] with their appropriate values.

#sormas2sormas.path=/opt/sormas/sormas2sormas/
sormas2sormas.path=/var/paraya/paraya-5/[instance].[virtual_domain]/sormas2sormas/

! Replace placeholders in [brackets] with their appropriate values.

#email.sender.address=noreply@sormas.org
email.sender.address=no-reply@[virtual_domain]

! Replace placeholders in [brackets] with their appropriate values.

Deploy or Update the New SORMAS Instance ! The following steps are required for new as well as existing installations. ! Create a PostgreSQL database backup before proceeding. Issue the following as root from within the jail to delete stale web application files:

rm ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/autodeploy/*.ear
rm ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/autodeploy/*.war
rm ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/autodeploy/*.?ar_deployFailed
rm -rf ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/autodeploy/.autodeploystatus

Issue the following as root from within the jail to stop the instance: service payara stop Issue the following as root from within the jail to copy server libraries:

cp -f /usr/local/sormas-setup/serverlibs/* ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/lib/
cp -f /usr/local/${INSTANCE}-setup/login*.html ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/custom/

Issue the following as root from within the jail to start the instance: service payara start Copy the SORMAS Android app to the dedicated download path by issuing the following as root from within the jail: cp -f /usr/local/sormas-setup/android/release/*.apk ${DOWNLOADS_PATH}/ Issue the following as root from within the jail to atu-deploy the web application files:

cp /usr/local/sormas-setup/apps/*.ear ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/autodeploy/
cp /usr/local/sormas-setup/apps/*.war ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/autodeploy/

Issie the following as root from within the jail to make server logs more accessible: ln -s ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/logs /var/log/payara Issue the following as root from within the jail to adjust permissions:

chown -R payara:payara ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}
chmod -R 640 ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}
chmod -R ug+X ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}

WHAT I GOT: Payara is behaving admirably, but the last step, where .ear and .war files are copied across for auto-deployment, fails for sormas-ear.ear and sormas-ui-war. sormas-rest.war gets deployed alright. Here is what the log says:

[2021-04-21T22:59:27.021+0200] [Payara 5.2020.4] [SEVERE] [] [javax.enterprise.web] [tid: _ThreadID=32 _ThreadName=RunLevelControllerThread-16190
38695067] [timeMillis: 1619038767021] [levelValue: 1000] [[
  WebModule[/sormas-rest]Exception starting filter de.symeda.sormas.rest.security.KeycloakFilter
java.lang.InstantiationException
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:128)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:5113)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5767)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:619)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:958)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:941)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1824)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1576)
        at com.sun.enterprise.web.WebApplication.start(WebApplication.java:108)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:123)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:283)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:383)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:623)
        at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:332)
        at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:303)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: java.lang.RuntimeException: Lookup failed for 'java:global/sormas-ear/sormas-backend/ConfigFacade' in
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba
.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
        at de.symeda.sormas.rest.security.KeycloakFilter.init(KeycloakFilter.java:62)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:273)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)
        ... 27 more
Caused by: java.lang.RuntimeException: Lookup failed for 'java:global/sormas-ear/sormas-backend/ConfigFacade' in SerialContext[myEnv={java.naming
.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDISt
ateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
        at de.symeda.sormas.api.FacadeProvider.lookupEjbRemote(FacadeProvider.java:420)
        at de.symeda.sormas.api.FacadeProvider.getConfigFacade(FacadeProvider.java:234)
        at de.symeda.sormas.rest.security.KeycloakFilter.init(KeycloakFilter.java:58)
        ... 29 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:global/sormas-ear/sormas-backend/ConfigFacade' in SerialContext[myEnv={java.nami
ng.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDI
StateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: sormas-ear]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:496)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at de.symeda.sormas.api.FacadeProvider.lookupEjbRemote(FacadeProvider.java:418)
        ... 31 more
Caused by: javax.naming.NameNotFoundException: sormas-ear
        at com.sun.enterprise.naming.impl.TransientContext.resolveContext(TransientContext.java:299)
        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:207)
        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:208)
        at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:70)
        at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:114)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:483)
        ... 35 more
]]

If no country is set in sormas.properties, the log throws a somewhat less scary looking:

[2021-04-22T00:00:43.343+0200] [Payara 5.2020.4] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=29 _ThreadName=RunLevelControllerThread-1619042403887] [timeMillis: 1619042443343] [levelValue: 1000] [[
  Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method]]

[2021-04-22T00:00:43.344+0200] [Payara 5.2020.4] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=29 _ThreadName=RunLevelControllerThread-1619042403887] [timeMillis: 1619042443344] [levelValue: 1000] [[
  Exception while preparing the app]]

[2021-04-22T00:00:43.345+0200] [Payara 5.2020.4] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=29 _ThreadName=RunLevelControllerThread-1619042403887] [timeMillis: 1619042443345] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.RuntimeException: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for /usr/local/payara-5.2020.4/glassfish/domains/sormas.synalinq.com/applications/sormas-rest.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected
    at org.glassfish.ejb.startup.EjbDeployer.prepare(EjbDeployer.java:189)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:1101)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:503)
    at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:413)
    at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:246)
    at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:303)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
    at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
]]

[2021-04-22T00:00:44.404+0200] [Payara 5.2020.4] [SEVERE] [NCLS-CORE-00041] [javax.enterprise.system.core] [tid: _ThreadID=29 _ThreadName=RunLevelControllerThread-1619042403887] [timeMillis: 1619042444404] [levelValue: 1000] [[
  Application deployment failed: Exception while preparing the app]]

For the record: PostgreSQL settings have been changed to max_connections = 288 and max_prepared_transactions = 256; confirmed via psql queries. Surpisingly, NO TABLES have been created in sormas_db and sormas_audit_db. The sormas_user password is correct.

Any thoughts? Thank you so much!

fhauptmann commented 3 years ago

Have you had a look at the SORMAS-Docker project?

chlarsen commented 3 years ago

Thank you, Frank, for your quick response. FreeBSD is quite attractive, as it promotes transparency and compartmentalisation (jails), where any such compartments can be re-used safely by several users. Think for instance of PostgreSQL sitting in a jail serving (with appropriate encryption and privilege separation) several other applications/jails. This is incredibly efficient, as components can be re-used safely... and a bit different from the approach set forth by docker. This is the reason, why docker never really took off in FreeBSD. This is also the reason, why I find it hugely easier to reverse-engineer the scripts, stick to FreeBSD conventions and locations, and know exactly what is going on. (Of course, the scripts have been incredibly helpful setting this up.) So, docker is certainly not the way to go, I am afraid: It just won't work on FreeBSD the way it works on Linux. However, we are nearly, nearly there - something silly, little is missing... Any ideas would be hugely appreciated, and we would have SORMAS ready for *BSD. Thank you!