星期六, 11月 18, 2017

kong 0.11.1 in Azure 測試小記

kong 0.11.1 in Azure 測試小記

OS:  openSUSE Leap 42.3 in Azure

測試 kong 0.11.1 版本

啟動 docker 服務

# systemctl   start      docker
# systemctl   enable  docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

這邊 跟上次不同的是 沒有開 port 5432 ( 因為不需要對外開放 )

# docker  run  -d  --name  kong-database   -e "POSTGRES_USER=kong"   -e   "POSTGRES_DB=kong"   postgres:9.4

進行 migrations 的動作

# docker   run  --rm   --link   kong-database:kong-database   -e "KONG_DATABASE=postgres"  -e   "KONG_PG_HOST=kong-database"   -e  "KONG_CASSANDRA_CONTACT_POINTS=kong-database"   kong:0.11.1   kong  migrations   up

Unable to find image 'kong:0.11.1' locally
0.11.1: Pulling from library/kong

d9aaf4d82f24: Pull complete
7246e83a372d: Pull complete
0695e4ef90eb: Pull complete
Digest: sha256:8cb8ac7dbd303f18d329f8336f1fb929c12ae0231bd62fe7d055c38dab70b613
Status: Downloaded newer image for kong:0.11.1
migrating core for database kong
core migrated up to: 2015-01-12-175310_skeleton
core migrated up to: 2015-01-12-175310_init_schema
core migrated up to: 2015-11-23-817313_nodes
core migrated up to: 2016-02-29-142793_ttls
core migrated up to: 2016-09-05-212515_retries
core migrated up to: 2016-09-16-141423_upstreams
core migrated up to: 2016-12-14-172100_move_ssl_certs_to_core
core migrated up to: 2016-11-11-151900_new_apis_router_1
core migrated up to: 2016-11-11-151900_new_apis_router_2
core migrated up to: 2016-11-11-151900_new_apis_router_3
core migrated up to: 2016-01-25-103600_unique_custom_id
core migrated up to: 2017-01-24-132600_upstream_timeouts
core migrated up to: 2017-01-24-132600_upstream_timeouts_2
core migrated up to: 2017-03-27-132300_anonymous
core migrated up to: 2017-04-18-153000_unique_plugins_id
core migrated up to: 2017-04-18-153000_unique_plugins_id_2
core migrated up to: 2017-05-19-180200_cluster_events
core migrated up to: 2017-05-19-173100_remove_nodes_table
core migrated up to: 2017-06-16-283123_ttl_indexes
migrating response-transformer for database kong
response-transformer migrated up to: 2016-05-04-160000_resp_trans_schema_changes
migrating rate-limiting for database kong
rate-limiting migrated up to: 2015-08-03-132400_init_ratelimiting
rate-limiting migrated up to: 2016-07-25-471385_ratelimiting_policies
migrating acl for database kong
acl migrated up to: 2015-08-25-841841_init_acl
migrating ip-restriction for database kong
ip-restriction migrated up to: 2016-05-24-remove-cache
migrating statsd for database kong
statsd migrated up to: 2017-06-09-160000_statsd_schema_changes
migrating jwt for database kong
jwt migrated up to: 2015-06-09-jwt-auth
jwt migrated up to: 2016-03-07-jwt-alg
jwt migrated up to: 2017-05-22-jwt_secret_not_unique
migrating cors for database kong
cors migrated up to: 2017-03-14_multiple_orgins
migrating galileo for database kong
galileo migrated up to: 2016-04-15_galileo-import-mashape-analytics
migrating basic-auth for database kong
basic-auth migrated up to: 2015-08-03-132400_init_basicauth
basic-auth migrated up to: 2017-01-25-180400_unique_username
migrating key-auth for database kong
key-auth migrated up to: 2015-07-31-172400_init_keyauth
migrating response-ratelimiting for database kong
response-ratelimiting migrated up to: 2015-08-03-132400_init_response_ratelimiting
response-ratelimiting migrated up to: 2016-08-04-321512_response-rate-limiting_policies
migrating request-transformer for database kong
request-transformer migrated up to: 2016-05-04-160000_req_trans_schema_changes
migrating datadog for database kong
datadog migrated up to: 2017-06-09-160000_datadog_schema_changes
migrating hmac-auth for database kong
hmac-auth migrated up to: 2015-09-16-132400_init_hmacauth
hmac-auth migrated up to: 2017-06-21-132400_init_hmacauth
migrating oauth2 for database kong
oauth2 migrated up to: 2015-08-03-132400_init_oauth2
oauth2 migrated up to: 2016-07-15-oauth2_code_credential_id
oauth2 migrated up to: 2016-12-22-283949_serialize_redirect_uri
oauth2 migrated up to: 2016-09-19-oauth2_api_id
oauth2 migrated up to: 2016-12-15-set_global_credentials
oauth2 migrated up to: 2017-04-24-oauth2_client_secret_not_unique
45 migrations ran
Error response from daemon: Driver devicemapper failed to remove root filesystem 5424b25954b9fc35d551e29b3e1e441b3957318c41f6ed77069586d29348f83c: devicemapper: Error running RemoveDevice dm_task_run failed


執行 kong 容器

# docker   run   -d   --name  kong  --link  kong-database:kong-database  -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"  -p  8000:8000   -p  8443:8443  -p  8001:8001  -p  8444:8444    kong:0.11.1


觀察 docker

# docker   ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                NAMES
479edbd0fc22        kong:0.11.1         "/docker-entrypoint.s"   7 minutes ago       Up 7 minutes        0.0.0.0:8000-8001->8000-8001/tcp, 0.0.0.0:8443-8444->8443-8444/tcp   kong
fa2ed7cbb6c6        postgres:9.4        "docker-entrypoint.sh"   14 minutes ago      Up 14 minutes       5432/tcp

為了日後不想打太長的指令將 結果 commit

# docker  commit  -m  "kong_test_0.11.1"  -a  "sakana"  4b5635ee34ed  sakana/kong_0.11.1
sha256:115879424e5057c4b1ff64666beda6f90501fd4fcca8af3336f9d3b89625d4f9

# docker   commit   -m  "kong_test_0.11.1"  -a  "sakana"   9a212d85ce2c   sakana/kong_0.11.1_db_postgres
sha256:d6e9fc2cb50dfd370671fa3b889c68f11d4ef3c85d0b5a9767fdf42d216baf93

登入 docker
# docker  login

將 image push 上去
# docker   push   sakana/kong_0.11.1

# docker   push   sakana/kong_0.11.1_db_postgres

另外開一台 VM 測試,
目前測試的結果是 0.11.1 一定要進行 migrations 才可以通過, 改天要來研究一下

#systemctl  start   docker

# docker  run  -d  --name   kong-database   sakana/kong_0.11.1_db_postgres

docker   run  --rm   --link   kong-database:kong-database   -e "KONG_DATABASE=postgres"  -e   "KONG_PG_HOST=kong-database"   -e  "KONG_CASSANDRA_CONTACT_POINTS=kong-database"   kong:0.11.1   kong  migrations   up

# docker   run   -d   --name   kong  --link  kong-database:kong-database  -p  8000:8000   -p 8443:8443  -p  8001:8001  -p 8444:8444   sakana/kong_0.11.1





沒有留言: