Kong / kong

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

use kong in alpine docker can not dynamic add api #2496

Closed liuwenru closed 7 years ago

liuwenru commented 7 years ago

Note: GitHub issues should be reserved only for bug reports. Please use the Kong mailing list or Gitter for user support, development questions, feature requests, etc.

Summary

SUMMARY_GOES_HERE

Steps To Reproduce

sorry, my english is not good.

  1. i make a kong docker images base on alpine, use the doc where is there
  2. when i add a api into it , it can not use ,the kong tell me 'no API found with those values'
  3. but when i restart the kong , it work !

Additional Details & Logs

ShinEDL commented 7 years ago

Why not use offical kong docker images?

liuwenru commented 7 years ago

for docker images we want use our own bash script to start a docker container , we need custom our ENTRYPOINT , so please give me some help or prompt about this problem

ShinEDL commented 7 years ago

I think you should show your configuration, such as Dockerfile or something... Otherwise, we can't know how you did.

liuwenru commented 7 years ago

My Dockerfile like this


FROM registry.epoint.com.cn/base/epoint_alpine_glibc_base:v1.5

MAINTAINER Liu Wen Ru "liuwr@epoint.com.cn"

1: copy apps

COPY Apps /opt/Apps

3: RUN Install

RUN apk update && apk upgrade && \ apk add --no-cache readline-dev pcre-dev openssl openssl-dev gcc perl perl-dev bash git unzip nodejs && \ cd /opt/Apps && \ tar -zxvf openresty-1.11.2.2.tar.gz && \ cd openresty-1.11.2.2 && \ ./configure \ --prefix=/opt/openresty1.11.2.2 \ --with-luajit \ --with-pcre-jit \ --with-ipv6 \ --with-http_ssl_module \ --without-luajit-lua52 \ --with-http_realip_module \ --with-http_stub_status_module \ --with-debug && \ make -j2 && make install && \ ln -s /opt/openresty1.11.2.2 /usr/local/openresty && \ echo "export PATH=\$PATH:/usr/local/openresty/bin" >> /etc/profile && \ echo "export PATH=\$PATH:/usr/local/openresty/nginx/sbin" >> /etc/profile && \ echo "export OPENSSL_DIR=/usr" >> /etc/profile && \ source /etc/profile && \ unzip /opt/Apps/serf_0.8.1_linux_amd64.zip -d /usr/local/bin/ && \ cd /opt/Apps/ && \ tar -zxvf luarocks-2.4.2.tar.gz && \ cd luarocks-2.4.2 && \ ./configure \ --lua-suffix=jit \ --with-lua=/usr/local/openresty/luajit \ --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 && \ make build && make install && \ cd /opt/Apps && \ unzip kong-0.10.1.zip -d /opt/ && \ cd /opt/kong-0.10.1/ && \ make install && \ ln -s /opt/kong-0.10.1 /usr/local/kong && \ echo "export PATH=\$PATH:/usr/local/kong/bin" >> /etc/profile && \ source /etc/profile && \ mkdir /etc/kong && \ cp /usr/local/kong/kong.conf.default /etc/kong/kong.conf && \ cd /opt/Apps && \

unzip kong-dashboard-2.0.0.zip && \

 #cd kong-dashboard-2.0.0 && \
 #npm install  -g --registry https://registry.npm.taobao.org && \
 cp /opt/Apps/docker_launcher.sh /etc/init.d/start.sh && \
 chmod +x /etc/init.d/start.sh && \
 rm -rf /opt/Apps

ENV appbasepath /usr/local/orange

ENTRYPOINT ["/usr/local/bin/dumb-init", "/etc/init.d/start.sh"]


my start.sh like this

cd /usr/local/kong
source /etc/profile
export KONG_NGINX_DAEMON="off"
exec kong start
ShinEDL commented 7 years ago

Recently I also write a Dockerfile like yours, but different way... I don't compile kong source code, instead of putting a executable file like .deb. The Dockerfile look like:

FROM ubuntu:14.04

RUN sudo apt-get update
RUN sudo apt-get install -y openssl libpcre3 procps perl dnsmasq
COPY kong-0.10.1.trusty_all.deb /
RUN sudo dpkg -i kong-0.10.1.trusty_all.deb

CMD ["bash", "run.sh"]

Then we can write a run.sh, the same to your start.sh, to start kong.

run.sh

sudo start kong

and it work.

liuwenru commented 7 years ago

but I use the centos and build from source , do not use docker , it works !

liuwenru commented 7 years ago

@ShinEDL thinks for your help , i compile openresty with the openssl and prce source file , it can works