https://github.com/romijulianto/kong-cdn-integration
Kong API Gateway in Docker and Integration with CDN
https://github.com/romijulianto/kong-cdn-integration
Last synced: 2 months ago
JSON representation
Kong API Gateway in Docker and Integration with CDN
- Host: GitHub
- URL: https://github.com/romijulianto/kong-cdn-integration
- Owner: romijulianto
- Created: 2023-08-27T11:05:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-27T14:36:21.000Z (over 1 year ago)
- Last Synced: 2025-01-19T08:15:13.633Z (4 months ago)
- Language: Python
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kong API Gateway with CDN Integration Python
## Installing Prerequisites
Python `module request`
```shell
$ pip install requests
```
Docker Desktop Windows with `wsl 2`
```shell
$ wsl --update
```## Getting started
#### Important note
From official github of Kong there is one issue https://github.com/Kong/kong/issues/5324, so we can't use kong's latest docker image. So we will use `kong:1.3.0-alpine` docker image.Change directory to `src`
```shell
$ cd src
```
Create `kong network`
```shell
$ ./script/create_kong_network
```Start `postgres`
```shell
$ ./script/start_postgres
```Migrate `kong database`
```shell
$ ./script/migration_bootstrap
$ ./script/migration_up
```Migrate `kong admin database`
```shell
$ ./script/prepare_konga
```Start `kong api gateway`
```shell
$ ./script/start_kong
```Start `kong admin`
```shell
$ ./script/start_konga
```Open `kong admin UI` http://localhost:1337/
#### Prepare Microservices CDN Integration
There are one `microservices` example for this demo with 2 script python, `upload.py` and `retrieve.py`. It is just simple `microservice` written in `Python`. Here how to run itAdd `Services` to Kong API Gateway
```shell
$ curl -i -X POST --url http://localhost:8001/services/
--data 'name=ecommerce-romi'
--data 'url=http://apache2.romijulianto.my.id/'
```Add `Routes` to Kong API Gateway
```shell
$ curl -i -X POST --url http://localhost:8001/services/ecommerce-romi/routes
--data 'paths[]=/cdn-assets'
```Change Directory to `services`
```shell
$ cd services
```
Run `upload.py````shell
$ python upload.py
```Run `retrieve.py`
```shell
$ python retrieve.py
```