pda 使用 docker 和 kong
kong docker 安装
- https://docs.konghq.com/gateway/latest/install/docker/
- https://blog.csdn.net/weixin_57849570/article/details/132101497
创建一个网络
docker network create kong-net
Start a PostgreSQL container:
docker run -d --name kong-database --network=kong-net -p 5432:5432 -e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong" -e "POSTGRES_PASSWORD=kongpass" postgres:13
docker run --rm --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_PASSWORD=kongpass" -e "KONG_PASSWORD=test" kong/kong-gateway:3.5.0.1 kong migrations bootstrap
docker run -d --name kong-gateway --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kongpass" -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_GUI_URL=http://localhost:8002" -e KONG_LICENSE_DATA -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 -p 8002:8002 -p 8445:8445 -p 8003:8003 -p 8004:8004 kong/kong-gateway:3.5.0.1
docker run -d --network=kong-net -p 8201:8201 --name pda_runing pda
default.conf
server {
listen 8201;
server_name localhost; # 修改为docker服务宿主机的ip
location /pda/ {
proxy_pass http://localhost:8200/;
}
}
server {
listen 8200;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
location ~ / {
try_files $uri $uri/ @router;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
}
location @router {
rewrite ^.*$ /index.html last;
}
}
Dockerfile
FROM nginx
MAINTAINER onesummer
RUN rm /etc/nginx/conf.d/default.conf
ADD default.conf /etc/nginx/conf.d/
COPY dist/ /usr/share/nginx/html/
页面配置

