6

This is what I have tried

docker run --rm \
> --link kong-database:kong-database \
> -e "KONG_DATABASE=postgres" \
> -e "KONG_PG_HOST=kong-database" \
> kong:latest kong migrations up

But I have

Error: cannot run migrations: database needs bootstrapping; run 'kong migrations bootstrap'

I do not understand what this actually means. If I try

docker run --rm --link kong-database:kong-database -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" kong:latest kong migrations bootstrap
bootstrapping database...
Error: [PostgreSQL error] failed to bootstrap database: ERROR: syntax error at or near "NOT" (150)

I inspected kong-database

 {
        "Id": "d94ac442da9a399c1b865de49904e01085abe1ed8f0871af5830810c4c2a78dd",
        "Created": "2019-04-19T07:18:59.534751317Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 18342,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-04-19T07:19:00.129193458Z",
            "FinishedAt": "0001-01-01T00:00:00Z"

How it comes that I need to bootstrap database and why do I have problem?

Anis D
  • 761
  • 11
  • 25
Richard Rublev
  • 7,718
  • 16
  • 77
  • 121

1 Answers1

12

You have to bootstrap the database before running kong. The up command is deprecated and replaced with bootstrap

Change

kong:latest kong migrations up

To

kong:latest kong migrations bootstrap

Anis D
  • 761
  • 11
  • 25