Starts in:
2 DAYS
19 HRS
54 MIN
6 SEC
Starts in:
2 D
19 H
54 M
6 S

Microservice Template: Tye Integration

This documentation introduces guidance for running your microservice template on dotnet/tye. We suggest using tye for your development environment. You can check tye getting started page for installation. Running angular application on tye is not supported yet however you can still run all the other stack on tye and run the angular application as it is.

Tye integration is already done in the microservice template. When you run the run-tye.ps1 script, it will automatically create the developer certificates, start the docker infrastructure and run the tye using the --watch flag.

Create Developer Certificates

Developer certificates are required to run the application on HTTPS and the generated certificate file and password are used for Kestrel_Certificate environment.

  • Windows Users: Run the powershell script file create-certificate.ps1. This file will create a self-signed certificate named localhost.pfx with a predefined password using dotnet dev-certs command.

  • Linux Users: dotnet dev-certs may not be fully working on Linux so you may need to generate and trust your own certificate and put localhost.pfx file under etc/dev-cert folder inside solution directory.

    Generate the certificate: Run the commands below to create necessary localhost.pfx file for https certificate under etc/dev-cert folder:

    # See https://stackoverflow.com/questions/55485511/how-to-run-dotnet-dev-certs-https-trust
    # for more details
    
    # Generate certificate from config
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt \
      -config localhost.conf
    
    # Export pfx
    openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.crt -password pass:e8202f07-66e5-4619-be07-72ba76fde97f
    
    # Import CA as trusted
    sudo cp localhost.crt /usr/local/share/ca-certificates/
    sudo update-ca-certificates 
    
    # Validate the certificate
    openssl verify localhost.crt
    
  • Mac Users: You can either download powershell and use the create-certificate.ps1 file to let dotnet dev-certs create the certificate or create the certificate manually using openssl as above.

Running Tye

Make sure you are already running the infrastructure.

Use the command tye run under your main solution directory to run the solution. It will use configured services in the tye.yaml file located under the main solution folder.

tye-run

After tye is initialized, you can navigate to http://127.0.0.1:8000 (or http://localhost:8000) for tye dashboard.

tye-dashboard

Tye Options

For all the run options, you can simply use tye run -h command.

Debug

You can debug any service by attaching to a process. To run a service on debug mode simple use the command with the service name you want to debug:

tye run --debug my-service

You will see an awaiting notice for attaching to a process when you View the Logs of the service you debug:

tye-debugger-attach

In this state, product service will not start until you attach a debugger.

In Visual Studio go to menu Debug -> Attach to Process then select the service process you are debugging.

tye-vs-attach-debugger

You can debug your application normally.image-20210402141429187

If you want to attach a debugger to all of your services, you can use * instead of service name like:

tye run --debug *

Watch

To improve the development pace, you can also enable the file system watchers. This way, only the modified and effected services will be restarted. To enable file watcher simply add --watch switch to run command:

tye run --watch

Stop

To stop tye, simply use the command Ctrl+C on the console tye is running. Keep in mind that, close the tye dashboard before stopping tye since tye may sometime fail to stop processes successfully.

Even if you stop tye, docker infrastructure will still be running. You can use stop-docker.ps1 (or stop-docker.sh) script to stop the docker infrastructure aswell.

Next

Contributors


Last updated: August 10, 2023 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

In this document
Community Talks

What’s New with .NET 9 & ABP 9?

21 Nov, 17:00
Online
Watch the Event
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More