Skip to content

NickTriPetch/kong-api-gateway-101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kong api gateway

This is simple repository for kong 101. This will describe you how kong api gateway works.

Simple network diagrams

From figure above, you can see definition of this repository as

  • Private network, we simulate this network as kongnw, which has simple nginx servers as microservices.
  • All of those nginx servers will not expose to internet. Just only kong port 8000 and 8001.
    • 8000 for entry port proxy.
    • 8001 for kong admin port.

Required tools

  • Docker Engine version 19.03.0 and higher see more info
  • docker-compose

Contents

How to start kong on your local machine

How to start with DB

Start you docker services with these command

  • step 1) run this command to copy .env values from .env.template
$ cp .env.template .env
  • step 2) run this command via terminal
$ docker-compose up

How to start Kong DB-less mode

  • step 1) remove comment code on file Dockerfile line 8
# from
 .
 .
9: # For Kong DB-less mode, please remove these comments below
8: # COPY ./.conf/kong.yml /home/kong/kong.yml -> 

# to
 .
 .
9: # For Kong DB-less mode, please remove these comments below
8: COPY ./.conf/kong.yml /home/kong/kong.yml -> 
  • step 2) change your docker-compose.yml file as below
# from
33:          .
34:          .
35:          .
36:  #######################################
37:  # MyKong: The API Gateway
38:  #######################################
39:  kong:
40:    build:
41:      context: .
42:      args:
43:        kong_env: local
44:    restart: on-failure
45:    environment:
46:      KONG_DATABASE: "${KONG_DATABASE_MODE:-postgres}"
47:      KONG_ADMIN_LISTEN: 0.0.0.0:${KONG_ADMIN_PORT:-8001}
48:      # DB-Less mode - close comment line 49 for kong db-less mode
49:      # KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml
50:      # DB-Mode - comment line 51 - 54 for kong db-less mode
51:      KONG_PG_HOST: "${POSTGRES_HOST:-db}"
52:      KONG_PG_DATABASE: "${POSTGRES_DB:-kong}"
53:      KONG_PG_USER: "${POSTGRES_USER:-kong}"
54:      KONG_PG_PASSWORD: "${POSTGRES_PASSWORD:-kong}"
55:    depends_on:
56:          .
57:          .

-------

# from
33:          .
34:          .
35:          .
36:  #######################################
37:  # MyKong: The API Gateway
38:  #######################################
39:  kong:
40:    build:
41:      context: .
42:      args:
43:        kong_env: local
44:    restart: on-failure
45:    environment:
46:      KONG_DATABASE: "${KONG_DATABASE_MODE:-postgres}"
47:      KONG_ADMIN_LISTEN: 0.0.0.0:${KONG_ADMIN_PORT:-8001}
48:      # DB-Less mode - close comment line 49 for kong db-less mode
49:      KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml
50:      # DB-Mode - comment line 51 - 54 for kong db-less mode
51:      # KONG_PG_HOST: "${POSTGRES_HOST:-db}"
52:      # KONG_PG_DATABASE: "${POSTGRES_DB:-kong}"
53:      # KONG_PG_USER: "${POSTGRES_USER:-kong}"
54:      # KONG_PG_PASSWORD: "${POSTGRES_PASSWORD:-kong}"
55:    depends_on:
56:          .
57:          .
  • step 2) (If you have already had .env file then you can skip to step 3) run this command to copy .env values from .env.template
$ cp .env.template .env
  • step 3) change ENV variable in .env file
# from
1: KONG_DATABASE_MODE=postgres

# to
1: KONG_DATABASE_MODE=off
  • step 4) then run this command
$ docker-compose up --build

How to start Konga-UI

After docker services has been running and ready to start hence you can open this url http://localhost:1337 on your browser

References

Kong image repository

Ref: https://hub.docker.com/_/kong

Konga image repository

Ref: https://hub.docker.com/r/pantsel/konga

Get in touch with developers

Company contact

Developer contact

emails
websites

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages