# Database needs bootstrap; run 'kong migrations bootstrap'

**URL:** <https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [March 30, 2019, 6:49am UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147 "2019-03-30T06:49:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![widada](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/widada/32/838_2.png) [@widada](https://discuss.konghq.com/u/widada)\
**Post date:** [March 30, 2019, 6:49am UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/1 "2019-03-30T06:49:30Z")

</div>

Hi I running KONG in kubernetes.

for 6 month our Kong pod is OK and doesn’t has an error. But today my kong pod already crash and we try to fix it by build a new pod. But we got following error :

```auto
2019/03/30 05:41:23 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
    init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
    init_by_lua:3: in main chunk

```

I’ve read similar cases like this. and they said this is a bug in kong version 1.0.x.  
Then we try to upgrading our version to 1.1.1 and still got same error.

this is our simple yml

```auto
spec:
     containers:
     - name: prd-kong
       image: kong:1.1.1
       env:

```

really appreciate the answers and suggestions

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [April 2, 2019, 9:56pm UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/2 "2019-04-02T21:56:52Z")

</div>

Hi @widada

Did you upgrade your Kong cluster before you got this error? You need to run `kong migrations bootstrap` only once in the entire lifecycle of a database for Kong.

---

<div class="post-metadata">

**Author:** ![fulvi0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fulvi0/32/1046_2.png) [@fulvi0](https://discuss.konghq.com/u/fulvi0)\
**Post date:** [May 24, 2019, 9:14pm UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/3 "2019-05-24T21:14:28Z")

</div>

Hi,

I had the same problem more than one time; happens when the pods and or the host is restarted; so I have to run `kong migrations bootstrap` and this will wipe all my configuration in Kong.

Regards,

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [May 25, 2019, 8:22pm UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/4 "2019-05-25T20:22:32Z")

</div>

Do you have persistence enabled for your Postgres pod? Is it backed by a persistent volume?  
If not, then you need to enable that to persist Kong’s configuration in the DB pod.

---

<div class="post-metadata">

**Author:** ![fulvi0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fulvi0/32/1046_2.png) [@fulvi0](https://discuss.konghq.com/u/fulvi0)\
**Post date:** [May 27, 2019, 6:03pm UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/5 "2019-05-27T18:03:32Z")

</div>

Hi @hbagdi,

Yes, we do have a PV enable for the Postgres DB.

Regards,

---

<div class="post-metadata">

**Author:** ![fulvi0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fulvi0/32/1046_2.png) [@fulvi0](https://discuss.konghq.com/u/fulvi0)\
**Post date:** [May 28, 2019, 2:19pm UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/6 "2019-05-28T14:19:16Z")

</div>

This is the error we faced.

```bash
2019/05/28 12:29:09 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
	init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
	init_by_lua:3: in main chunk

```

---

<div class="post-metadata">

**Author:** ![fulvi0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fulvi0/32/1046_2.png) [@fulvi0](https://discuss.konghq.com/u/fulvi0)\
**Post date:** [May 28, 2019, 2:36pm UTC](https://discuss.konghq.com/t/database-needs-bootstrap-run-kong-migrations-bootstrap/3147/7 "2019-05-28T14:36:10Z")

</div>

We found the issue, and was about configuration; the volume mount path it wasn’t set in the deployment config.

```auto
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgresql

```

Thank @hbagdi
