ก่อน อื่น เตรียม database สำหรับ migrate
Ubuntu
Step 1
$ apt-get install postgresql -y
Step 2 start service psql
$ service postgresql start
Step 3 เข้า database
# su - postgres
$ psql
Step 4 Create user database for kong
postgres> CREATE USER kong; CREATE DATABASE kong OWNER kong;
postgres> ALTER USER kong WITH password 'kong';
or
Step 1
$ docker run --name <name> -e POSTGRES_PASSWORD=<user> -e POSTGRES_PASSWORD=<password> -d postgres
Step 2
$ docker exec -it <name> /bin/bash
Step 3 Step 4 เหมือน แบบ Ubuntu
Step 1
$ apt-get update
Step 2
$ sudo apt-get install -y apt-transport-https curl lsb-core && echo "deb https://kong.bintray.com/kong-deb `lsb_release -sc` main" | sudo tee -a /etc/apt/sources.list && curl -o bintray.key https://bintray.com/user/downloadSubjectPublicKey?username=bintray && sudo apt-key add bintray.key
Step 3
$ apt-get update
Step 4
$ apt-get install -y kong
Step 5 Copy ไฟล์ Config
$ cp /etc/kong/kong.conf.default /etc/kong/kong.conf
Step 6 แก้ /etc/kong/kong.conf
# vi /etc/kong/kong.conf
---
pg_user = kong
pg_password = kong
pg_database = kong
admin_listen = 0.0.0.0:8001, 0.0.0.0:8444 ssl
Step 7 Migrate
$ kong migrations bootstrap
Step 8 Start Kong
$ kong start
Try to check
$ curl localhost:8001