Created
March 19, 2018 07:39
-
-
Save jimmy18dev/86b7896fcd5a2374d1341b26f8e6b587 to your computer and use it in GitHub Desktop.
Kong Installation (Docker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
network="kong_network" | |
clear | |
echo "[Clear all container and network]" | |
docker container stop kong-database kong | |
docker container rm kong-database kong | |
docker network rm $network | |
echo "[Craete network with $network]" | |
docker network create $network | |
secs=$((10)) | |
while [ $secs -gt 0 ]; do | |
echo -ne "waiting $secs\033[0K\r" | |
sleep 1 | |
: $((secs--)) | |
done | |
echo "[Craete kong-database]" | |
docker run -d --name kong-database --network=$network -p 5432:5432 -e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong" postgres:9.4 | |
secs=$((5)) | |
while [ $secs -gt 0 ]; do | |
echo -ne "waiting $secs\033[0K\r" | |
sleep 1 | |
: $((secs--)) | |
done | |
docker run --rm --link kong-database:kong-database --network=$network -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" kong:latest kong migrations up | |
secs=$((10)) | |
while [ $secs -gt 0 ]; do | |
echo -ne "waiting $secs\033[0K\r" | |
sleep 1 | |
: $((secs--)) | |
done | |
echo "[Craete kong master]" | |
docker run -d --name kong --link kong-database:kong-database --network=$network -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" -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" -e "KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444" -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:latest | |
secs=$((10)) | |
while [ $secs -gt 0 ]; do | |
echo -ne "waiting $secs\033[0K\r" | |
sleep 1 | |
: $((secs--)) | |
done | |
clear | |
echo "[Network Lists]" | |
docker network ls | |
echo "[Container Lists]" | |
docker ps -a | |
echo "cURL to http://localhost:8000/" | |
curl -i -X GET --url http://localhost:8000/ --header 'Host: localhost' | |
echo "[Craete Kong successful!!!!!!!!!!!!!!!!]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment