Kong / kong

🦍 The Cloud-Native API Gateway and AI Gateway.
https://konghq.com/install/#kong-community
Apache License 2.0
39k stars 4.78k forks source link

Kong not starting in MAC #2646

Closed asingh493 closed 7 years ago

asingh493 commented 7 years ago

Summary

We were trying to install Kong (docker) on my Mac by following the instructions mentioned on the website (https://getkong.org/install/docker/ ). When it ask to start Kong…..we are facing error

KONG START /usr/local/bin/KONG:7: module 'kong.cmd.init' not found:No LuaRocks module found for kong.cmd.init no field package.preload['kong.cmd.init'] no file 'kong/cmd/init/init.lua' no file '/usr/local/openresty/site/lualib/kong/cmd/init.lua' no file '/usr/local/openresty/site/lualib/kong/cmd/init/init.lua' no file '/usr/local/openresty/lualib/kong/cmd/init.lua' no file '/usr/local/openresty/lualib/kong/cmd/init/init.lua' no file './kong/cmd/init.lua' no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta2/kong/cmd/init.lua' no file '/usr/local/share/lua/5.1/kong/cmd/init.lua' no file '/usr/local/share/lua/5.1/kong/cmd/init/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/kong/cmd/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/kong/cmd/init/init.lua' no file '/Users/asingh493/.luarocks/share/lua/5.1/kong/cmd/init.lua' no file '/Users/asingh493/.luarocks/share/lua/5.1/kong/cmd/init/init.lua' no file '/usr/local/openresty/site/lualib/kong/cmd/init.so' no file '/usr/local/openresty/lualib/kong/cmd/init.so' no file './kong/cmd/init.so' no file '/usr/local/lib/lua/5.1/kong/cmd/init.so' no file '/usr/local/openresty/luajit/lib/lua/5.1/kong/cmd/init.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/Users/asingh493/.luarocks/lib/lua/5.1/kong/cmd/init.so' no file '/usr/local/openresty/site/lualib/kong.so' no file '/usr/local/openresty/lualib/kong.so' no file './kong.so' no file '/usr/local/lib/lua/5.1/kong.so' no file '/usr/local/openresty/luajit/lib/lua/5.1/kong.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/Users/asingh493/.luarocks/lib/lua/5.1/kong.so'

Steps To Reproduce

as per website https://getkong.org/install/docker/

  1. docker run -d --name kong-database \ -p 9042:9042 \ cassandra:3.10
  2. docker run -d --name kong \ --link kong-database:kong-database \ -e "KONG_DATABASE=cassandra" \ -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \ -e "KONG_PG_HOST=kong-database" \ -p 8000:8000 \ -p 8443:8443 \ -p 8001:8001 \ -p 7946:7946 \ -p 7946:7946/udp \ kong:latest
  3. Kong Start

Additional Details & Logs

shashiranjan84 commented 7 years ago

@asingh493 would you please try again, I tried locally on my mac and it just worked fine. Also please give it a try with image kong:0.10.3

image

asingh493 commented 7 years ago

It seems problem was because of Docker Machine. I installed Docker toolbox and as a result, there was a default docker machine and as a result, if I just issue command like curl http://127.0.0.1:8001......give connection refused.

But if I give cmd like

curl http://192.168.99.100:8001....I see a response.

asingh493 commented 7 years ago

So I removed everything....and installed native Docker. once I installed Kong again...I see the same problem.

asingh493$ kong stop /usr/local/bin/kong:7: module 'kong.cmd.init' not found:No LuaRocks module found for kong.cmd.init no field package.preload['kong.cmd.init'] no file 'kong/cmd/init/init.lua' no file '/usr/local/openresty/site/lualib/kong/cmd/init.lua' no file '/usr/local/openresty/site/lualib/kong/cmd/init/init.lua' no file '/usr/local/openresty/lualib/kong/cmd/init.lua' no file '/usr/local/openresty/lualib/kong/cmd/init/init.lua' no file './kong/cmd/init.lua' no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta2/kong/cmd/init.lua' no file '/usr/local/share/lua/5.1/kong/cmd/init.lua' no file '/usr/local/share/lua/5.1/kong/cmd/init/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/kong/cmd/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/kong/cmd/init/init.lua' no file '/Users/asingh493/.luarocks/share/lua/5.1/kong/cmd/init.lua' no file '/Users/asingh493/.luarocks/share/lua/5.1/kong/cmd/init/init.lua' no file '/usr/local/openresty/site/lualib/kong/cmd/init.so' no file '/usr/local/openresty/lualib/kong/cmd/init.so' no file './kong/cmd/init.so' no file '/usr/local/lib/lua/5.1/kong/cmd/init.so' no file '/usr/local/openresty/luajit/lib/lua/5.1/kong/cmd/init.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/Users/asingh493/.luarocks/lib/lua/5.1/kong/cmd/init.so' no file '/usr/local/openresty/site/lualib/kong.so' no file '/usr/local/openresty/lualib/kong.so' no file './kong.so' no file '/usr/local/lib/lua/5.1/kong.so' no file '/usr/local/openresty/luajit/lib/lua/5.1/kong.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/Users/asingh493/.luarocks/lib/lua/5.1/kong.so'

thibaultcha commented 7 years ago

Are you running those commands on your host machine instead of inside the container? It looks like it, since the steps you described show:

  1. docker run kong:latest (this should start Kong in the created container already)
  2. kong start (if you did not ssh into your container, this will attempt to start Kong into the host machine, where Kong doesn't seem to be installed...)

The 0.10 family of images has been released for a while and running in production with no such issue.

asingh493 commented 7 years ago

I’m just following your docs. In that case you need to update your doc.


Cheers Abhishek Singh PMP, CSM, SAFe, CSPO DXC | EGL | Bengaluru | India Ph: + 91 80 61762299 | CUG: 762299

From: Thibault Charbonnier notifications@github.com Reply-To: Mashape/kong reply@reply.github.com Date: Monday, 26 June 2017 at 6:52 PM To: Mashape/kong kong@noreply.github.com Cc: "Singh, Abhishek 5" asingh493@csc.com, Mention mention@noreply.github.com Subject: Re: [Mashape/kong] Kong not starting in MAC (#2646)

Are you running those commands on your host machine instead of inside the container? It looks like it, since the steps you described show:

  1. docker run kong:latest (this should start Kong in the created container already)
  2. kong start (if you did not ssh into your container, this will attempt to start Kong into the host machine, where Kong doesn't seem to be installed...)

The 0.10 family of images has been released for a while and running in production with no such issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Mashape/kong/issues/2646#issuecomment-311057661, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AS5RdIt9zddKpZTDQXvWEcD6va9Levzgks5sH7CzgaJpZM4ODTzx.

CSC Technologies India Private Limited (a DXC Technology Company) - Unit 13, Block 2, SDF Bldgs, MEPZ SEZ, Tambaram, Chennai 600 045, Tamil Nadu. Registered in India, CIN: U72900TN2015FTC102489. DXC Technology Company -- This message is transmitted to you by or on behalf of DXC Technology Company or one of its affiliates. It is intended exclusively for the addressee. The substance of this message, along with any attachments, may contain proprietary, confidential or privileged information or information that is otherwise legally exempt from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate any part of this message. If you have received this message in error, please destroy and delete all copies and notify the sender by return e-mail. Regardless of content, this e-mail shall not operate to bind DXC Technology Company or any of its affiliates to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.

thibaultcha commented 7 years ago

The doc does not instruct to run kong start. If you hit the admin API on your container's IP, it seems to work?

asingh493 commented 7 years ago

yes… once I give curl http://127.0.0.1:8001

I get response.

asingh493 commented 7 years ago

but I see same error whenever I try to issue Kong commands as per doc https://getkong.org/docs/0.10.x/getting-started/quickstart/

kong start kong stop kong reload

Can you please suggest how can I make use of these commands?

p0pr0ck5 commented 7 years ago

@asingh493 the commands above need to be issued inside the machine/container running Kong, not the Docker host.

asingh493 commented 7 years ago

thanks @p0pr0ck5

Will try....Kong document does not talk about if these commands need to be run inside the container.

p0pr0ck5 commented 7 years ago

@asingh493 the docs assume, I think, some basic knowledge of using Docker in the context. The docs are also open source at github.com/mashape/getkong.org; feel free to submit a PR to improve them if you think they are lacking. Thanks! :)

NICK-DUAN commented 4 years ago

i also got this problem in my mac, anyone has a solution? it's 2020! it's not in docker, just in my mac machine.

louisluhao commented 4 years ago

i also got this problem in my mac, anyone has a solution? it's 2020! it's not in docker, just in my mac machine.

I got the similar error, completely followed https://docs.konghq.com/install/source/?_ga=2.262757068.1939498096.1595639928-1882141532.1595639928

mariuswang007 commented 4 years ago

steps followed https://docs.konghq.com/install/source/ similar error in ubuntu 18.04 when start kong: Linux version 4.15.0-76-generic (buildd@lcy01-amd64-029) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020

image

610991905 commented 3 years ago

i also got this problem in my mac, anyone has a solution? it's 2020! it's not in docker, just in my mac machine.

i got an similar error in my mac too,steps followed https://docs.konghq.com/install/source/ ,have you solved the problem?

niraj28 commented 3 years ago

similar issue followed the same steps in mac followed https://docs.konghq.com/install/source/ ,have you solved the problem?

610991905 commented 3 years ago

similar issue followed the same steps in mac followed https://docs.konghq.com/install/source/ ,have you solved the problem?

I slove it. when you according to the official steps successfully installed, and run kong cmd must be in path $xxx/kong-sources/kong for example: cd xxxx/kong-sources/kong kong start

niraj28 commented 3 years ago

I am in /kong-sources/kong and doing kong start having same error.

610991905 commented 3 years ago

I am in /kong-sources/kong and doing kong start having same error. try run export LUA_PATH="xxxxxx/kong-sources/deps/luarocks/share/lua/5.1/?.lua;"

niraj28 commented 3 years ago

tried as you suggested , sharing the structure *****/kong-sources/kong/kong ERROR: /Users/niraj/kong-sources/kong/bin/kong:9: module 'kong.cmd.init' not found: no field package.preload['kong.cmd.init'] no file './kong/cmd/init.lua'

*****/kong-sources/kong ERROR: ./kong/globalpatches.lua:50: module 'socket' not found: no field package.preload['socket'] no file './socket.lua'

niraj28 commented 3 years ago

and also when $ git clone git@github.com:Kong/kong.git $ cd kong $ git checkout 2.2.1 $ make install an error is coming Error: Failed installing dependency: https://luarocks.org/kong-plugin-serverless-functions-1.0.0-1.src.rock - Could not fetch rock file: Error fetching file: Failed downloading https://luarocks.org - Failed downloading https://luarocks.org/kong-plugin-serverless-functions-1.0.0-1.src.rock - /****/.cache/luarocks/https___luarocks.org/kong-plugin-serverless-functions-1.0.0-1.src.rock

niraj28 commented 3 years ago

Thank you :), issue got resolved. I have ran the below command and its working now. $luarocks install luasocket

apodemakeles commented 3 years ago

same error, it's 2021!!!!!!

minicoder1024 commented 2 years ago

when I meet the error like "no file xxxxxxx",I try to add the file to the lua path,such like: 1.change the filebin/kong, the value of package.path,try to add the path you need 2.change the environment variable LUA_PATH,try to add the path you need 3.change the file kong.conf,the value of lua_package_path,try to add the path you need

lua or kong will scan the path above。

the only way what I do is try to add the lua file to the path,now it works。I‘m build kong1.4.0.now it works,but maybe not in a standard way.

image