Skip to content
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

pgmoon openssl.rand not found #8533

Closed
1 task done
aw-joseph opened this issue Mar 11, 2022 · 7 comments
Closed
1 task done

pgmoon openssl.rand not found #8533

aw-joseph opened this issue Mar 11, 2022 · 7 comments

Comments

@aw-joseph
Copy link

aw-joseph commented Mar 11, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

2.8.0

Current Behavior

As I started the Install Kong Gateway on macOS guide, I attempted to execute the kong migrations bootstrap and encountered the error /opt/homebrew/share/lua/5.1/pgmoon/init.lua:273: module 'openssl.rand' not found.

I noticed there was a previous issue reported and has since been closed with release 2.8.0. #8259

I expected that Kong v2.8.0 resolved this issue with updates associated with pgmoon dependency.

Expected Behavior

kong migrations bootstrap completes without error.

Steps To Reproduce

Have PostgreSQL 14 installed and running
Create Kong user and Kong Database
Install via Homebrew
Execute kong migrations bootstrap
[Optional] Create kong.conf and adjust the Postgres DB values, such as password and copy it to /etc/kong/kong.conf

Anything else?

https://docs.konghq.com/gateway/2.8.x/install-and-run/macos/

@bungle
Copy link
Member

bungle commented Mar 11, 2022

@rs-joe, yes it was decided in a last minute to remove this from release. I tried to oppose the removal, but it was too late. The decision had to do with the issues that were caused to our sibling commercial release, and we didn't have time to resolve it properly. Thus we postponed the fix to next release, hopefully we can release a patch release soon.

The master branch still contains the fix:
#8429

Basically you can just use luarocks to install latest pgmoon and you should be fine, but I agree it is annoying manual step until we get our packages fixed.

@aw-joseph
Copy link
Author

aw-joseph commented Mar 11, 2022

@bungle, I've used luarocks v3.5.0 (packaged with kong v2.8.0) to install pgmoon (luarocks install pgmoon). I now have pgmoon v1.14.0-1 installed, but this did not resolve the issue with the command kong migration bootstrap. Is there another step that I should complete in addition to the pgmooon install?

@bungle
Copy link
Member

bungle commented Mar 11, 2022

@rs-joe,

This is the line in 1.14.0:
https://github.com/leafo/pgmoon/blob/v1.14.0/pgmoon/init.lua#L273

I feel like you are still hitting to:
https://github.com/leafo/pgmoon/blob/v1.13.0/pgmoon/init.lua#L273

You may have two versions installed. Try removing pgmoon with luarocks remove --force pgmoon and then luarocks install --force pgmoon 1.14.0. Are you running the Open Source Kong or the Enterprise edition?

@aw-joseph
Copy link
Author

@bungle, I am currently working to develop a POC and utilizing the Open Source Kong. I did found a work-around until this can resolved in a future release. The issue is, as you stated, pgmoon 1.14.0 needs to be used.

In my case, I am using the Homebrew Kong formulae. So, the install of pgmoon 1.14.0 using command luarocks install pgmoon didn't have any immediate affect on Kong. Both Homebrew and Kong have a reference to pgmoon 1.13.0 buried in folders /opt/homebrew/Cellar/kong/2.8.0/share/lua/5.1/pgmoon and /opt/homebrew/share/lua/5.1/pgmoon.

In order to force the reference from 1.13.0 to 1.14.0, I copied files from the pgmoon 1.14.0 using luarocks located here: /opt/homebrew/Cellar/[email protected]/1.19.3.2/luarocks/share/lua/5.1/pgmoon to both the directories referencing the old version (stated above). This step essentially overwrote the old pgmoon files with the new.

I figure if I upgrade Kong using Homebrew it will overwrite these files. So, I'll keep them as they are for now until the resolution is released.

Also, I found that if I only copied the files newer files in the Kong shared directory path I passed the original issue, but encountered a new one (#4933). So, this is why it was necessary to overwrite the files in both the Homebrew and Kong shared directories.

@andrea-mucci
Copy link

Hi, I have the same error but with docker compose with postgresql version 14.2

kong-migrations:
    image: kong:2.8.0-alpine
    command: kong migrations bootstrap
    depends_on:
      - postgres
    environment:
      KONG_DATABASE: postgres
      KONG_PG_HOST: postgres
      KONG_PG_PASSWORD: min0s
      KONG_PG_DATABASE: kong
      KONG_PG_USER: minos
    restart: on-failure
kong-migrations-up:
    image: kong:2.8.0-alpine
    command: kong migrations up && kong migrations finish
    depends_on:
      - postgres
    environment:
      KONG_DATABASE: postgres
      KONG_PG_HOST: postgres
      KONG_PG_PASSWORD: min0s
      KONG_PG_DATABASE: kong
      KONG_PG_USER: minos
    restart: on-failure
kong:
    image: kong:2.8.0-alpine
    user: "kong"
    environment:
      KONG_DATABASE: postgres
      KONG_PG_HOST: postgres
      KONG_PG_PASSWORD: min0s
      KONG_PG_DATABASE: kong
      KONG_PG_USER: minos
      KONG_ADMIN_ACCESS_LOG: /dev/stdout
      KONG_ADMIN_ERROR_LOG: /dev/stderr
      KONG_PROXY_LISTEN: 0.0.0.0:8000
      KONG_ADMIN_LISTEN: 0.0.0.0:8001
      KONG_PROXY_ACCESS_LOG: /dev/stdout
      KONG_PROXY_ERROR_LOG: /dev/stderr
      KONG_PREFIX: /var/run/kong
      KONG_DECLARATIVE_CONFIG: "/opt/kong/kong.yaml"
    ports:
      - "0.0.0.0:8000:8000/tcp"
      - "0.0.0.0:8443:8443/tcp"
      - "127.0.0.1:8001:8001/tcp"
      - "127.0.0.1:8444:8444/tcp"
    healthcheck:
      test: ["CMD", "kong", "health"]
      interval: 10s
      timeout: 10s
      retries: 10
    restart: on-failure:5
    read_only: true
    volumes:
      - kong_prefix_vol:/var/run/kong
      - kong_tmp_vol:/tmp
      - ./config:/opt/kong
    security_opt:
      - no-new-privileges

and this is the error log


geekboard-kong-migrations-1     | Error: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand
geekboard-kong-migrations-1     | 	no field package.preload['openssl.rand']
geekboard-kong-migrations-1     | 	no file './openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file './openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file './openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file './openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/site/lualib/openssl/rand.ljbc'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/site/lualib/openssl/rand/init.ljbc'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/lualib/openssl/rand.ljbc'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/lualib/openssl/rand/init.ljbc'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/site/lualib/openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/site/lualib/openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/lualib/openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/lualib/openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file './openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/share/lua/5.1/openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand.lua'
geekboard-kong-migrations-1     | 	no file '/home/kong/.luarocks/share/lua/5.1/openssl/rand/init.lua'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/site/lualib/openssl/rand.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/lualib/openssl/rand.so'
geekboard-kong-migrations-1     | 	no file './openssl/rand.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/lib/lua/5.1/openssl/rand.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl/rand.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/lib/lua/5.1/loadall.so'
geekboard-kong-migrations-1     | 	no file '/home/kong/.luarocks/lib/lua/5.1/openssl/rand.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/site/lualib/openssl.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/lualib/openssl.so'
geekboard-kong-migrations-1     | 	no file './openssl.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/lib/lua/5.1/openssl.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/openresty/luajit/lib/lua/5.1/openssl.so'
geekboard-kong-migrations-1     | 	no file '/usr/local/lib/lua/5.1/loadall.so'
geekboard-kong-migrations-1     | 	no file '/home/kong/.luarocks/lib/lua/5.1/openssl.so'
geekboard-kong-migrations-1     | 
geekboard-kong-migrations-1     |   Run with --v (verbose) or --vv (debug) for more details

rainest added a commit to Kong/charts that referenced this issue Apr 7, 2022
With Kong 2.8.1, Kong/kong#8533 is resolved
and this default is no longer necessary.
@aaronhmiller
Copy link

Yay! When building the docker container, adding:
RUN luarocks install pgmoon
magically made the error go away. Keep fighting the good fight @bungle :D

@dndx
Copy link
Member

dndx commented Nov 8, 2022

Seems that the issue is resolved. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants