Open chlarsen opened 3 years ago
Have you had a look at the SORMAS-Docker project?
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!
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:
Create Database User, Databases and Database Schemas Exit to host and enter the pgsql jail:
Issue the following as root to create the temporal_tables extension from within the jail:
Issue the following as root from within the jail to create the sormas_user database 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:
Install SORMAS Enter the java jail and issue the following as root:
! Replace placeholders in [brackets] with their appropriate values.
Create the SORMAS Domain
Issue the following as root from within the jail:
! Replace placeholders in [brackets] with their appropriate values.
Configure the SORMAS Domain Issue the following as root from within the jail for runtime configuration:
Issue the following as root from within the jail for database configuration:
Issue the following as root from within the jail for audit database configuration:
Issue the following as root from within the jail for miscellaneous configuration:
Issue the following as root from within the jail to configure logging:
Configure SORMAS Runtime
Issue the following as root from within the jail to create required folders and to copy deployment files:
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:Edit ${DOMAINS_HOME}/${INSTANCE}.${VIRTUAL_DOMAIN}/sormas.properties as follows (only changed sections are shown):
! Do not change, until country-specific data have been loaded, because the sample data apply to Nigeria, only.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! Replace placeholders in [brackets] with their appropriate values.
! 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:
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: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: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: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:
If no country is set in sormas.properties, the log throws a somewhat less scary looking:
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!