スポンサーリンク
APIゲートウェイ と言うのは、複数のAPIをまとめたり、APIに特化した機能をもつソフトウェアやサービスのことです。
この手の製品で有名なのは Apigee や AWSのAPIゲートウェイ ですが、オープンソースのものもあります。
それが今回ご紹介する Kong と言うアプリケーションです。(公式ページは こちら )
私は業務ではApigeeを使うことが多いのですが、他のも知っとこうと思い今回Kongを使ってみましたのでその手順をメモします。
公式の手順 を参考にインストールを行います。
流れとしては以下のようになります。
①epelリポジトリの設定
②postgresqlのインストール・初期設定
③kongのインストール・初期設定
まずepelをインストールします。
詳細は こちらの記事 にまとめていますので参考まで。
amazon-linux-extras install epel
こちらの記事: Amazon linux2にpostgresqlをインストールする手順にまとめておりますので参照ください。
上記手順実施後、kong用の初期設定を行います。
まずはpostgresに接続します。
$ sudo su - postgres
$ psql -U postgres
postgres=#
接続できたらkongのユーザ、DBを作成します。postgresのCLIで以下コマンドを実行します。
CREATE USER kong; CREATE DATABASE kong OWNER kong;
次に、postgresqlの認証の設定を変更します。
詳細は こちらの記事 にも書いてありますが、この手順を行わないと初期設定に失敗して結構はまります。。
vim /var/lib/pgsql/data/pg_hba.conf
以下の部分(80行目付近)を修正します。内容は peer
, ident
となっている部分を trust
に変更するというものです。
変更前
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
変更後
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
#####local all all peer # ←ここをコメントアウト
local all all trust # ←ここを追記
# IPv4 local connections:
######host all all 127.0.0.1/32 ident # ←ここもコメントアウト
host all all 127.0.0.1/32 trust # ←ここも追記
設定変更後、postgresを再起動します。
systemctl restart postgresql.service
# ←何も表示されなければOK
これでpostgresqlの設定は完了です。
いよいよ本題、kongのインストールです。
こちらはyumでインストールします。
yum install https://bintray.com/kong/kong-community-edition-aws/download_file?file_path=dists/kong-community-edition-1.0.2.aws.rpm --nogpgcheck
以下のような結果が得られればOKです。
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
kong-community-edition-1.0.2.aws.rpm | 16 MB 00:00:01
Examining /var/tmp/yum-root-cyCtXA/kong-community-edition-1.0.2.aws.rpm: kong-community-edition-1.0.2-1.noarch
Marking /var/tmp/yum-root-cyCtXA/kong-community-edition-1.0.2.aws.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kong-community-edition.noarch 0:1.0.2-1 will be installed
--> Processing Dependency: openssl098e for package: kong-community-edition-1.0.2-1.noarch
amzn2-core | 2.4 kB 00:00:00
amzn2extra-docker | 1.3 kB 00:00:00
amzn2extra-epel | 1.3 kB 00:00:00
epel/x86_64/metalink | 7.4 kB 00:00:00
epel | 4.7 kB 00:00:00
157 packages excluded due to repository priority protections
--> Running transaction check
---> Package openssl098e.x86_64 0:0.9.8e-29.amzn2.3.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================================
Installing:
kong-community-edition noarch 1.0.2-1 /kong-community-edition-1.0.2.aws 47 M
Installing for dependencies:
openssl098e x86_64 0.9.8e-29.amzn2.3.2 amzn2-core 803 k
Transaction Summary
============================================================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total size: 48 M
Total download size: 803 k
Installed size: 49 M
Is this ok [y/d/N]: y
Downloading packages:
openssl098e-0.9.8e-29.amzn2.3.2.x86_64.rpm | 803 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : openssl098e-0.9.8e-29.amzn2.3.2.x86_64 1/2
Installing : kong-community-edition-1.0.2-1.noarch 2/2
Verifying : openssl098e-0.9.8e-29.amzn2.3.2.x86_64 1/2
Verifying : kong-community-edition-1.0.2-1.noarch 2/2
Installed:
kong-community-edition.noarch 0:1.0.2-1
Dependency Installed:
openssl098e.x86_64 0:0.9.8e-29.amzn2.3.2
Complete!
インストールが完了したら、次に初期設定を行います。
以下コマンドを実行します。
まず、kongのunixユーザを作成します。(rootで実行してください)
useradd -d /home/kong -s /bin/bash -m kong
作成が完了したらsuします
su - kong
$
次に初期設定のコマンドを実行します。
kong migrations bootstrap
このコマンドでエラーが出なければ起動します。
kong start
特にエラーが出なければ起動完了です。
kongはkong自体の設定もAPIで行いますので、APIで設定を取得できます。
ですので応答が返ってくればkongのインストール成功です。
以下コマンドで確認します。
curl -X GET http://localhost:8001
以下のような結果が返ってくればOKです。
{"plugins":{"enabled_in_cluster":[],"available_on_server":{"response-transformer":true,"oauth2":true,"acl":true,"correlation-id":true,"pre-function":true,"jwt":true,"cors":true,"ip-restriction":true,"basic-auth":true,"key-auth":true,"rate-limiting":true,"request-transformer":true,"http-log":true,"file-log":true,"hmac-auth":true,"ldap-auth":true,"datadog":true,"tcp-log":true,"zipkin":t
~~~以下略~~~
以上となります。
スポンサーリンク
2022/05/20 20:28:57
levitra schering levitra prescribing info https://xclevitradb.com/
2022/05/21 01:43:46
sildenafil 50 mg tablet price where to get female viagra uk https://aviagrasbt.com/
2022/05/21 02:15:02
can you buy sildenafil over the counter sildenafil webmd https://sildenafilkiol.com/
2022/04/09 03:15:22
revatio sildenafil 20 mg sildenafil online no prescription
2022/04/09 22:53:30
generic tadalafil india tadalafil 5mg daily price
2022/04/10 04:18:48
buy cheap cialis cialis no prescription
2022/04/10 16:17:41
natural viagra substitutes viagra samples
2022/04/10 20:47:57
spierx tadalafil tadalafil 20mg near me
2022/04/11 19:43:26
tadalafil high blood pressure discount tadalafil
2022/04/12 23:38:21
Rumalaya help rx pharmacy discount card
2022/04/13 11:11:53
price comparison levitra viagra levitra tabs
2022/04/14 15:19:50
prices of prescription drugs pharmacy tech in canada
2022/04/15 12:34:31
pharmacy technician salaries in canada xanax canadian pharmacy
2022/04/15 16:46:23
365 cialis cialis onlilne
2022/04/16 01:50:40
viagra online canadian pharmacy reviews online pharmacy non prescription drugs
2022/04/16 02:47:31
over the counter viagra india sildenafil 25 mg
2022/04/16 12:32:47
Zudena erectile dysfunction drug
2022/04/17 18:51:19
ivermectin for bed bugs ivermectin apple flavored horse paste
2022/04/18 14:00:37
cialis side effects with alcohol bph cialis
2022/04/18 21:19:17
ivermectin overdose does ivermectin kill lyme disease
2022/04/19 02:50:07
non generic viagra buy viagra cheapest price
2022/04/19 03:28:44
amino tadalafil tadalafil 5mg daily
2022/04/19 20:54:23
levitra cena how does levitra work
2022/04/21 02:19:53
original cialis cialis generico
2022/04/21 20:17:08
viagra 50mg pill how to buy viagra online in canada
2022/04/22 04:44:57
order levitra from canada generic viagra cialis levitra
2022/04/22 09:15:33
genoa pharmacy online pharmacy adipex
2022/04/22 10:45:47
cialis supr active do you need a prescription for cialis
2022/04/24 06:40:02
Zantac diazepam online pharmacy
2022/04/25 00:56:08
cvs store & pharmacy international drug mart canadian pharmacy online store
2022/04/25 08:48:44
walmart store hours pharmacy global pharmacy canada problems
2022/04/25 14:03:23
cvs pharmacy near me Levitra Professional
2022/04/25 15:11:16
pharmacy store hours express scripts online pharmacy
2022/04/29 13:12:36
how does levitra work levitra or cialis https://glevitrargu.com/
2022/04/30 00:53:50
2022/04/30 17:51:46
viagra generic 50 mg viagra 100mg online canada https://sgiviagraikn.com/
2022/05/01 11:32:07
Eulexin canadian healthcare pharmacy review https://dtupharmyjn.com/
2022/05/01 19:31:30
pharmacy tech online classes business plan for pharmacy store https://jzpharmacyukj.com/
2022/05/02 00:35:53
ivermectin pour on for dogs thomas borody ivermectin https://stromectolujlo.com/
2022/05/02 01:25:38
sildenafil tab sildenafil pulmonary hypertension https://sildenafilkiol.com/
2022/05/04 19:36:11
cheap canadian pharmacy online humana mail order pharmacy
2022/05/05 13:35:49
cialis daily review cialis 5 mg https://dccialisxvf.com/
2022/05/05 20:18:24
levitra 10 mg generic levitra with dapoxetine review https://xclevitradb.com/
2022/05/06 01:48:41
viagra 50mg online how to safely order viagra online https://aviagrasbt.com/
2022/05/09 00:42:57
when was hydroxychloroquine first used https://keys-chloroquinehydro.com/
2022/05/09 09:50:02
levitra (vardenafil) levitra dosage 30 mg https://glevitrargu.com/
2022/05/10 13:01:18
buy prescription drugs online cheap pharmacy drugs store
2022/05/10 15:17:16
2022/05/11 06:49:08
cialis pills online cialis without prescripe https://dccialisxvf.com/
2022/05/11 09:40:54
2022/05/11 13:28:05
levitra samples free is levitra better than viagra https://xclevitradb.com/
2022/05/11 19:41:02
sildenafil effects on female generic sildenafil citrate 100mg https://sildenafilkiol.com/
2022/05/11 19:31:11
viagra india viagra online india buy https://aviagrasbt.com/
2022/05/13 16:26:20
dissertation help online free
dissertation writing memes
what does dissertation mean
2022/05/14 14:43:55
dissertation online help
dissertation literature review help
cultural studies dissertation help
2022/05/15 06:11:05
buy provigil online cheap buy modafinil 200mg for sale modafinil 200mg usa
2022/05/15 09:45:20
writing methodology for dissertation
doctoral dissertation writing assistance
dummies guide to writing a dissertation
2022/05/15 16:16:45
canada drugs lawsuit buy drugs online from canada
2022/05/16 08:56:53
professional dissertation writing
dissertation topics
statistics help for dissertation
2022/05/16 17:17:52
side effect of levitra levitra ebay https://xclevitradb.com/
2022/05/17 17:16:23
affordable dissertation writing
dissertation dedication
uk dissertation writing help quotes
2022/05/18 15:25:40
levitra voucher levitra generic name https://glevitrargu.com/
2022/05/19 08:01:30
2022/05/19 13:07:25
provigil online modafinil pill
2022/05/19 19:23:34
ed pills that work quickly how to buy prescription drugs from canada
2022/05/19 19:19:18
buy provigil sale provigil 100mg price
2022/05/19 21:22:08
dissertation acknowlegements
dissertation acknowledgement sample
dissertation writing support
2022/05/20 13:02:11
cialis when to take cialis and bph https://dccialisxvf.com/
2022/05/20 17:12:20
buy modafinil 100mg for sale order generic modafinil 100mg