TykTechnologies / tyk-gateway-docker

Docker compose deployment to run Tyk OSS Gateway
96 stars 80 forks source link

Python dispatcher can't initialise #35

Closed excieve closed 4 years ago

excieve commented 4 years ago

When using a gateway image for v2.9.0 and later and configuring a Python plugin for an API, the gateway isn't able to initialise the co-process dispatcher.

Relevant logs:

time="Dec 18 21:26:15" level=info msg="----> Fetching Bundle: 60d3a06d-e4c2-45b1-90e8-1273cf98db8d" prefix=main
time="Dec 18 21:26:17" level=info msg="----> Loading bundle: 60d3a06d-e4c2-45b1-90e8-1273cf98db8d" prefix=main
time="Dec 18 21:26:17" level=info msg="----> Verifying bundle: 60d3a06d-e4c2-45b1-90e8-1273cf98db8d" prefix=main
time="Dec 18 21:26:17" level=info msg="----> Bundle is valid, adding to spec: 60d3a06d-e4c2-45b1-90e8-1273cf98db8d" prefix=main
time="Dec 18 21:26:17" level=error msg="Python version '' doesn't exist" error="No Python installations found"
time="Dec 18 21:26:17" level=error msg="Couldn't load Python dispatcher" error="python version '' doesn't exist" prefix=coprocess
time="Dec 18 21:26:17" level=error msg="Driver 'python' isn't loaded" prefix=coprocess

This is happening due to a missing python3-config executable on this image. The new dlpython component is using it in order to determine the version and paths to the Python library currently installed on the system.

The issue disappears when python3-dev package is installed on the container. This however adds significant size overhead to the image (TBD: how much exactly, the packages are about 80MB) as it also installs the development files (symbols, headers, etc.) for the Python lib + dependencies.

It might be better to have ability to force some library path for the gateway instead since we know that for each image.

buger commented 4 years ago

Can we fix gateway image itself in meantime?

excieve commented 4 years ago

@buger Yes, but here's the size difference uncompressed:

localhost/tykio/tyk-gateway    test-dev      17f6f2f7f65e   5 seconds ago    333 MB
localhost/tykio/tyk-gateway    test          da53989ac7d0   12 minutes ago   223 MB
excieve commented 4 years ago

@buger I've been looking into this some more and with a bit of dirty hacking I was able to keep the size to just 1MB overhead. I can update existing 2.9+ images with that for now, which fixes the issues. And later remove the hack and use long-term solution from https://github.com/TykTechnologies/tyk/issues/2749 when it's ready.

davegarvey commented 4 years ago

@marksou Python documentation may need updating based on the outcome of this.