Skip to content

Instantly share code, notes, and snippets.

@MuizMahdi
Last active March 15, 2021 19:45
Show Gist options
  • Save MuizMahdi/8fcc586a91aa6fc57b0cb1323ca4311a to your computer and use it in GitHub Desktop.
Save MuizMahdi/8fcc586a91aa6fc57b0cb1323ca4311a to your computer and use it in GitHub Desktop.
Kong-pg-Konga
# - Make sure that Postgres is running, then run Kong, and finally run Konga
#----------------------------------------------------------------|
# 1. Create Network: |
#----------------------------------------------------------------|
sudo docker network create {NETWORK}
#----------------------------------------------------------------|
# 2. Run Kong DB Migrations: |
#----------------------------------------------------------------|
sudo docker run --rm --network {NETWORK} \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_USER={DB_USER}" \
-e "KONG_PG_PASSWORD={DB_PASSWORD}" \
-e "KONG_PG_DATABASE={DATABASE_NAME}" \
-e "KONG_PG_HOST={PG_HOST_IP}" \
-e "KONG_PG_PORT=5432" \
kong kong migrations bootstrap --vv
#----------------------------------------------------------------|
# 3. Run Kong: |
#----------------------------------------------------------------|
sudo docker run -d --name kong --network {NETWORK} \
-e "KONG_DATABASE={DATABASE_NAME}" \
-e "KONG_PG_HOST={PG_CONTAINER_NAME_OR_IP}" \
-e "KONG_PG_PORT=5432" \
-e "KONG_PG_USER={DB_USER}" \
-e "KONG_PG_PASSWORD={DB_PASSWORD}" \
-e "KONG_PG_DATABASE={DATABASE_NAME}" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong --vv
# - Make sure that none of the ports are being used elsewhere
#----------------------------------------------------------------|
# 3. Run Konga: |
#----------------------------------------------------------------|
sudo docker run -p 1337:1337 --name konga --network {NETWORK} \
-e "TOKEN_SECRET={JWT_SECRET}" \
-e "DB_ADAPTER=postgres" \
-e "DB_HOST={PG_CONTAINER_NAME_OR_IP}" \
-e "DB_PORT=5432" \
-e "DB_USER={DB_USER}" \
-e "DB_PASSWORD={DB_PASSWORD}" \
-e "DB_DATABASE={DATABASE_NAME}" \
pantsel/konga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment