kongfig icon indicating copy to clipboard operation
kongfig copied to clipboard

konfig fails when run inside bash loop

Open max-l-weaver opened this issue 6 years ago • 1 comments

kongfig version: 1.5.3

We run kongfig inside a bash loop that loops over a list of *.yml files and runs a kongfig --path $PATH for each one, so our script looks like this:

for config in $(/var/lib/path/to/files/*.yml);
do
  echo $config
  /bin/kongfig --path $config
  sleep 10
done

which has worked fine until recently, when we're getting the following errors per loop:

Loading config /var/lib/path/to/files/config.yml
Apply config to localhost:8001
Kong version: 0.12.1
Error: http://localhost:8001/apis/ee23b.../plugins: 500 Internal Server Error
 Error: http://localhost:8001/apis/ee23b.../plugins: 500 Internal Server Error
    at /usr/lib/node_modules/kongfig/lib/adminApi.js:139:25
    at process._tickCallback (internal/process/next_tick.js:109:7)

However if I run each one manually they work without issue.

sudo kongfig --path /var/lib/path/to/config/file.yml
Loading config /var/lib/path/to/config/file.yml
Apply config to localhost:8001
Kong version: 0.12.1

PATCH http://localhost:8001/apis/foo
 { upstream_url: 'https://foo.com',
  uris: [ '/' ],
  hosts: 'bar.foo.com' }
200 OK { created_at: 1519909028690,
  strip_uri: true,
  id: '',
  hosts: [ 'bar.foo.com' ],
  name: ...

As you can see our Kong version is 0.12.1 Any advice would be great,, thanks!

max-l-weaver avatar Feb 12 '19 17:02 max-l-weaver

Hi, I am facing the same issue and seems to have been introduced in the later versions. I have a feeling it's to do with the number of concurrent DB Connections Kongfig uses in the background. Any fix or workaround or suggestions would be helpful.

Thanks, Arun

takearun avatar Apr 24 '19 07:04 takearun