[opencms-dev] DB-Problem with CmsAutoSetup when setting up the second OCEE-Cluster-Server
Frank Engelen
f.engelen01 at googlemail.com
Thu Sep 29 11:09:20 CEST 2022
Hello there!
I'm trying to use CmsAutoSetup (org.opencms.setup) with a shell script
to automate the initial setup process for two OpenCms servers which
will join a OCEE cluster after the setup. We use a shared Postgres-DB.
Unfortunately I only get it to work if I patch the CmsAutoSetup code
because of a database error on the second server. Is there a
"unpatched" way?
On the first server I set the parameters in the config file to
db.create.db=true
db.create.tables=true
db.dropDb=true
db.name=mydb
db.template.db=template1
db.provider=postgresql
db.product=postgresql
setup.install.components=workplace
On the second server I would like to set the parameters to
db.create.db=false
db.create.tables=false
db.dropDb=false
db.name=mydb
db.template.db=template1
db.provider=postgresql
db.product=postgresql
setup.install.components=workplace
(last line only for debugging)
When I start CmsAutoSetup on the second server I get the following error:
System requirements tested successfully.
Setup-Bean initialized successfully.
DB connection tested successfully.
An error occurred during the setup process with the following error message:
You have not created the Alkacon OpenCms database.
Please have a look into the opencms log file for detailed information.
28 Sept. 2022 18:12:23,510 [r: ] ERROR
[org.opencms.setup.CmsAutoSetup: 141] You have not created the Alkacon
OpenCms database. {}
java.lang.Exception: You have not created the Alkacon OpenCms database.
at org.opencms.setup.CmsAutoSetup.setupDB(CmsAutoSetup.java:345)
~[opencms-setup.jar:?]
at org.opencms.setup.CmsAutoSetup.run(CmsAutoSetup.java:215)
~[opencms-setup.jar:?]
at org.opencms.setup.CmsAutoSetup.main(CmsAutoSetup.java:135)
[opencms-setup.jar:?]
Which is wrong, because both servers access the same database and the
second server has access to it and the first server already created
it.
With the GUI-Setup-Wizard I can use this approach and leave the three
checkboxes "Create database and user", "Create tables" and "Drop
database first if it already exists" unchecked and the second server
is installed successfully. It's only a problem with CmsAutoSetup.
If I look into the code of CmsAutoSetup.setupDB it seems to me that
there is no codepath where the boolean variable "dbExists" is changed
from the initial value "false" to "true" if isCreateDb == false &&
isCreateTables == false.
I changed the code auf CmsAutoSetup for the second server so that
CmsAutoSetup.setupDB is not called. With that patch both server are
successfully initialized and can work together in the OCEE cluster
afterwards.
Do I get something wrong? Is there a way to setup the second server
automatically without a patched CmsAutoSetup?
Best regards,
Frank
More information about the opencms-dev
mailing list