Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to avoid "Database Contains Existing Confluence Data" with Docker container?

Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

Hi fellow Community members!

I'm migrating a Confluence instance from a regular setup to Docker/ Kubernetes with Atlassian's official image.
My database already contains the data and I don't need to run the database setup wizard again.

I'm using the ATL_DB_TYPE, ATL_JDBC_USER, ATL_JDBC_URL, ATL_JDBC_PASSWORD environment variables. This generates the confluence.cfg.xml file when the container starts.

When navigating to Confluence I get Database Contains Existing Confluence Data.

I noticed this in the config file when comparing it with the classic setup:

  1. There is no  <property name="hibernate.setup">true</property>line.
  2. <setupStep>xxxxx</setupStep> so is not set to complete. (I forgot what the actual value was.

So I added that "missing" line and set the <setupStep>Complete</setupStep> and restarted the container.
This time Confluence does start. I'm getting some other database errors but I think they are related to a database migration we ran.

Does anyone have experience with this? I read about How to Generate a New confluence.cfg.xml but I do not expect a container to need that kind of manual actions.

 

1 answer

1 accepted

1 vote
Answer accepted
Yevhen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2021

@Charlie Misonne you will have to migrate home directory that has config file - if it exists it won't be recreated. So, when migrating, I'd start with migrating home directory to a volume (PVC in case of K8s) and run the container with JDBC envs. This should be enough.

Btw, have you checked https://github.com/atlassian-labs/data-center-helm-charts?

Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

Hi Yevhen!

Thanks for the quick reply.

Ok I have a PVC already for the home directory but as I'm just testing at the moment I didn't move the whole home directory yet. I will give it a shot.

I'm not using the helm chart for this project. Perhaps I'll use it in the future. Thanks!

Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

@Yevhen 

In the Kubernetes environment I'm using another database host. I now copied the home directory from the original environment but of course the database settings are now pointing to the previous host. The environment variables are not replacing the old values.

So should I manually adapt the values in the confluence.cfg.xml in my PCV to use the new database?

Yevhen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2021

Hey Charlie! I guess you do not need an entire home dir. Just some critical directories. Unfortunately, I am not well versed in what are those for Confluence (I am a Bamboo guy :) )

If you have a PVC bound to a PV, I'd probably start a throw away pod with a command like tail -f /dev/null, mount home using this PVC, and then kubectl cp files in there. I'd probably use Confluence image for that to avoid any permission issues. Once done start Confluence the normal way.

You can also build an image with your current home directory and use it in an initContainer (just once) that will copy files to mounted directory.

It is possible that chmod or chown may be required - it depends on your storage backend and security policies.

You asked a good question, and I think we'll be working on migrate-to-k8s guides.

Yevhen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2021

@Charlie Misonne yes, if DB settings changed, you'll need to update them in cfg file.

Python entrypoint in the image will generate the file, however, it'll skip it if it exists. You should even see some logs saying that. So yes, it looks like moving cfg file to a volume and making edits there is the fastest way to migrate.

Like Charlie Misonne likes this
Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

Alright got it.

By copying the original file and making some manual changes it works indeed.

Thanks! 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events