jinja2.exceptions.TemplateNotFound
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Bamboo fails to start when migrating a standalone instance to Kubernetes cluster using Helm chart with an error seen in the UI "Database contains existing data", and with the log;
INFO:root:Generating /opt/atlassian/bamboo/atlassian-bamboo/WEB-INF/classes/database-defaults/[postgresql].properties from template [postgresql].properties.j2
Traceback (most recent call last):
File "/entrypoint.py", line 39, in <module>
gen_cfg(f"{ATL_DB_TYPE}.properties.j2",
File "/entrypoint_helpers.py", line 66, in gen_cfg
cfg = jenv.get_template(tmpl).render(env)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 997, in get_template
return self._load_template(name, globals)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 958, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
File "/usr/lib/python3/dist-packages/jinja2/loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
File "/usr/lib/python3/dist-packages/jinja2/loaders.py", line 214, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: [postgresql].properties.j2
Cause
- Bamboo Exported shared data is not present in the shared volume mount location.
Wrong database connection configuration .
database: type: postgresql url: - 'jdbc:postgresql://domain:5432/bamboo'
Solution
- To export Bamboo to a K8 cluster, ensure Bamboo shared home data is exported or present in the shared persistent volume directory.
Use
key:value
pair for the database URL configurationurl:jdbc:postgresql://domain:5432/bamboo
and not list value
key:[value]