-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kong migrations bootstrap failure with postgres 14 #8259
Comments
How do you install Kong? Are building Kong from source? Please provide your method of running Kong. This can be a problem related to the "missing" luaossl library (pgmoon need it).
Please try to install luaossl by using luarocks: apk add curl git gcc musl-dev
luarocks install luaossl OPENSSL_DIR=/usr/local/kong CRYPTO_DIR=/usr/local/kong |
used kong latest docker image |
@RamanaChowdam Thanks for reporting this. I re-produced this issue. Steps to re-produce: version: "3.8"
services:
kong-migrations:
image: kong:2.7.0
command: kong migrations bootstrap
environment:
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_PG_USER: kong
KONG_PG_DATABASE: kong
KONG_PG_PASSWORD: kong
KONG_PG_HOST: db
depends_on:
- db
db:
image: postgres:14
environment:
POSTGRES_PASSWORD: kong
POSTGRES_USER: kong
kong:
image: kong:2.7.0
environment:
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_PG_USER: kong
KONG_PG_DATABASE: kong
KONG_PG_PASSWORD: kong
KONG_PG_HOST: db
depends_on:
- kong-migrations Error logs: $ docker-compose up
[+] Running 3/3
⠿ Container 8259-db-1 Recreated 0.1s
⠿ Container 8259-kong-migrations-1 Recreated 0.1s
⠿ Container 8259-kong-1 Recreated 0.1s
Attaching to 8259-db-1, 8259-kong-1, 8259-kong-migrations-1
8259-db-1 |
8259-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
8259-db-1 |
8259-db-1 | 2022-01-04 11:47:28.253 UTC [1] LOG: starting PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
8259-db-1 | 2022-01-04 11:47:28.253 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
8259-db-1 | 2022-01-04 11:47:28.253 UTC [1] LOG: listening on IPv6 address "::", port 5432
8259-db-1 | 2022-01-04 11:47:28.254 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
8259-db-1 | 2022-01-04 11:47:28.257 UTC [26] LOG: database system was shut down at 2022-01-04 11:44:58 UTC
8259-db-1 | 2022-01-04 11:47:28.260 UTC [1] LOG: database system is ready to accept connections
8259-kong-migrations-1 | Error: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand
8259-kong-migrations-1 | no field package.preload['openssl.rand']
8259-kong-migrations-1 | no file './openssl/rand.lua'
8259-kong-migrations-1 | no file './openssl/rand/init.lua'
8259-kong-migrations-1 | no file './openssl/rand.lua'
8259-kong-migrations-1 | no file './openssl/rand/init.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.ljbc'
8259-kong-migrations-1 | no file '/usr/local/openresty/site/lualib/openssl/rand/init.ljbc'
8259-kong-migrations-1 | no file '/usr/local/openresty/lualib/openssl/rand.ljbc'
8259-kong-migrations-1 | no file '/usr/local/openresty/lualib/openssl/rand/init.ljbc'
8259-kong-migrations-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/site/lualib/openssl/rand/init.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/lualib/openssl/rand.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/lualib/openssl/rand/init.lua'
8259-kong-migrations-1 | no file './openssl/rand.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
8259-kong-migrations-1 | no file '/usr/local/share/lua/5.1/openssl/rand.lua'
8259-kong-migrations-1 | no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
8259-kong-migrations-1 | no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand.lua'
8259-kong-migrations-1 | no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand/init.lua'
8259-kong-migrations-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.so'
8259-kong-migrations-1 | no file '/usr/local/openresty/lualib/openssl/rand.so'
8259-kong-migrations-1 | no file './openssl/rand.so'
8259-kong-migrations-1 | no file '/usr/local/lib/lua/5.1/openssl/rand.so'
8259-kong-migrations-1 | no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl/rand.so'
8259-kong-migrations-1 | no file '/usr/local/lib/lua/5.1/loadall.so'
8259-kong-migrations-1 | no file '/home/kong/.luarocks/lib/lua/5.1/openssl/rand.so'
8259-kong-migrations-1 | no file '/usr/local/openresty/site/lualib/openssl.so'
8259-kong-migrations-1 | no file '/usr/local/openresty/lualib/openssl.so'
8259-kong-migrations-1 | no file './openssl.so'
8259-kong-migrations-1 | no file '/usr/local/lib/lua/5.1/openssl.so'
8259-kong-migrations-1 | no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl.so'
8259-kong-migrations-1 | no file '/usr/local/lib/lua/5.1/loadall.so'
8259-kong-migrations-1 | no file '/home/kong/.luarocks/lib/lua/5.1/openssl.so'
8259-kong-migrations-1 |
8259-kong-migrations-1 | Run with --v (verbose) or --vv (debug) for more details
8259-kong-migrations-1 exited with code 1
8259-kong-1 | 2022/01/04 11:47:30 [warn] 1#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
8259-kong-1 | nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
8259-kong-1 | 2022/01/04 11:47:30 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/pgmoon/init.lua:273: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand
8259-kong-1 | no field package.preload['openssl.rand']
8259-kong-1 | no file './openssl/rand.lua'
8259-kong-1 | no file './openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.ljbc'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand/init.ljbc'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand.ljbc'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand/init.ljbc'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/share/lua/5.1/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
8259-kong-1 | no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand.lua'
8259-kong-1 | no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.so'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand.so'
8259-kong-1 | no file './openssl/rand.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/openssl/rand.so'
8259-kong-1 | no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl/rand.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/loadall.so'
8259-kong-1 | no file '/home/kong/.luarocks/lib/lua/5.1/openssl/rand.so'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl.so'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl.so'
8259-kong-1 | no file './openssl.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/openssl.so'
8259-kong-1 | no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/loadall.so'
8259-kong-1 | no file '/home/kong/.luarocks/lib/lua/5.1/openssl.so'
8259-kong-1 | stack traceback:
8259-kong-1 | [C]: in function 'require'
8259-kong-1 | /usr/local/share/lua/5.1/pgmoon/init.lua:273: in function 'auth'
8259-kong-1 | /usr/local/share/lua/5.1/pgmoon/init.lua:213: in function 'connect'
8259-kong-1 | .../share/lua/5.1/kong/db/strategies/postgres/connector.lua:216: in function 'connect'
8259-kong-1 | .../share/lua/5.1/kong/db/strategies/postgres/connector.lua:516: in function 'query'
8259-kong-1 | .../share/lua/5.1/kong/db/strategies/postgres/connector.lua:284: in function 'init'
8259-kong-1 | /usr/local/share/lua/5.1/kong/db/init.lua:141: in function 'init_connector'
8259-kong-1 | /usr/local/share/lua/5.1/kong/init.lua:503: in function 'init'
8259-kong-1 | init_by_lua:3: in main chunk
8259-kong-1 | nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/pgmoon/init.lua:273: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand
8259-kong-1 | no field package.preload['openssl.rand']
8259-kong-1 | no file './openssl/rand.lua'
8259-kong-1 | no file './openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.ljbc'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand/init.ljbc'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand.ljbc'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand/init.ljbc'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/share/lua/5.1/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand.lua'
8259-kong-1 | no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
8259-kong-1 | no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand.lua'
8259-kong-1 | no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand/init.lua'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl/rand.so'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl/rand.so'
8259-kong-1 | no file './openssl/rand.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/openssl/rand.so'
8259-kong-1 | no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl/rand.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/loadall.so'
8259-kong-1 | no file '/home/kong/.luarocks/lib/lua/5.1/openssl/rand.so'
8259-kong-1 | no file '/usr/local/openresty/site/lualib/openssl.so'
8259-kong-1 | no file '/usr/local/openresty/lualib/openssl.so'
8259-kong-1 | no file './openssl.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/openssl.so'
8259-kong-1 | no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl.so'
8259-kong-1 | no file '/usr/local/lib/lua/5.1/loadall.so'
8259-kong-1 | no file '/home/kong/.luarocks/lib/lua/5.1/openssl.so'
8259-kong-1 | stack traceback:
8259-kong-1 | [C]: in function 'require'
8259-kong-1 | /usr/local/share/lua/5.1/pgmoon/init.lua:273: in function 'auth'
8259-kong-1 | /usr/local/share/lua/5.1/pgmoon/init.lua:213: in function 'connect'
8259-kong-1 | .../share/lua/5.1/kong/db/strategies/postgres/connector.lua:216: in function 'connect'
8259-kong-1 | .../share/lua/5.1/kong/db/strategies/postgres/connector.lua:516: in function 'query'
8259-kong-1 | .../share/lua/5.1/kong/db/strategies/postgres/connector.lua:284: in function 'init'
8259-kong-1 | /usr/local/share/lua/5.1/kong/db/init.lua:141: in function 'init_connector'
8259-kong-1 | /usr/local/share/lua/5.1/kong/init.lua:503: in function 'init'
8259-kong-1 | init_by_lua:3: in main chunk
8259-kong-1 exited with code 1 |
I fixed it by installing luaossl library. Add below parts to docker-compose.yml, restoring normal. user: root
command: >
bash -c "apk add --no-cache curl git gcc musl-dev
&& luarocks install luaossl OPENSSL_DIR=/usr/local/kong CRYPTO_DIR=/usr/local/kong
&& kong start" |
Looks like we need to add |
and getting auth failure with Postgres 14 DB , when creating kong container Error: don't know how to auth: 10 |
@fffonion Or we can replace |
Can you post all related logs here? |
just got these logs only |
I think it's a known issue here leafo/pgmoon#108. But I can't re-produced it :( |
@fffonion We intentionally removed |
@dndx I don't think there's a reason pgmoon can't use lua-resty-openssl, it's just our intial scope is just to replace luaossl from Kong. Because at that time, we were not using our own fork of pgmoon. |
also coming across this issue with Kong 2.7.0 (and lower versions) with postgres 14.x. I would just add that before the lua errors (which are the same) I am getting this:
|
@JamesRamm, I suppose you are using somekind of authentication method in Postgres? If yes, then what? |
Since Postgres 14.0, the default See: |
we had this issue and I confirm that setting |
Thanks for sharing. But I wanna mention that it can affect the security of db since md5 is not safe enough. And yes it's a workaround. |
@bungle |
Does anyone know if there will be an update to address this error? We are using docker with the latest kong image. Error: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand |
Yes, ultimately we want no dependency to |
There is now a fix waiting for a review / merge in Meanwhile we can think about other ways to fix this, but ultimately we would refer it to be merged in upstream project. |
### Summary See: https://github.com/leafo/pgmoon/releases/tag/v1.14.0 ### Issues Resolved Fix #8259
### Summary See: https://github.com/leafo/pgmoon/releases/tag/v1.14.0 ### Issues Resolved Fix #8259
this issue still affects docker image |
Reopen this issue to track the process. Reason: #8533 (comment) The master branch still contains the fix: We will close this issue when a release contains the fix. |
Impossible to launch |
Tried installing Kong with Helm and I too am getting the Need help with a work around until this is fixed and released.
Both of the above are not a viable solution for me as the Database is managed separately and it involves changes to be made in the DB server. |
This got it working for me, thank you. |
I'm also getting the following error message: Here is my current environment: Trying to run the image
Any help would be appreciated! |
Can we get a tentative timeline on when will be there a release with this fix. |
I fixed that by adding to each service This is the .yml I used: networks: services: kong-database: kong-migrations: kong-gateway: |
Hi everyone, |
Hi everyone!! I managed to kong migration with Postgres 14, with the following command. docker run --rm -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=HOST_ADDRESS" -e "KONG_PG_PASSWORD=PASS" kong/kong-gateway:3.0.0.0-alpine kong migrations bootstrap |
Can someone from kong verify if this has been resolved? In kong/kong-gateway:3.0.0.0-alpine |
Verified that Kong 3.0.0 and Kong EE 3.0.0.0 (in traditional and hybrid mode) can bootstrap against Postgres 14. Closing this |
We're using postgresql 12+pgpool(ha) with kong 2.8.1
|
Is there an existing issue for this?
Kong version (
$ kong version
)latest
Current Behavior
Error: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand
no field package.preload['openssl.rand']
no file './openssl/rand.lua'
no file './openssl/rand/init.lua'
no file './openssl/rand.lua'
no file './openssl/rand/init.lua'
no file '/usr/local/openresty/site/lualib/openssl/rand.ljbc'
no file '/usr/local/openresty/site/lualib/openssl/rand/init.ljbc'
no file '/usr/local/openresty/lualib/openssl/rand.ljbc'
no file '/usr/local/openresty/lualib/openssl/rand/init.ljbc'
no file '/usr/local/openresty/site/lualib/openssl/rand.lua'
no file '/usr/local/openresty/site/lualib/openssl/rand/init.lua'
no file '/usr/local/openresty/lualib/openssl/rand.lua'
no file '/usr/local/openresty/lualib/openssl/rand/init.lua'
no file './openssl/rand.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
no file '/usr/local/share/lua/5.1/openssl/rand.lua'
no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand.lua'
no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand/init.lua'
no file '/usr/local/openresty/site/lualib/openssl/rand.so'
no file '/usr/local/openresty/lualib/openssl/rand.so'
no file './openssl/rand.so'
no file '/usr/local/lib/lua/5.1/openssl/rand.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl/rand.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/home/kong/.luarocks/lib/lua/5.1/openssl/rand.so'
no file '/usr/local/openresty/site/lualib/openssl.so'
no file '/usr/local/openresty/lualib/openssl.so'
no file './openssl.so'
no file '/usr/local/lib/lua/5.1/openssl.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/home/kong/.luarocks/lib/lua/5.1/openssl.so'
Expected Behavior
No response
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: