Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat gateway #142

Merged
merged 3 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions deploy/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
- laf_shared_network

system-server:
image: system-server
image: lafyun/system-server:0.8.0
user: root
working_dir: /app
environment:
Expand Down Expand Up @@ -98,21 +98,20 @@ services:
SYS_CLIENT_HOST: ${SYS_CLIENT_HOST:?err}
SYSTEM_EXTENSION_APPID: ${SYSTEM_EXTENSION_APPID}
volumes:
- ./apisix_conf.yaml:/usr/local/apisix/conf/config.yaml:ro
- ./gateway_conf.yaml:/usr/local/apisix/conf/config.yaml:ro
ports:
- ${PUBLISH_PORT:-8080}:9080
networks:
- laf_shared_network

gateway-controller:
image: gateway-controller
image: lafyun/gateway-controller:0.8.0
depends_on:
- gateway
environment:
DEPLOY_DOMAIN: "${DEPLOY_DOMAIN:?err}"
DEPLOY_OSS_DOMAIN: ${OSS_DOMAIN}
SYS_CLIENT_HOST: ${SYS_CLIENT_HOST:?err}
SYSTEM_EXTENSION_APPID: ${SYSTEM_EXTENSION_APPID}
LOG_LEVEL: debug
SERVICE_DRIVER: docker
GATEWAY_TYPE: apisix
Expand All @@ -121,16 +120,6 @@ services:
networks:
- laf_shared_network

apisix-dashboard:
image: apache/apisix-dashboard:2.13-alpine
restart: always
volumes:
- ./dashboard_conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
ports:
- "9000:9000"
networks:
- laf_shared_network

instance-controller:
image: lafyun/instance-controller:0.8.0
user: root
Expand Down
59 changes: 49 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ services:
networks:
- laf_shared_network

etcd:
image: 'bitnami/etcd:3.5.4'
environment:
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
volumes:
- etcd-data:/bitnami/etcd/data
ports:
- 2379
- 2380
networks:
- laf_shared_network

oss:
image: 'bitnami/minio:2022.4.12'
environment:
Expand Down Expand Up @@ -104,21 +117,47 @@ services:
- laf_shared_network

gateway:
image: openresty/openresty:latest
image: apache/apisix:2.14.1-alpine
depends_on:
- mongo
- system-server
- etcd
volumes:
- ./gateway_conf.yaml:/usr/local/apisix/conf/config.yaml:ro
ports:
- 8080:9080
networks:
- laf_shared_network

gateway-controller:
build: ./packages/gateway-controller
user: root
working_dir: /app
environment:
DEPLOY_DOMAIN: "*.127-0-0-1.nip.io" # `*.127-0-0-1.nip.io` always resolved to 127.0.0.1, used to local development
DEPLOY_OSS_DOMAIN: "oss.127-0-0-1.nip.io"
DEPLOY_DOMAIN: 127-0-0-1.nip.io
DEPLOY_OSS_DOMAIN: oss.127-0-0-1.nip.io
SYS_CLIENT_HOST: console.127-0-0-1.nip.io
SYSTEM_EXTENSION_APPID: '000000'
LOG_LEVEL: debug
SERVICE_DRIVER: docker
GATEWAY_TYPE: apisix
SYS_DB_URI: mongodb://my_user:password123@mongo:27017/?authSource=laf-sys&replicaSet=laf&writeConcern=majority
API_SIX_KEY: edd1c9f034335f136f87ad84b625c8f1
command: node ./dist/index.js
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./packages/gateway-controller:/app
depends_on:
- gateway
restart: always
networks:
- laf_shared_network


apisix-dashboard:
image: apache/apisix-dashboard:2.13-alpine
restart: always
volumes:
- ./packages/gateway/scripts:/scripts
- ./packages/gateway/conf.docker:/conf.docker
command: "sh /scripts/start.sh"
- ./gateway_dashboard_conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
ports:
- 8080:80
- "9000:9000"
networks:
- laf_shared_network

Expand Down
1 change: 0 additions & 1 deletion docs/.vitepress/.temp/CNAME

This file was deleted.

Binary file removed docs/.vitepress/.temp/logo.png
Binary file not shown.
Binary file removed docs/.vitepress/.temp/zhuo.png
Binary file not shown.
26 changes: 26 additions & 0 deletions gateway_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apisix:
node_listen: 9080 # APISIX listening port
enable_ipv6: false

allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.

admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin # admin: manage all configuration data
# viewer: only can view configuration data
- name: "viewer"
key: 4054f7cf07e344346cd3f287985e76a2
role: viewer

enable_control: true
control:
ip: "0.0.0.0"
port: 9092

etcd:
host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
- "http://etcd:2379" # multiple etcd address
prefix: "/apisix" # apisix configurations prefix
timeout: 30 # 30 seconds
File renamed without changes.
6 changes: 5 additions & 1 deletion packages/gateway-controller/src/support/apisix-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ async function createAppRoute(url: string, route: IRouteData) {
connect: 600,
send: 600,
read: 600,
}
},
plugins: {
cors: {}
},
enable_websocket: true
}
return await ApiSixHttpUtils.put(url, route.appid, data)
}
Expand Down
4 changes: 0 additions & 4 deletions packages/gateway/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions packages/gateway/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions packages/gateway/README.md

This file was deleted.

51 changes: 0 additions & 51 deletions packages/gateway/conf.docker/app.conf

This file was deleted.

93 changes: 0 additions & 93 deletions packages/gateway/conf.docker/oss.conf

This file was deleted.

49 changes: 0 additions & 49 deletions packages/gateway/conf.docker/system.conf

This file was deleted.

Loading