当前位置: 首页 > news >正文

asp.net docker-compose添加网关和网关配置

打开docker-compose.yml

添加

  killsb-social-apigw:image: ${REGISTRY:-killsbdapr}/killsb-social-apigw:${TAG:-latest}build:context: .dockerfile: src/ApiGateways/SocialEnvoy/Dockerfile

在路径src\ApiGateways\SocialEnvoy

添加envoy.yaml

admin:access_log_path: "/dev/null"address:socket_address:address: 0.0.0.0port_value: 8001
static_resources:listeners:- address:socket_address:address: 0.0.0.0port_value: 80filter_chains:- filters:- name: envoy.http_connection_managerconfig:codec_type: autostat_prefix: ingress_httproute_config:name: eshop_backend_routevirtual_hosts:- name: eshop_backenddomains:- "*"cors:allow_origin_string_match:- safe_regex:google_re2: {}regex: \*allow_methods: "GET, POST, PUT"allow_headers: "authorization, content-type, x-requestid, x-requested-with, x-signalr-user-agent"allow_credentials: trueroutes:- name: "pics"match:prefix: "/pics/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: image-apitimeout: 300s- name: "c-short"match:prefix: "/b/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: blog-apitimeout: 300s- name: "c-long"match:prefix: "/blog-api/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: blog-apitimeout: 300s- name: "f-short"match:prefix: "/f/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: forum-apitimeout: 300s- name: "f-long"match:prefix: "/forum-api/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: forum-apitimeout: 300s- name: "f-short"match:prefix: "/a/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: account-apitimeout: 300s- name: "f-long"match:prefix: "/account-api/"route:auto_host_rewrite: trueprefix_rewrite: "/"cluster: account-apitimeout: 300shttp_filters:- name: envoy.cors- name: envoy.routeraccess_log:- name: envoy.file_access_logfilter:not_health_check_filter: {}config:json_format:time: "%START_TIME%"protocol: "%PROTOCOL%"duration: "%DURATION%"request_method: "%REQ(:METHOD)%"request_host: "%REQ(HOST)%"path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"response_flags: "%RESPONSE_FLAGS%"route_name: "%ROUTE_NAME%"upstream_host: "%UPSTREAM_HOST%"upstream_cluster: "%UPSTREAM_CLUSTER%"upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"path: "/tmp/access.log"clusters:- name: daprconnect_timeout: 0.25stype: strict_dnslb_policy: round_robinhosts:- socket_address:address: 127.0.0.1port_value: 3500- name: image-apiconnect_timeout: 0.25stype: strict_dnslb_policy: round_robinhosts:- socket_address:address: ${ENVOY_SOCIAL_IMAGE_API}port_value: 80- name: blog-apiconnect_timeout: 0.25stype: strict_dnslb_policy: round_robinhosts:- socket_address:address: ${ENVOY_SOCIAL_BLOG_API}port_value: 80- name: forum-apiconnect_timeout: 0.25stype: strict_dnslb_policy: round_robinhosts:- socket_address:address: ${ENVOY_SOCIAL_FORUM_API}port_value: 80- name: account-apiconnect_timeout: 0.25stype: strict_dnslb_policy: round_robinhosts:- socket_address:address: ${ACCOUNT_API}port_value: 80

添加Dockerfile

FROM envoyproxy/envoy:v1.14.2COPY src/ApiGateways/SocialEnvoy/envoy.yaml /tmpl/envoy.yaml.tmpl
COPY src/ApiGateways/SocialEnvoy/docker-entrypoint.sh /RUN chmod 500 /docker-entrypoint.shRUN apt-get update && \apt-get install gettext -yENTRYPOINT ["/docker-entrypoint.sh"]

添加docker-entrypoint.sh

#!/bin/sh
set -eecho "Generating envoy.yaml config file..."
cat /tmpl/envoy.yaml.tmpl | envsubst \$ENVOY_SOCIAL_BLOG_API,\$ENVOY_SOCIAL_FORUM_API,\$ENVOY_SOCIAL_IMAGE_API,\$ACCOUNT_API > /etc/envoy.yamlecho "Starting Envoy..."
/usr/local/bin/envoy -c /etc/envoy.yaml

运行vs2022

http://www.lryc.cn/news/222086.html

相关文章:

  • 论文阅读:LOGO-Former: Local-Global Spatio-Temporal Transformer for DFER(ICASSP2023)
  • 【GO】项目import第三方的依赖包
  • 【Linux基础IO篇】用户缓冲区、文件系统、以及软硬链接
  • 电脑软件:推荐一款电脑多屏幕管理工具DisplayFusion
  • 免费好用的网页采集工具软件推荐
  • 6.ELK之Elasticsearch嵌套(Nested)类型
  • RefConv: 重参数化的重新聚焦卷积(论文翻译)
  • 指令重排序
  • 【Head First 设计模式】-- 观察者模式
  • JavaWeb篇_01——JavaEE简介【面试常问】
  • QtC++与QRadioButton详解
  • 移远EC600U-CN开发板 day01
  • 【C/C++】什么是POD(Plain Old Data)类型
  • 注册虾皮买家号需要哪些资料?
  • 小腿筋膜炎怎么治疗最有效
  • After Effects 2024 v24.0.2(AE2024)
  • 自己实现一个自动检测网卡状态,并设置ip地址
  • 【Linux】进程程序替换
  • 项目构建工具maven的基本配置+idea 中配置 maven
  • 【解密ChatGPT】:从过去到未来,揭示其发展与变革
  • 系统架构设计】计算机公共基础知识: 5 数学与经济管理
  • Visual Studio 2019光标变成灰色方块问题
  • C++ http协议POST body raw 字段向服务器发送请求
  • 通过migrate命令实现两个redis实例之间的数据迁移
  • Unity 判断两个UI是否相交
  • swoole process 消息通信
  • uniapp跳转方式
  • 六大排序算法:插入、选择、冒泡、快排、希尔、归并
  • 短信登录实现(黑马点评为例)
  • 【uniapp】签名组件,兼容vue2vue3