I'm encountering an error when trying to do migrations bootstrap for kong, can anyone please help?

serene@ubuntu:~$ sudo kong migrations bootstrap -c /etc/kong/kong.conf --v
2020/10/19 02:21:04 [verbose] Kong: 2.1.4
2020/10/19 02:21:04 [verbose] reading config file at /etc/kong/kong.conf
2020/10/19 02:21:04 [verbose] prefix in use: /usr/local/kong
Error:
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:95: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: Transport endpoint is not connected
stack traceback:
        [C]: in function 'assert'
        /usr/local/share/lua/5.1/kong/cmd/migrations.lua:95: in function 'cmd_exec'
        /usr/local/share/lua/5.1/kong/cmd/init.lua:88: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:88>
        [C]: in function 'xpcall'
        /usr/local/share/lua/5.1/kong/cmd/init.lua:88: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:45>
        /usr/local/bin/kong:9: in function 'file_gen'
        init_worker_by_lua:50: in function <init_worker_by_lua:48>
        [C]: in function 'xpcall'
        init_worker_by_lua:57: in function <init_worker_by_lua:55>

I am using WSL, Ubuntu 18.04 LTS, I've installed kong v2.1.4, postgresql 12 on it

serene@ubuntu:~$ kong version
2.1.4
serene@ubuntu:~$ dpkg -l | grep postgres
ii  pgdg-keyring                   2018.2                              all          keyring for apt.postgresql.org
ii  postgresql-12                  12.4-1.pgdg18.04+1                  amd64        object-relational SQL database, version 12 server
ii  postgresql-client-12           12.4-1.pgdg18.04+1                  amd64        front-end programs for PostgreSQL 12
ii  postgresql-client-common       220.pgdg18.04+1                     all          manager for multiple PostgreSQL client versions
ii  postgresql-common              220.pgdg18.04+1                     all          PostgreSQL database-cluster manager

I have started the postgresql service. I have configured kong.conf as follows

database = postgres
pg_host = 127.0.0.1
pg_port = 5433
pg_timeout = 5000
pg_user = kong
pg_password = kong                                                                          
pg_database = kong
pg_ssl = off 
pg_ssl_verify = off
pg_max_concurrent_queries = 0 
pg_semaphore_timeout = 60000 

I have also configured a user in postgres called kong with password 'kong' as owner of database called 'kong.

serene@ubuntu:~$ sudo -u postgres psql
psql (12.4 (Ubuntu 12.4-1.pgdg18.04+1))
Type "help" for help.

postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 kong      | kong     | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/kong             +
           |          |          |         |         | kong=CTc/kong
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
(4 rows)

postgres=#

Initially I was using WSL Ubuntu 20.04, Kong 2.1.4, Postgresql 13. Same error. Did a fresh install of those. Same error. Deleted Ubuntu 20.04 and installed Ubuntu 18.04 and reinstall Kong 2.1.4 and Postgresql 13. Same error. Heard someone had troubles with Postgresql 13 when installing Kong, so I went and did a fresh install for Postgresql 12, still same error.

Is there anyone who knows what went wrong and how I can rectify this?

0

There are 0 best solutions below