kong / docker-kong Goto Github PK
View Code? Open in Web Editor NEW:monkey: Docker distribution for Kong
Home Page: https://docs.konghq.com/gateway/latest/install/docker/
License: Apache License 2.0
:monkey: Docker distribution for Kong
Home Page: https://docs.konghq.com/gateway/latest/install/docker/
License: Apache License 2.0
I'm having issues with the compose version, because the container is always restarting... How do I know if the problem is my machine or the image? Is there any command that can help me printing the error?
Thank you for your time.
PS: I used your compose version without making changes into it. So That is why I'm asking through this platform.
I just did docker pull kong
after having some issues getting Kong to install via docker-compose up
, now I'm getting...
Using default tag: latest
Pulling repository docker.io/library/kong
Error: image library/kong not found
It appears "cassandra" is hard-wired as the hostname for the cassandra database. Using --link, the IP and port is available to the container - but it appears the config file does not expand environment variables? It would be nice if --link was sufficient without having to use a hardcoded name and export the cassandra port explicitly.
Trying to set Kong up in a docker-compose environment.
Here is my docker-compose.yml
:
version: '2'
services:
kong-cassandra:
image: cassandra:2.2.4
volumes:
- ./cassandra:/var/lib/cassadra
ports:
- 9042
kong:
image: mashape/kong:0.7.0
restart: always
ports:
- 8000:8000
- 8001:8001
- 8443:8443
- 7946:7946
- 7946:7946/udp
links:
- kong-cassandra:cassandra
- lb
lb:
image: dockercloud/haproxy
links:
- serviceA
environment:
- DOCKER_TLS_VERIFY
- DOCKER_HOST
- DOCKER_CERT_PATH
volumes:
- $DOCKER_CERT_PATH:$DOCKER_CERT_PATH
ports:
- 80
serviceA:
extends:
file: common.yml
service: microservice
build:
context: services/serviceA/
environment:
- 'VIRTUAL_HOST=*/serviceA, */serviceA/*'
command: "python main.py"
After starting up, the Kong container eats up more and more memory up to about 1.2 GB, and keeps both cores in the docker-machine at high usage.
At first, I am not consistently able to GET on ports 8000 and 8001. Sometimes they are available after a fresh startup, but after a while those endpoints start timing out. I have not yet been able to set it up so that requests are passed on to the load balancer behind it.
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
3ccd4130717e 0.02% 19.01 MB / 2.1 GB 0.91% 21.91 kB / 8.606 kB 2.822 MB / 0 B
687d13e230bf 178.61% 1.18 GB / 2.1 GB 56.19% 15.4 kB / 17.62 kB 16.38 kB / 106.5 kB
9b4b4fce624a 0.43% 37.04 MB / 2.1 GB 1.76% 22.05 kB / 8.596 kB 4.19 MB / 0 B
bc4f15fcbd70 0.02% 24.94 MB / 2.1 GB 1.19% 103.5 kB / 60.59 kB 7.692 MB / 8.192 kB
c3774ed1f6f7 0.80% 455.5 MB / 2.1 GB 21.69% 40.34 kB / 30.6 kB 51.06 MB / 1.004 MB
e6b19df2c5cb 0.02% 23.33 MB / 2.1 GB 1.11% 22.18 kB / 8.638 kB 7.442 MB / 0 B```
Will edit as I hack away...
Kong 0.8.0 has just released. Will it be available as docker image?
When I test whether the container is running normally, I met the following error:
{"message":"Cassandra error: Error during UNIQUE check: Cassandra error: cassandra could not be resolved (2: Server failure)"}
The following is the details:
[root@9fdc4a788c41 opt]# curl -i -X POST
-data 'name=mockbin'
--data 'target_url=http://mockbin.com/'
--data 'public_dns=mockbin.com'> --url http://localhost:8001/apis/ \
--data 'name=mockbin'
--data 'target_url=http://mockbin.com/' \HTTP/1.1 400 Bad Request
Date: Wed, 29 Jul 2015 06:43:26 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.2.1
{"public_dns":"public_dns is required"}
[root@9fdc4a788c41 opt]# curl -i -X POST
-data 'name=mockbin'
--data 'target_url=http://mockbin.com/'
--data 'public_dns=mockbin.com'> --url http://localhost:8001/apis/ \
--data 'name=mockbin'
--data 'target_url=http://mockbin.com/'
--data 'public_dns=mockbin.com'
HTTP/1.1 500 Internal Server Error
Date: Wed, 29 Jul 2015 06:44:32 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.2.1
{"message":"Cassandra error: Error during UNIQUE check: Cassandra error: cassandra could not be resolved (2: Server failure)"}
who can help me to go through it pls?
Hi guys,
When following the instructions for getting kong up and running on docker from scratch (the one at https://getkong.org/install/docker/), you run into the following little thing when on Mac OS X or Windows, which actually use VirtualBox for running the default
image as docker host: The curl
on localhost will not work, as the actual docker host is not localhost, but the docker host inside VirtualBox.
Instead, you have to issue your curl
command against the IP your $DOCKER_HOST
connection points to. Then it'll work. With my installation on Windows, that's
curl http://192.168.99.100:8001
This might not be an issue for anyone beyond n00b status, but I stumbled over it and had to give it some extra thought...
Best regards,
Martin
Currently, nginx/openresty is running as root. This is not considered good riddance. Instead, the user running Kong should be a non-privileged user, perhaps called "kong".
I'm running the 0.6.0 docker container, and getting this output:
...
kong_1 | [INFO] Migrating response-ratelimiting on keyspace "kong" (cassandra)
kong_1 | [INFO] response-ratelimiting migrated up to: 2015-08-21_init_response-rate-limiting
kong_1 | [INFO] Migrating hmac-auth on keyspace "kong" (cassandra)
kong_1 | [INFO] hmac-auth migrated up to: 2015-09-16-132400_init_hmacauth
kong_1 | [INFO] dnsmasq............address=127.0.0.1:8053 dnsmasq=true port=8053
kong_1 | [INFO] Auto-generating the default SSL certificate and key...
kong_1 | [INFO] nginx .............admin_api_listen=0.0.0.0:8101 proxy_listen=0.0.0.0:8101 proxy_listen_ssl=0.0.0.0:8543
kong_1 | [INFO] serf ..............-profile=wan -rpc-addr=127.0.0.1:7373 -event-handler=member-join,member-leave,member-failed,member-update,member-reap,user:kong=/usr/local/kong/serf_event.sh -bind=0.0.0.0:7946 -node=1e2396c98d96_0.0.0.0:7946 -log-level=err
kong_1 | [INFO] Trying to auto-join Kong nodes, please wait..
kong_1 | [WARN] Cannot auto-join the cluster because no nodes were found
kong_1 | [OK] Started
devenv_kong_1 exited with code 0
I'm aware the 0.6.0 kong forces us to now use serf, but how does it relate to docker? Do I need a serf daemon on the kong container? Or a separate container with serf? Or how do I disable serf for development/testing purposes?
With the current Docker file ( 0.6.0 ), you can't create a container in the background -d
, stop it and restart it. Kong always complains about dnsmasq is still running.
I'm pretty certain it is the way the default CMD
is set
CMD kong start && tail -f /usr/local/kong/logs/error.log
This makes tail
the command that docker is interacting with when you run docker stop
so kong never shuts down properly.
I think the default kong.yml should set nginx daemon on
and kong start should be set as the command.
Hi there,
I'm looking around on how to create custom-plugin, but as far as I understood, I'll have to build the kong source to include my custom plugin.
Since this container always download the rpm file, I cannot compile my plugin's source.
I'm following the steps on this tutorial: http://streamdata.io/blog/developing-an-helloworld-kong-plugin/
If I misunderstood something, please help me.
Thanks!
Francisco Andrade
I have successfully started up things using the docker-compose file can send requests to kong.
I have configure the hmac plugin, but all my requests are 403-ing.
Have done some investigation the system time in the docker container is set incorrectly.
The container time is Tue Aug 23 15:48:20 UTC 2016
but my system time is Wed 24 Aug 2016 23:43:31 BST
Trying to use this image in a docker-compose setup with cassandra is impossible. The issue is that cassandra takes so long to startup and kong bails if cassandra isn't running.
I solved this by adding monit to the base image https://hub.docker.com/r/articulate/kong-monit/ and https://github.com/articulate/docker-kong-monit
We could easily roll this back into this repo by creating a secondary Dockerfile.monit
and then having docker hub build that along with the other Dockerfile
. The normal one will be tagged how it is right now, but we can have the monit version tagged as monit-latest
and monit-0.5.3
.
This gives the person using the image the choice.
I'd be happy to PR the changes and work with whoever needed to get this done.
Hello,
I'm trying to configure hmac-auth and wrote some script :
#!/usr/bin/perl
use strict;
use warnings;
use HTTP::Date;
use MIME::Base64;
use Digest::SHA qw(sha1 sha1_hex sha1_base64 hmac_sha1_base64);
my $date = time2str();
my $key = 'hmactest';
#my $hmac = Digest::HMAC_SHA1->new($key);
#$hmac->add($date);
#my $digest = $hmac->digest;
my $hmac = hmac_sha1_base64("date: $date\n",$key);
system( "curl --url http://localhost:8000/ --header 'date: $date' --header 'Host: example.com' --header 'Authorization: hmac usename=\"user1\", algorithm=\"hmac-sha1\", headers=\"X-Date \", signature=\"$hmac\"'\n"");
but got error :
{"message":"HMAC signature cannot be verified"}
What I'm doing wrong ?
Hello,
I hope I just missed something but I have a problem running KONG with docker. If I tries to run it without -t (tty) it doesn't output any logs.
If I run it with the -t (tty) it get stuck in this step: [INFO] Auto-generating the default SSL certificate and key...
I am trying to run integration tests against KONG in a container. And the same thing there, it hangs as soon as a child process is spawn.
Hi there,
I'm having a recurrent problem on my kong 0.7.0 containers that a few seconds after the container goes up, it crashes with the message "Can't find nginx"
Here is the full log messages on the container startup
�[0m�[34m[INFO] �[0m�[0mKong 0.7.0
�[0m�[34m[INFO] �[0m�[0mUsing configuration: /etc/kong/kong.yml
�[0m�[34m[INFO] �[0m�[0mSetting working directory to /usr/local/kong
�[0m�[34m[INFO] �[0m�[0mdatabase...........cassandra auth=password= username= timeout=5000 data_centers= password= ssl=verify=false enabled=false contact_points=: replication_strategy=SimpleStrategy username= replication_factor=1 keyspace=kong
�[0m�[34m[INFO] �[0m�[0mdnsmasq............address=127.0.0.1:8053 dnsmasq=true port=8053
�[0m�[34m[INFO] �[0m�[0mserf ..............-profile=wan -rpc-addr=127.0.0.1:7373 -event-handler=member-join,member-leave,member-failed,member-update,member-reap,user:kong=/usr/local/kong/serf_event.sh -bind=0.0.0.0:7946 -advertise=<my_ip>:7946 -node=_0.0.0.0:7946 -log-level=err
�[0m�[34m[INFO] �[0m�[0mTrying to auto-join Kong nodes, please wait..
�[0m�[33m[WARN] �[0m�[0mCannot join <cassandra_node_ip>:. If the node does not exist anymore it will be automatically purged.
�[0m�[34m[INFO] �[0m�[0mSuccessfully auto-joined <another_cassandra_node_ip>:
�[0m�[34m[INFO] �[0m�[0mAuto-generating the default SSL certificate and key...
�[0m�[34m[INFO] �[0m�[0mLeaving cluster..
�[0m�[31m[ERR] �[0m�[0mCan't find nginx
�[0m�[31m[ERR] �[0m�[0mCould not start Kong
Can someone help me please?
I wanted to set upstream based on HTTP method for same URLs, for example I have /posts URL and wanted to send request to different hosts when the method is GET,POST,DELETE or something else. As I read the docs there are options based on URL or host.
Is it any possibility to have this kind of routes?
Hi All,
I am trying to get Kong properly working on Tutum/Docker Cloud (as it is now called).
The issue is that kong always fails when using docker links on Tutum/DockerCloud.
It appears that DNSmasq is not using the search element of the resolve.conf to add the FQDN to the request and as such it just fails.
So if I set in kong.yml :
contact_points:
- "cassandra:9042"
Kong will fail to start unable to connect to cassandra. It should resolve to casasndra....local.dockerapp.io
Example of resolve.conf on docker cloud:
search .<container-id>..local.dockerapp.io
nameserver 8.8.8.8
nameserver 8.8.4.4
This issue also prevents you using microservices behing kong via docker links as they do not resolve the same way as cassandra does not.
E.g http://chatservice should resolve to http://chatservice..local.dockerapp.io
container-id changes each time you redeploy or bring new containers up so you can not hard code this, the DNS for . is only active for as long as the container is.
How can I get kong/dnsmasq to properly use the search option in resolve.conf?
If we can solve this issue then I will no longer have to host a custom version of Kong for Docker Cloud
https://github.com/holidaywatchdog/docker-cloud-kong
I should mention that cassandra resolves correctly from within the docker container just not via dnsmasq
root@api-gateway-1 /]# ping cassandra
PING cassandra.a72c1fd7-97e3-423b-ac69-d02a5dee5d8e.local.dockerapp.io (10.7.0.2
2) 56(84) bytes of data.
64 bytes from 10.7.0.22: icmp_seq=1 ttl=64 time=1.79 ms
The only short term work around I have for this is to use a dummy container in the stack and link it to all the services you need to use with kong. Then use that containers FQDN to reference the services. As long as this container never goes down the DNS should work.
Seems that running kong and cassandra in docker containers eat disk space until there is no space left on my virtual machine.
Running df -h
on the kong container: docker exec kong df -h
Filesystem Size Used Avail Use% Mounted on
none 48G 16G 29G 36% /
tmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 48G 16G 29G 36% /etc/kong
shm 64M 0 64M 0% /dev/shm
At some point /dev/sda1
will go up 100% use. Cassandra/Kong logs does not show anything particular. Any idea what might be wrong?
Using cassandra:2.2.5
image and mashape/kong
image. Also docker info
shows:
Containers: 15
Running: 2
Paused: 0
Stopped: 13
Images: 55
Server Version: 1.10.1
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 232
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: bridge null host
Kernel Version: 4.1.17-boot2docker
Operating System: Boot2Docker 1.10.1 (TCL 6.4.1); master : b03e158 - Thu Feb 11 22:34:01 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.859 GiB
Name: dinghy
ID: IOWU:RZYU:5UA3:FX4Z:K7TZ:APJV:STOA:PKBT:DFAY:575B:SEJT:JR2S
Debug mode (server): true
File Descriptors: 36
Goroutines: 61
System Time: 2016-02-17T14:22:12.045636927Z
EventsListeners: 1
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Username: gottfrois
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Note: Running only cassandra image does not go up 100% disk use. It seems that it's kong that eat the disk space.
https://docs.docker.com/docker-hub/official_repos/
README-short.txt
latest
taglogo.png
latest
tagREADME.md
latest
tagkong reload
License
file in the git repo, latest
taghi. would it be possible to have some support about configuring docker's kong image?
i need to add a specific lua script that should be runned by openresty (something i want to run after kong.access()
call), so i updated nginx-kong.conf
and add my command afteraccess_by_lua_block
, i updated my own Dockerfile
like this.
COPY config/nginx-kong.conf /usr/local/kong/
but it seems the file is overwritten.
is it the way to go? if yes what is the appropriate file to overwrite?
or should i use templates or something else?
thank you
Kong has just released version 0.9.6 but I coudn't see that tag on Docker Hub
It looks like 0.9.1
and 0.9.2
should have been pushed to docker hub, but I'm not seeing them up there.
Most of Docker Official Images are based on Debian or Alpine while this Kong image is based on CentOS.
Is there any specific reason not to use Debian?
not a docker-kong bug/issue but starting the cassandra container errors out for me
vagrant@vagrant:kong|next⚡ ⇒ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
vagrant@vagrant:kong|next⚡ ⇒ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
php 5-apache a13e60b97983 8 weeks ago 483.8 MB
unirest-issue99 latest a13e60b97983 8 weeks ago 483.8 MB
vagrant@vagrant:kong|next⚡ ⇒ docker run -d --name kong-database \
> -p 9042:9042 \
> cassandra:2.2
Unable to find image 'cassandra:2.2' locally
2.2: Pulling from library/cassandra
51f5c6a04d83: Pull complete
a3ed95caeb02: Pull complete
2a21294c613b: Pull complete
4d679f1ad019: Pull complete
3b49a7450c9a: Pull complete
1e88c3a1e691: Pull complete
b464a0d9b04f: Pull complete
8b59c8e0cfa3: Pull complete
bdbda7d0c45f: Pull complete
f0664e7f1560: Pull complete
01554e7bf5c4: Pull complete
Digest: sha256:c33aeb965f108ac458d1fe8c9c7e563c1cf62cbdee16ed7ff2c658e24a0fb53f
Status: Downloaded newer image for cassandra:2.2
684b7a8e819ed376c8429d89810ec740a044bf9d07740834fe19d51b36cfb01d
vagrant@vagrant:kong|next⚡ ⇒ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
684b7a8e819e cassandra:2.2 "/docker-entrypoint.s" 34 seconds ago Exited (1) 33 seconds ago kong-database
vagrant@vagrant:kong|next⚡ ⇒ docker logs kong-database
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000a6600000, 1329594368, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1329594368 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid1.log
ideally host/port/user/database/password (or at bare minimum password) should be supplied via environment variables (or whatever other way), but it should not be left out to defaults without any option to change it
Have the instructions in the README been run against docker 1.12? (doing this on a mac)
Both with and without an overlay net I can't seem to get kong to connect to cassandra
docker run -d --name kong-database \
-p 9042:9042 \
cassandra:2.2
docker run -d --name kong \
-e "DATABASE=cassandra" \
--link kong-database:kong-database \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 7946:7946 \
-p 7946:7946/udp \
--security-opt seccomp:unconfined \
mashape/kong
[INFO] kong 0.8.3
[INFO] Using configuration: /etc/kong/kong.yml
[INFO] Setting working directory to /usr/local/kong
[INFO] database...........cassandra contact_points=kong-database:9042 data_centers= ssl=verify=false enabled=false port=9042 timeout=5000 replication_strategy=SimpleStrategy keyspace=kong replication_factor=1 consistency=ONE
[INFO] Leaving cluster..
[ERR] All hosts tried for query failed. kong-database:9042: connection refused for socket with peer kong-database:9042.
[ERR] Could not start Kong
Hello,
I've created a docker-compose setup, together with a 'install kong from git source' Dockerfile.
https://github.com/vikingco/docker-kong
Is that something you guys can use? Then we might consider integrating my approach into this repository (and deprecating my repository)
Cheers
Every time I try to start Kong, I get the following error...
[INFO] kong 0.8.1
[INFO] Using configuration: /etc/kong/kong.yml
[INFO] Setting working directory to /usr/local/kong
[INFO] database...........cassandra contact_points=kong-database:9042 data_centers= ssl=verify=false enabled=false port=9042 timeout=5000 replication_strategy=SimpleStrategy keyspace=kong replication_factor=1 consistency=ONE
[INFO] Leaving cluster..
[ERR] All hosts tried for query failed. kong-database:9042: connection refused for socket with peer kong-database:9042.
[ERR] Could not start Kong
A docker ps shows the following
a831fdfb1751 cassandra:2.2 "/docker-entrypoint.s" 53 minutes ago Up 53 minutes 7000-7001/tcp, 7199/tcp, 9160/tcp, 0.0.0.0:9042->9042/tcp kong-database
I've already got Cassandra running as instructed with a link named kong-database. I can shell into kong-database and run cqlsh fine.
Anyone have any idea what I can try to get closer to uncovering the problem?
As this image by default doesn't throw logs to std* is harder to debug problems.
Nginx official docker use this trick to enalbe docker-logs:
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
I moved this comment from another issue to its own issue to hope to get a response/discussion.
We currently cannot move to Kong 0.9.0 because the new Docker does not run nginx as root user (which is good), but user nobody seems not allowed to write to /dev/stdout.
In 0.8.3 we used the file-log plugin to log the output (instead of the method described by Jalberto in #40), since this suggestion does not seem to work.
This now gives the following error on each request in the nginx error log within the docker:
2016/08/28 16:01:18 [error] 76#0: [lua] handler.lua:56: [file-log] failed to open the file: Permission denied, context: ngx.timer, client: xxx.xxx.xxx.xxx, server: 0.0.0.0:8000
Does anyone have another solution?
When trying to link kong to cassandra db via compose up, Kong is not able to connect to cassandra container. However same is working perfectly when i try to link manually from command line.
I also tried with docker-machine ip in kong.yml, but got same error.
Error after compose up:
"
Tushars-MBP:docker-kong tushar$ docker logs 534e5cc8b4a0
[INFO] kong 0.8.2
[INFO] Using configuration: /etc/kong/kong.yml
[INFO] Setting working directory to /usr/local/kong
[INFO] database...........cassandra contact_points=kong-database:9042 data_centers= ssl=verify=false enabled=false port=9042 timeout=5000 replication_strategy=SimpleStrategy keyspace=kong replication_factor=1 consistency=ONE
[INFO] Leaving cluster..
[ERR] All hosts tried for query failed. kong-database:9042: connection refused for socket with peer kong-database:9042.
[ERR] Could not start Kong
"
Compose file:
"
kong-database:
image: cassandra:2.2
hostname: kong-database
ports:
kong:
image: mashape/kong:0.8.2
ports:
links:
environment:
Docker info:
"
Tushars-MBP:docker-kong tushar$ docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 44
Server Version: 1.11.2
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 97
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null host
Kernel Version: 4.4.12-boot2docker
Operating System: Boot2Docker 1.11.2 (TCL 7.1); HEAD : a6645c3 - Wed Jun 1 22:59:51 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.9 MiB
Name: handler
ID: BJHX:OKR3:YWIU:MAX5:PIR4:2I2J:C36B:TEHT:FQEJ:6IYT:6THT:EJHN
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug mode (client): false
Debug mode (server): true
File Descriptors: 12
Goroutines: 30
System Time: 2016-08-11T05:57:34.512054505Z
EventsListeners: 0
Username: tushardwivedi
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
"
Hey,
I sometimes have issues with kong and I get the msg:
Run with --v (verbose) or --vv (debug)
The Dockerfile has the command
CMD ["kong", "start"]
I am creating my own image because i need to put plugins code into kong, so I have something like this:
FROM kong:0.9.5
COPY ...
COPY ...
COPY ...
ENV DATABASE postgres
Now.. is there a way for me to start kong in debug mode or do I have clone this repo and change the cmd to the debug mode?
If there is no way could some dev put the kong start in the docker-entrypoint.sh? I can override that in my image without issues.
Thanks
Hello,
I'm currently investigating how we can run docker-kong in a docker-compose setup (https://docs.docker.com/compose/)
My current docker-compose.yml:
cassandra:
image: mashape/cassandra
ports:
- "9042:9042"
kong:
image: mashape/kong
links:
- cassandra
ports:
- "8001:8001"
- "8000:8000"
Unfortunatly, this doesn't work:
$ docker-compose up
Creating dockerkong_cassandra_1...
Creating dockerkong_kong_1...
Attaching to dockerkong_cassandra_1, dockerkong_kong_1
cassandra_1 | CompilerOracle: inline org/apache/cassandra/db/AbstractNativeCell.compareTo (Lorg/apache/cassandra/db/composites/Composite;)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/db/composites/AbstractSimpleCellNameType.compareUnsigned (Lorg/apache/cassandra/db/composites/Composite;Lorg/apache/cassandra/db/composites/Composite;)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/utils/ByteBufferUtil.compare (Ljava/nio/ByteBuffer;[B)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/utils/ByteBufferUtil.compare ([BLjava/nio/ByteBuffer;)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/utils/ByteBufferUtil.compareUnsigned (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/utils/FastByteOperations$UnsafeOperations.compareTo (Ljava/lang/Object;JILjava/lang/Object;JI)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/utils/FastByteOperations$UnsafeOperations.compareTo (Ljava/lang/Object;JILjava/nio/ByteBuffer;)I
cassandra_1 | CompilerOracle: inline org/apache/cassandra/utils/FastByteOperations$UnsafeOperations.compareTo (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
kong_1 | [INFO] Using configuration: /etc/kong/kong.yml
kong_1 | [INFO] Kong version.......0.3.2
kong_1 | Proxy HTTP port....8000
kong_1 | Proxy HTTPS port...8443
kong_1 | Admin API port.....8001
kong_1 | dnsmasq port.......8053
kong_1 | Database...........cassandra keepalive=60000 hosts=cassandra port=9042 timeout=1000 keyspace=kong
kong_1 | [INFO] Connecting to the database...
kong_1 | [ERR] Cassandra error: connection refused
cassandra_1 | INFO 06:33:10 Hostname: ff52d03a1055
cassandra_1 | INFO 06:33:10 Loading settings from file:/etc/cassandra/default.conf/cassandra.yaml
cassandra_1 | INFO 06:33:10 Node configuration:[authenticator=AllowAllAuthenticator; authorizer=AllowAllAuthorizer; auto_snapshot=true; batch_size_warn_threshold_in_kb=5; batchlog_replay_throttle_in_kb=1024; broadcast_rpc_address=127.0.0.1; cas_contention_timeout_in_ms=1000; client_encryption_options=<REDACTED>; cluster_name=Test Cluster; column_index_size_in_kb=64; commit_failure_policy=stop; commitlog_directory=/var/lib/cassandra/commitlog; commitlog_segment_size_in_mb=32; commitlog_sync=periodic; commitlog_sync_period_in_ms=10000; compaction_throughput_mb_per_sec=16; concurrent_counter_writes=32; concurrent_reads=32; concurrent_writes=32; counter_cache_save_period=7200; counter_cache_size_in_mb=null; counter_write_request_timeout_in_ms=5000; cross_node_timeout=false; data_file_directories=[/var/lib/cassandra/data]; disk_failure_policy=stop; dynamic_snitch_badness_threshold=0.1; dynamic_snitch_reset_interval_in_ms=600000; dynamic_snitch_update_interval_in_ms=100; endpoint_snitch=SimpleSnitch; hinted_handoff_enabled=true; hinted_handoff_throttle_in_kb=1024; incremental_backups=false; index_summary_capacity_in_mb=null; index_summary_resize_interval_in_minutes=60; inter_dc_tcp_nodelay=false; internode_compression=all; key_cache_save_period=14400; key_cache_size_in_mb=null; listen_address=localhost; max_hint_window_in_ms=10800000; max_hints_delivery_threads=2; memtable_allocation_type=heap_buffers; native_transport_port=9042; num_tokens=256; partitioner=org.apache.cassandra.dht.Murmur3Partitioner; permissions_validity_in_ms=2000; range_request_timeout_in_ms=10000; read_request_timeout_in_ms=5000; request_scheduler=org.apache.cassandra.scheduler.NoScheduler; request_timeout_in_ms=10000; row_cache_save_period=0; row_cache_size_in_mb=0; rpc_address=0.0.0.0; rpc_keepalive=true; rpc_port=9160; rpc_server_type=sync; saved_caches_directory=/var/lib/cassandra/saved_caches; seed_provider=[{class_name=org.apache.cassandra.locator.SimpleSeedProvider, parameters=[{seeds=127.0.0.1}]}]; server_encryption_options=<REDACTED>; snapshot_before_compaction=false; ssl_storage_port=7001; sstable_preemptive_open_interval_in_mb=50; start_native_transport=true; start_rpc=true; storage_port=7000; thrift_framed_transport_size_in_mb=15; tombstone_failure_threshold=100000; tombstone_warn_threshold=1000; trickle_fsync=false; trickle_fsync_interval_in_kb=10240; truncate_request_timeout_in_ms=60000; write_request_timeout_in_ms=2000]
dockerkong_kong_1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
Stopping dockerkong_cassandra_1...
What am I doing wrong here?
P.s. I have a feeling that Cassandra is still booting (not yet listening) and Kong immediately shuts down if it can not connect to Cassandra right away...?
I've run 0.8.0 with custom config to postgres as follows:
$ docker run -d \
-v /path/to/your/kong/configuration/directory/:/etc/kong/ \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 7946:7946 \
-p 7946:7946/udp \
--security-opt seccomp:unconfined \
--name kong \
mashape/kong
kong.yml
....
database: "postgres"
....
However, setup.sh appends the DATABASE variable to config when run.
kong.yml
....
database: "postgres"
....
database: "cassandra"
It doesn't pickup my postgres in kong.yml unless the DATABASE environment variable is set to "postgres" as well (it's set to cassandra by default). Even then, database: "postgres"
is appended to my kong.yml every time I restart the container.
I miss an example for adding an api running on the docker host.
It took me quite a long time to figure out that your upstream_url has to be pointing to the docker bridge ip of the docker host (if running docker in bridge mode)
I know that this might not be new knowledge to people with docker experience, but arriving at docker for running kong i missed the following example:
maybe an example could be python based:
if kong is running in docker and the docker host has ip 172.17.42.1 on the docker bridge interface.
(get docker host bridge ip with: ifconfig docker0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' )
make simple html index:
cd /tmp/
echo "hello world" > index.html
start api endpoint server:
sudo python -m SimpleHTTPServer 9876
add it to kong:
curl -i -XPOST "http://127.0.0.1:8001/apis/" --data 'name=example' --data
'upstream_url=http://172.17.42.1:9876/' --data 'request_host=example.com'
test it out
curl -XGET --header 'Host: example.com' "http://localhost:8000/"
and it prints:
"hello world"
I have a custom Kong configuration and Cassandra instance running. Kong succesfully connects to my database, and logs [OK] Started
, but then immediately exits with status 0. This happens when the container is started from Marathon, or manually. My logs and configuration can be found here, scroll to the bottom for the manual run.
I know the Cassandra database to be good, I can manually connect to it using cqlsh
.
Any pointers? Any ideas why this might happen? Or how I can debug?
When overriding configuration, do I override the entire kong.yml
file with a complete config, or can I just include the lines that I wish to override?
Hello,
I'm using dockerized kong and start it well. Inside container all of requests works good, but when I send request outside container ( like curl -v --url http://m.y.i.p:8000/ --header 'Host: example.com' ) kong said :
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>
How can I open my api requests to outside ?
I have checked out your code and tried starting with docker-compose up. But it fails saying
ERROR: for nginx-lb Cannot start service nginx-lb: driver failed programming external connectivity on endpoint compose_nginx-lb_1 (45fe13a6dd43c580f6bf946ee14ba0630cfca2ae3c73ce23e3b712a5a1ac5a75): Bind for 0.0.0.0:8443 failed: port is already allocated
I'm trying to get docker compose working but it always brings up the kong container before the postres one... Apparently it's bad design for microservices to die if their dependencies are not up, they should keep trying to connect. Can you make Kong behave like this please?
In any event, this is all making it impossible for me to make this docker-compose work. Can you please fix/provide workaround/comment.
thanks
Would be great to have a tag for ARM so raspberryPI adn scaleway C1 can be used as kong hosts
I'm trying to start a Kong cluster as Docker containers, but I can't manage to create the cluster because the cluster_listen_address
is a Docker IP (172.x.x.x) that don't communicate with a container running in another host.
I've managed to sucessfully configure the cluster when using the host network in Docker, but my goal is to use docker network and the mapped ports.
When I do that, use customized ports and set the cluster_listen_address
to be the Host IP, and not a Docker IP, I get this error:
[INFO] Kong 0.7.0
[INFO] Using configuration: /etc/kong/kong.yml
[INFO] Setting working directory to /usr/local/kong
[INFO] database...........cassandra auth=password=cassandra username=cassandra timeout=5000 data_centers= password=cassandra ssl=verify=false enabled=false contact_points=10.166.69.149:39044 replication_strategy=SimpleStrategy username=cassandra replication_factor=1 keyspace=kong
[INFO] dnsmasq............address=127.0.0.1:8053 dnsmasq=true port=8053
[INFO] Leaving cluster..
[ERR] Could not start serf: Failed to start the Serf agent: Error creating Serf: Failed to create memberlist: Failed to start TCP listener. Err: listen tcp 10.166.69.149:37947: bind: cannot assign requested address
[ERR] Could not start Kong
When I use the --net=host
option with docker, the "10.166.69.149:37947" cluster_listen_address
successfully appears in my Kong.nodes
table.
Im trying to run the example provided with Consul and Nginx using the compose. Once everything was up and running I tried to access Kong from the Kong Dashboard through Nginx instance. What would the URL to access Kong admin API? I tried http://nginx-lb:8001 and its not accessible. Im using Kong 0.9. I also tried to attach to the nginx container and ping'ed the "proxy_pass" (kong-8001) but got a host not found error. Any idea what im doing wrong? What would be the URL to access the kong admin api through the nginx reverse proxy?
Hello!
This is kind of a documentation problem/FYI, so just if someone else bumps into this, don't get too surprised.
Using docker-engine 1.10.1-0~wily (so the ubuntu docker package) results in a strange error:
$ docker run mashape/kong /usr/local/bin/serf agent
==> Starting Serf agent...
==> Failed to start the Serf agent: Error creating Serf: Failed to create memberlist: Failed to start TCP listener. Err: listen tcp 0.0.0.0:7946: socket: operation not permitted
So one has to start it with a relaxed --security-opt
setting.
$ docker run -it --security-opt seccomp:unconfined mashape/kong /usr/local/bin/serf agent
==> Starting Serf agent...
==> Starting Serf agent RPC...
==> Serf agent running!
Node name: 'f8e0492ca4ff'
Bind addr: '0.0.0.0:7946'
RPC addr: '127.0.0.1:7373'
Encrypted: false
Snapshot: false
Profile: lan
==> Log data will now stream in as it occurs:
2016/02/15 10:18:46 [INFO] agent: Serf agent starting
2016/02/15 10:18:46 [INFO] serf: EventMemberJoin: f8e0492ca4ff 172.17.0.2
2016/02/15 10:18:47 [INFO] agent: Received event: member-join
^C
==> Caught signal: interrupt
==> Gracefully shutting down agent...
2016/02/15 10:18:47 [INFO] agent: requesting graceful leave from Serf
2016/02/15 10:18:47 [INFO] serf: EventMemberLeave: f8e0492ca4ff 172.17.0.2
2016/02/15 10:18:47 [INFO] agent: requesting serf shutdown
2016/02/15 10:18:47 [INFO] agent: shutdown complete
Hi there,
I have the following set-up:
cassandra:
image: cassandra:2.2.5
kong:
image: mashape/kong
links:
- cassandra
security_opt:
- seccomp:unconfined
ports:
- "8000:8000"
- "8443:8443"
- "8001:8001"
- "7946:7946"
- "7946:7946/udp"
core-api:
build: ./applications/core/api
ports:
- "8080:8080"
links:
- core-datastore
- core-cache
- elasticsearch
environment:
- DB_NAME=bandzest
- VIRTUAL_HOST=core.bandzest.dev
restart: always
Then when I run curl -i -XGET http://bandzest.dev:8000 --header 'Host: core.bandzest.dev' -d 'request_path=api/v1/artists'
I get
HTTP/1.1 502 Bad Gateway
Date: Thu, 31 Mar 2016 00:20:13 GMT
Content-Type: text/plain; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.7.0
An invalid response was received from the upstream server
Whereas if I go straight to the API, I get a proper response.
Any pointers? Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.