Connect fresh Confluence install to DB without UI.
Asked by Martin Krupicka:

Hello Guys,

I am trying write script which will install Confluence, prepare PostgreSQL and automatically connect DB without using UI.

Is there any way how to configure DB connection for fresh Confluence install without UI?

Goal is to have running Confluence with connected DB, so user will add SN key trough UI.

I tried create confluence.cfg.xml file manually but I always ended with non working DB connection (no matter what I tried) .

I will be glad for any advice!

Martin


Answers:
author: Nic Brough -Adaptavist-
body: In theory, yes, you can do this. But it's not as simple as rolling your own cfg file, there's a few configuration files you have to think about (and some database horridness) you need to do

There's two end points in this process too - either you will get your confluence to a point where it is ready to run the installation UI, or you'll be going well past the licence entry point to a Confluence that has finished all the setup. Getting part way through to the point where a user enters a licence is not going to work because that happens at a point \*before\* half the config you need in your files is done, and if you put the config in the files, Confluence will think you've got further through the process and fall over.

Either your process needs to get to a point where the "initial configuration wizard" starts (and so there's no database configured yet), or you need to commission a completely installed and ready to run confluence, with the licence already in place, the install wizard effectively finished and the database populated with the all the initial data, ready for an admin to log in and set up the first space.

comments: author: Martin Krupicka
body: Hello Nic,

thank you for your answer. In my testing Confluence is up and running and waiting for serial nr and db connection string.

So you are saying that without inserting serial key is impossible connect DB to Confluence, right?

Martin


author: Nic Brough -Adaptavist-
body: No, I'm saying you either need to run the install properly, or provide a fully configured system with everything in place. You can't run a partly configured system - the installation routine only creates the config files \*after\* every part of the setup routine is complete.


author: Martin Krupicka
body: My script perform installation properly. It uses varfile method... I just need advice how to configure rest. So I am asking: Is it putting SN key into dbconfig and adding db connection string into confluence.cfg.xml file enough?


author: Nic Brough -Adaptavist-
body: No, you have to do all the things that the installation process performs, you can't have it run part way through the installation.

Yes, that does include the db connection and putting a licence key in the right places, but you also need to populate the rest of the tables in the database and set up a user and set the flags for install complete.

Note that if you want to provide a completely installed Confluence except for the licence key which you then want the users to have to enter, then there is a simple trick - build your distribution with a trial licence key. It doesn't matter if it has expired, the new Confluence will start up and run fine, but not let people create or edit pages until the admin applies a new valid licence


Tags: confluence-server

server