Tye是微软开源的一款开发人员工具, 能够用于简化微服务以及分布式应用程序的开发、测试以及部署过程。
Tye 的首要目标是简化微服务的开发,具体方式包括仅用一行命令执行多项服务、在容器中使用依赖项目,以及使用简单的方法探索其他服务的地址。

安装tye

首先我们安装tye,使用dotnet cli命令。

dotnet tool install -g Microsoft.Tye --version "0.11.0-alpha.22111.1"

安装完后即可使用tye命令

配置tye

首先我们使用tye init命令初始化tye.yaml配置文件
结构大致入下:

name: funshow
services:
- name:
project:
- name:
project:

我们需要在配置文件中添加我们的服务,包括绑定端口,环境变量等。
这里完整的配置文件如下:

name: FunShow
services:
- name: auth-server
project: apps/auth-server/src/FunShow.AuthServer/FunShow.AuthServer.csproj
bindings:
- protocol: https
port: 44322
env:
- Kestrel__Certificates__Default__Path=../../../../etc/dev-cert/localhost.pfx
- Kestrel__Certificates__Default__Password=e8202f07-66e5-4619-be07-72ba76fde97f
- name: administration-service
project: services/administration/src/FunShow.AdministrationService.HttpApi.Host/FunShow.AdministrationService.HttpApi.Host.csproj
bindings:
- protocol: https
port: 44367
env:
- Kestrel__Certificates__Default__Path=../../../../etc/dev-cert/localhost.pfx
- Kestrel__Certificates__Default__Password=e8202f07-66e5-4619-be07-72ba76fde97f
- name: identity-service
project: services/identity/src/FunShow.IdentityService.HttpApi.Host/FunShow.IdentityService.HttpApi.Host.csproj
bindings:
- protocol: https
port: 44388
env:
- Kestrel__Certificates__Default__Path=../../../../etc/dev-cert/localhost.pfx
- Kestrel__Certificates__Default__Password=e8202f07-66e5-4619-be07-72ba76fde97f
- name: logging-service
project: services/logging/src/FunShow.LoggingService.HttpApi.Host/FunShow.LoggingService.HttpApi.Host.csproj
bindings:
- protocol: https
port: 45124
env:
- Kestrel__Certificates__Default__Path=../../../../etc/dev-cert/localhost.pfx
- Kestrel__Certificates__Default__Password=e8202f07-66e5-4619-be07-72ba76fde97f
- name: web-gateway
project: gateways/web/src/FunShow.WebGateway/FunShow.WebGateway.csproj
bindings:
- protocol: https
port: 44325
env:
- Kestrel__Certificates__Default__Path=../../../../etc/dev-cert/localhost.pfx
- Kestrel__Certificates__Default__Password=e8202f07-66e5-4619-be07-72ba76fde97f

bindings表示我们绑定https以及端口号。
env里面配置了我们的本地开发HTTPS证书。

创建本地证书

上面配置里面我们有加载本地证书,那么怎么创建证书呢,在tye仓库中也有说明
https://github.com/dotnet/tye/blob/main/docs/tutorials/hello-tye/00_run_locally.md#generate-the-certificate
仓库中是在linux环境,但是在windows环境中localhost.conf是一样的

[req]
default_bits = 2048
default_keyfile = localhost.key
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = v3_ca [req_distinguished_name]
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = localhost
commonName_max = 64 [req_ext]
subjectAltName = @alt_names [v3_ca]
subjectAltName = @alt_names
basicConstraints = critical, CA:false
keyUsage = keyCertSign, cRLSign, digitalSignature,keyEncipherment [alt_names]
DNS.1 = localhost
DNS.2 = 127.0.0.1

创建etc/dev-cert目录,在目录下添加localhost.conf文件,内容如上。
然后执行dotnet dev-certs命令

dotnet dev-certs https -v -ep localhost.pfx -p e8202f07-66e5-4619-be07-72ba76fde97f -t

就会在目录下面生成localhost.pfx证书文件。

使用tye运行微服务

在目录下面执行tye运行命令

tye run --watch

效果如下:



当然运行服务前我们需要把我们的基础服务都启动,如数据库,消息队列,redis等。
在tye dashboard可以查看服务的日志以及Metrics信息




下面是服务启动页面。
网关服务




认证服务



到这我们后端功能就基本完成啦

ABP微服务系列学习-使用Tye启动微服务的更多相关文章

  1. Fedora 启动 SSH服务

    一.Fedora 启动sshd服务: 1.先确认是否已安装ssh服务: [root@localhost ~]# rpm -qa | grep openssh-server openssh-server ...

  2. 无法启动MYSQL服务”1067 进程意外终止”解决办法

    原文:http://www.111cn.net/database/mysql/48888.htm   本文章主要是总结了各种导致mysql提示无法启动MYSQL服务"1067 进程意外终止& ...

  3. 无法启动mysql服务”1067 进程意外终止”解决办法【简记】

    本文章主要是总结了各种导致mysql提示无法启动MYSQL服务”1067 进程意外终止”的一些解决办法,有碰到mysql无法启动的同学可尝试参考. 在win7的服务器里开启MySql服务提示“wind ...

  4. linux启动http服务

    1.安装apache yum install httpd #根据提示,输入Y安装即可成功安装 systemctl start httpd.service #启动apache systemctl sto ...

  5. 无法启动MYSQL服务”1067 进程意外终止”解决的方法

    自己一開始依照百度经验里的方法——<MySQL下载安装.配置与使用(win7x64)>去安装和配置,可是到后面步骤总是出现1067代号的错误. 慢慢折腾去解决. 这里汇总各种导致mysql ...

  6. 无法启动MYSQL服务”1067 进程意外终止”解决的方法——汇总及终极方法

    自己一開始依照百度经验里的方法--<MySQL下载安装.配置与使用(win7x64)>去安装和配置,可是到后面步骤总是出现1067代号的错误. 慢慢折腾去解决. 这里汇总各种导致mysql ...

  7. Linux启动ssh服务

    Linux启动ssh服务 在Linux下启动ssh服务使用如下命令其一即可: # service sshd start # /etc/init.d/sshd start 开机启动 使用如下方法其就可以 ...

  8. Windows 共享无线上网 无法启动ICS服务解决方法(WIN7 ICS服务启动后停止)

    Windows 共享无线上网 无法启动ICS服务解决方法(WIN7 ICS服务启动后停止) ICS 即Internet Connection Sharing,internet连接共享,可以使局域网上其 ...

  9. Linux:启动http服务

    1.安装apache yum install httpd #根据提示,输入Y安装即可成功安装 systemctl start httpd.service #启动apache systemctl sto ...

  10. idea 启动微服务 设置 run dashboard

    微服务如果很多,启动时如果在run窗口,会不是很方便,所以idea中配置了rundashboard,有时不自动出现时,需要进行配置: 配置操作如下: 我的idea版本2020.2 1.在父工程的.id ...

随机推荐

  1. 《HTTP权威指南》– 8.网关、Web机器人

    集成点:网关.隧道及中继 网关 网关(gateway): 资源和应用程序之间的粘合剂.应用程序可以(通过HTTP或其它已定义的接口)请求网关来处理某条请求,网关可以提供一条响应.网关可以向数据库发送查 ...

  2. .NET周报【12月第2期 2022-12-15】

    国内文章 九哥聊Kestrel网络编程第一章:开发一个Redis服务器 https://mp.weixin.qq.com/s/HJYnBE-7wbvkAYHxQaq3eQ 我和拥有多个.NET 千星开 ...

  3. 中国风?古典系?AI中文绘图创作尝鲜!⛵

    作者:韩信子@ShowMeAI 深度学习实战系列:https://www.showmeai.tech/tutorials/42 本文地址:https://www.showmeai.tech/artic ...

  4. Django TypeError at /login/ 'bool' object is not callable

    代码: def login(request): if request.POST: username = request.POST.get('username') password = request. ...

  5. 重学c#系列——元组 [三十一]

    前言 元组并不是c# 7.0的东西,早之前就有,叫做tuple.7.0加了valuetuple. 来看下元组吧,主要一些注意的地方. 正文 为什么在7.0 之前,元组用的不多呢? 因为tuple 在代 ...

  6. 交互式仪表板!Python轻松完成!⛵

    作者:韩信子@ShowMeAI 数据分析实战系列:https://www.showmeai.tech/tutorials/40 本文地址:https://www.showmeai.tech/artic ...

  7. [OpenCV实战]36 使用OpenCV在视频中实现简单背景估计

    目录 1 时间中值滤波 2 使用中值进行背景估计 3 帧差分 4 总结和代码 5 参考 许多计算机视觉应用中,硬件配置往往较低.在这种情况下,我们必须使用简单而有效的技术.在这篇文章中,我们将介绍一种 ...

  8. Java开发网络安全常见问题

    Java开发网络安全常见问题 等闲识得东风面,万紫千红总是春 1.敏感信息明文传输 用户敏感信息如手机号.银行卡号.验证码等涉及个人隐私的敏感信息不通过任何加密直接明文传输. 如下图中小红书APP 的 ...

  9. [LeetCode]二进制求和

    题目 代码 class Solution { public: string addBinary(string a, string b) { int lenA = a.length(); int len ...

  10. Hugging Face - 推理(Inference)解决方案

    每天,开发人员和组织都在使用 Hugging Face 平台上托管的模型,将想法变成概念验证(proof-of-concept)的 demo,再将 demo 变成生产级的应用. Transformer ...