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

Running kong/kong-gateway:3.2-alpine failing with kong/model/analytics/payload.proto: No such file or directory #639

Open
mloskot opened this issue Mar 22, 2023 · 3 comments

Comments

@mloskot
Copy link

mloskot commented Mar 22, 2023

I'm running Kong with Docker / Docker Compose on Windows and I can run it based on kong/kong-gateway:2.8.1.0-alpine without any problems,

I'm trying to switch to Kong 3.x and I'm hitting some walls.

I'm following https://docs.konghq.com/gateway/3.2.x/install/docker/ and trying to run kong/kong-gateway:3.2.1.0 , and the gateway terminates with:

2023-03-22 11:33:58 /usr/local/openresty/nginx/sbin/nginx: error while loading shared libraries: /usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header

I see the same error for kong/kong-gateway:<tag> where <tag>-s I've tried are 3.0, 3.1 and those with -alpine and -ubuntu.

Running kong/kong-gateway:3.1.0.0-alpine fails with different error

2023-03-22 11:58:53 ERROR: /usr/local/share/lua/5.1/luarocks/loader.lua:104: error loading module 'yaml' from file '/usr/local/lib/lua/5.1/yaml.so':
2023-03-22 11:58:53     Error loading shared library libyaml-0.so.2: No such file or directory (needed by /usr/local/lib/lua/5.1/yaml.so)
2023-03-22 11:58:53 stack traceback:
2023-03-22 11:58:53     /usr/local/share/lua/5.1/luarocks/loader.lua:104: in function </usr/local/share/lua/5.1/luarocks/loader.lua:101>
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     /usr/local/share/lua/5.1/lyaml/init.lua:34: in main chunk
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     /usr/local/share/lua/5.1/kong/portal/file_helpers.lua:9: in main chunk
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     ...hare/lua/5.1/kong/enterprise_edition/runloop/handler.lua:8: in main chunk
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     /usr/local/share/lua/5.1/kong/runloop/handler.lua:10: in main chunk
2023-03-22 11:58:53     ...
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     /usr/local/share/lua/5.1/kong/cmd/utils/prefix_handler.lua:28: in main chunk
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     /usr/local/share/lua/5.1/kong/cmd/prepare.lua:8: in main chunk
2023-03-22 11:58:53     [C]: in function 'require'
2023-03-22 11:58:53     /usr/local/share/lua/5.1/kong/cmd/init.lua:71: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:61>
2023-03-22 11:58:53     /usr/local/bin/kong:9: in function 'file_gen'
2023-03-22 11:58:53     init_worker_by_lua:50: in function <init_worker_by_lua:48>
2023-03-22 11:58:53     [C]: in function 'xpcall'
2023-03-22 11:58:53     init_worker_by_lua:57: in function <init_worker_by_lua:55>

Running kong/kong-gateway:3.2-alpine fails with yet another error

2023-03-22 12:00:29 2023/03/22 11:00:28 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/protoc.lua:334: module load error: kong/model/analytics/payload.proto
2023-03-22 12:00:29     kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29     ./kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29     /usr/local/kong/include/kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29     kong/include/kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29 stack traceback:
2023-03-22 12:00:29     [C]: in function 'error'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:334: in function 'f'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:1152: in function 'do_compile'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:1168: in function 'compilefile'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:1181: in function 'loadfile'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/kong/analytics/init.lua:48: in main chunk
2023-03-22 12:00:29     [C]: in function 'require'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/kong/init.lua:115: in main chunk
2023-03-22 12:00:29     [C]: in function 'require'
2023-03-22 12:00:29     init_by_lua:2: in main chunk
2023-03-22 12:00:29 nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/protoc.lua:334: module load error: kong/model/analytics/payload.proto
2023-03-22 12:00:29     kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29     ./kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29     /usr/local/kong/include/kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29     kong/include/kong/model/analytics/payload.proto: No such file or directory
2023-03-22 12:00:29 stack traceback:
2023-03-22 12:00:29     [C]: in function 'error'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:334: in function 'f'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:1152: in function 'do_compile'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:1168: in function 'compilefile'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/protoc.lua:1181: in function 'loadfile'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/kong/analytics/init.lua:48: in main chunk
2023-03-22 12:00:29     [C]: in function 'require'
2023-03-22 12:00:29     /usr/local/share/lua/5.1/kong/init.lua:115: in main chunk
2023-03-22 12:00:29     [C]: in function 'require'
2023-03-22 12:00:29     init_by_lua:2: in main chunk

docker-compose.yml

version: '3'

name: 'docker-kong'

# Environment variables
x-kong-environment: &x-kong-environment
  # General
  KONG_PREFIX: "/usr/local/kong"
  KONG_USER: "kong"
  KONG_DATABASE: "postgres"
  KONG_ANONYMOUS_REPORTS: "off"
  # Network
  #KONG_TRUSTED_IPS: "0.0.0.0/0,::/0" # trust all IPs
  #KONG_REAL_IP_HEADER: "X-Forwarded-For"
  # PostgreSQL
  KONG_PG_DATABASE: "kong"
  KONG_PG_HOST: "database"
  KONG_PG_USER: "kong"
  KONG_PG_PASSWORD: "kongpass"
  # Logging
  KONG_LOG_LEVEL: "debug"
  KONG_ADMIN_ACCESS_LOG: "/dev/stdout"
  KONG_ADMIN_ERROR_LOG: "/dev/stderr"
  KONG_PROXY_ACCESS_LOG: "/dev/stdout"
  KONG_PROXY_ERROR_LOG: "/dev/stderr"
  # Services
  KONG_ADMIN_LISTEN: "0.0.0.0:8001"
  KONG_ADMIN_GUI_LISTEN: "0.0.0.0:8002"
  #KONG_ADMIN_API_URL: "http://localhost:8001"
  #KONG_ADMIN_GUI_URL: "http://localhost:8445"
  KONG_PROXY_LISTEN: "0.0.0.0:8000, 0.0.0.0:8443"

volumes:
  vol_database_data:
    driver: local
  vol_gateway_prefix:
    driver: local
  vol_gateway_tmp:
    driver: local

networks:
  kong-net:
    external: false

services:
  database:
    image: postgres:12
    environment:
      <<: *x-kong-environment
      POSTGRES_DB: "kong"
      POSTGRES_USER: "kong"
      POSTGRES_PASSWORD: "kongpass"
    volumes:
      - vol_database_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "${KONG_PG_USER}"]
      interval: 30s
      timeout: 30s
      retries: 3
    restart: on-failure
    stdin_open: true
    tty: true
    networks:
      - kong-net

  migrations:
    image: kong/kong-gateway:3.2-alpine
    command: kong migrations bootstrap
    environment:
      <<: *x-kong-environment
    depends_on:
      - database
    networks:
      - kong-net
    restart: on-failure

  migrations-up:
    image: kong/kong-gateway:3.2-alpine
    command: kong migrations up && kong migrations finish
    environment:
      <<: *x-kong-environment
    depends_on:
      - migrations
    networks:
      - kong-net
    restart: on-failure

  gateway:
    image: kong/kong-gateway:3.2-alpine
    user: "kong"
    environment:
      <<: *x-kong-environment
    depends_on:
      - migrations-up
    networks:
      - kong-net
    ports:
      - "8000:8000" # Kong API Gateway (Proxy)
      - "8001:8001" # Kong Admin API
      - "8002:8002" # Kong Admin Manager
    healthcheck:
      test: ["CMD", "kong", "health"]
      interval: 10s
      timeout: 10s
      retries: 10
    restart: on-failure:5
    read_only: false
    volumes:
      - vol_gateway_prefix:/usr/local/kong
      - vol_gateway_tmp:/tmp
    security_opt:
      - no-new-privileges
@FawenYo
Copy link

FawenYo commented Jul 5, 2023

Encounter the same error with kong 3.3.0 version

2023/07/05 05:28:56 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/luarocks/loader.lua:104: error loading module 'yaml' from file '/usr/local/lib/lua/5.1/yaml.so':
	libyaml-0.so.2: cannot open shared object file: No such file or directory
stack traceback:
	[C]: in function 'a_loader'
	/usr/local/share/lua/5.1/luarocks/loader.lua:104: in function </usr/local/share/lua/5.1/luarocks/loader.lua:101>
	[C]: in function 'require'
	/usr/local/share/lua/5.1/lyaml/init.lua:34: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.1/kong/db/declarative/init.lua:2: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.1/kong/init.lua:77: in main chunk
	[C]: in function 'require'
	init_by_lua:2: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/luarocks/loader.lua:104: error loading module 'yaml' from file '/usr/local/lib/lua/5.1/yaml.so':
	libyaml-0.so.2: cannot open shared object file: No such file or directory
stack traceback:
	[C]: in function 'a_loader'
	/usr/local/share/lua/5.1/luarocks/loader.lua:104: in function </usr/local/share/lua/5.1/luarocks/loader.lua:101>
	[C]: in function 'require'
	/usr/local/share/lua/5.1/lyaml/init.lua:34: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.1/kong/db/declarative/init.lua:2: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.1/kong/init.lua:77: in main chunk
	[C]: in function 'require'
	init_by_lua:2: in main chunk

Any solution?

@alokrbl
Copy link

alokrbl commented Mar 16, 2024

I am also trying to upgrade to kong 3.3.1, encountered same error. I using https://download.konghq.com/gateway-3.x-alpine/.

Did anyone face this issue? Any resolution?

@mloskot
Copy link
Author

mloskot commented Mar 16, 2024

@alokrbl I don't have any solution for this particular case, but after numerous failed attempts to 3.2, 3.3, ... I realised that Ubuntu-based image does not suffer any issues, so I migrated straight to the latest kong/kong-gateway:3.6. Interestingly, it seems Kong 3.3 is the latest version for which Alpine-based images are available, e.g. https://hub.docker.com/_/kong/tags?name=3.6-alpine, so feels like Kong stopped building on Alpine.

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

No branches or pull requests

3 participants