7

I am getting following error, when I tried to start Kong in Ubuntu

kong start [-c /path/to/kong.conf]
prefix directory /usr/local/kong not found, trying to create it
2017/11/05 21:11:41 [warn] ulimit is currently set to "1024". For better performance set it to at least "4096" using "ulimit -n"
Error: /usr/local/share/lua/5.1/pgmoon/init.lua:271: missing password, required for connect

Am I missing anything?

Asger
  • 3,822
  • 3
  • 12
  • 37
  • yes but i am not sure where do i give the pass word as only commands i executed are as below $ sudo apt-get update $ sudo apt-get install openssl libpcre3 procps perl $ sudo dpkg -i kong-community-edition-0.11.1.*.deb followed by kong start. In fact I was not asked to set up user or password. so i am confused – Mallikarjuna Reddy Nov 05 '17 at 21:41
  • have you set up a postgres or cassandra Database and created an user for kong? – Matthias Seifert Nov 08 '17 at 11:00
  • @Mathias - yes i have set up postgres and created user for kong – Mallikarjuna Reddy Nov 11 '17 at 10:45

5 Answers5

9

on your psql run the following. CREATE USER kong; CREATE DATABASE kong OWNER kong; ALTER USER kong WITH PASSWORD 'password';

create a kong.config with following content. pg_user = kong pg_password = password

Run the migration and start kong (might require sudo) $ kong migrations up -c kong.config $ kong start -c kong.config

beebek
  • 1,893
  • 5
  • 29
  • 33
  • these are the general procedures/steps for starting kong, and not the solution to the above problem. @beebek this doesn't solve this issue. – Aman Singh Mar 20 '18 at 08:44
  • 1
    @beebek your answer helped me. The Kong installation docs don't mention creation of /etc/kong/kong.conf with the contents he posted, or running the "alter user" statement in Postgres. I was having the same problem and this fixed it for me. – Andy Aug 24 '18 at 13:29
  • but this doesn't help with the db-less method kong specified on their docs – HexaCrop Feb 17 '21 at 07:55
3

your command is right, you just have to remove the "[" from the commands. That's an indication of optional argument in the kong-documentaion. So the right command would just be:

kong start -c /path/to/your/kong.conf

Make sure to have updated and uncommented out the following fields in the kong.conf beforehand:

database = postgres (as in your case)
pg_host = your_host_address (127.0.0.1 by default)
pg_port = your_psql_port_address (5432 by default)
pg_user = your_psql_db_user (kong as per documentation of kong)
pg_password = your_psql_db_user's_password
pg_database = your_db_for_kong (kong as per documentation of kong)

If the proposed solution helped you, kindly close the question by accepting it as the answer. Thanks!

Aman Singh
  • 1,111
  • 3
  • 17
  • 31
1

I have the same error, probably that your postgresql version is too old :

kong start -c kong.conf Error: [postgres error] Kong requires PostgreSQL 9.5 or greater (currently using 9.2)

Dubrzr
  • 317
  • 3
  • 16
0

In my case, I was trying out the kong migrations bootstrap command by providing a custom path to the kong.conf file and I was getting the exact same error: missing password, required for connect

and in the verbose logs of kong migrations bootstrap I saw that the command always looks for the conf file in a set of pre-defined paths

kong migrations bootstrap ./kong.conf --v
2021/02/05 09:51:52 [verbose] Kong: 2.3.1
2021/02/05 09:51:52 [verbose] no config file found at /etc/kong/kong.conf
2021/02/05 09:51:52 [verbose] no config file found at /etc/kong.conf
2021/02/05 09:51:52 [verbose] no config file, skip loading

So I copied my kong.conf file to /etc/kong/ and it started working fine

Sagar Kalburgi
  • 89
  • 2
  • 14
0

once you go with @beebek's solution then you need to change the corresponding changes on the config files and then bootstrap the migrations with the command

kong migrations bootstrap

If you are on ubuntu follow with this doc

docs

And if you are looking into the db-less docs, Here is one

db-less

HexaCrop
  • 3,863
  • 2
  • 23
  • 50