I have a nodejs API running in a docker container and I want to use Kong as API-Gateway. Kong will be running in another docker container. When I start API container and Kong container using docker-compose, Kong container throws an error saying;
kong | stack traceback: kong | [C]: in function 'assert' kong | /usr/local/share/lua/5.1/kong/init.lua:160: in function 'init' kong | init_by_lua:3: in main chunk kong | 2018/02/07 11:14:17 [warn] postgres database 'kong' is missing migration: (response-transformer) 2016-05-04-160000_resp_trans_schema_changes kong | nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:160: [postgres error] the current database schema does not match this version of Kong. Please run `kong migrations up` to update/initialize the database schema. Be aware that Kong migrations should only run from a single node, and that nodes running migrations concurrently will conflict with each other and might corrupt your database schema!
docker-compose file:
version: '3.1' services: couchdb: image: couchdb container_name: e-db ports: - 5984:5984 environment: COUCHDB_USER: admin COUCHDB_PASSWORD: admin api: image: e-api container_name: e-api entrypoint: ./docker-entrypoint.sh couchdb 5984 build: . command: npm run dev depends_on: - couchdb ports: - 8080:8080 kong-db: image: postgres:alpine container_name: kong-db restart: on-failure ports: - 5432 environment: POSTGRES_USER: kong POSTGRES_DB: kong kong: image: kong:0.12.1-alpine container_name: kong restart: on-failure depends_on: - kong-db ports: - 8000:8000 - 8443:8443 - 8001:8001 environment: KONG_PG_HOST: kong-db KONG_DATABASE: postgres command: kong migrations up kong-ui: image: pgbi/kong-dashboard container_name: kong-ui restart: on-failure ports: - 8089:8080 depends_on: - kong
So, After getting that error, I added "command: kong migrations up" to kong service. This time it does the migrations. But after migrations, kong container stops and I can't restart it.
Am I missing something?