question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Services don't reflect the `host` setting

See original GitHub issue

Describe the bug

It seems that the host is ignored. At least for ServiceType.Project. I need my service to be available for other remote services via a given hostname, not just on localhost.

To Reproduce

When I set services->bindings->host it doesn’t get reflected in my app. It just falls back to localhost:

https://github.com/dotnet/tye/blob/170876742603e8af260f860b66412946fb05cfe0/src/Microsoft.Tye.Hosting/ProcessRunner.cs#L223

On the other hand, the UI shows the host set correctly:

https://github.com/dotnet/tye/blob/170876742603e8af260f860b66412946fb05cfe0/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor#L96

Temporarily, I overcame the issue by specifying args: --urls http://*:5000 as you can see in my yaml.

Further technical details

  • tye --version: 0.5.0-alpha.20520.1+739de2eeb94f0246f50fa4993e953abb4b0da18a
  • Platform: Windows

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jkotalikcommented, Apr 7, 2021

Extra notes from the other issue:

Describe the bug

The host parameter in bindings section in tye.yml is not passed to the service/app.

As a result the service is not binding to the specified IP address or hostname, and is still localhost.

The issue was first reported in #721 . There you find more details about what line of code.

To Reproduce

Create a web project:

dotnet new web -o TestWebApp
cd TestWebApp

This is optional (just copy the config below):

tye init

Add the bindings section (substitute YOUR-IP-ADDRESS with your own IP Address or host name):

name: testwebapp
services:
- name: testwebapp
  project: TestWebApp.csproj
  bindings:
    - name: Test
      host: <YOUR-IP-ADDRESS>
      port: 5643

Further technical details

Tye version: 0.7.0-alpha.21205.1+ad2d7cac132e46d9bd9e1c1c064fd19f35459307. .NET version: 5.0.200

1reaction
marinasundstromcommented, Aug 15, 2021

My workaround for this is using Nginx since I have a lot of services, and Ingress does not work with WebSocket requests.

tye.yaml:

- name: frontend
  project: Frontend/Frontend.csproj
  bindings:
  - port: 5001
    protocol: https

- name: backend
  project: Backend/Backend.csproj
  bindings:
  - port: 5002
    protocol: https

- name: nginx
  image: nginx
  bindings:
    - protocol: https
      port: 8080
  volumes:
    - source: nginx.conf
      target: /etc/nginx/templates/default.conf.template
    - source: certs
      target: /etc/nginx/certs

nginx.conf:

upstream frontend {
    # Using environment variables generated by Tye
    server ${FRONTEND_SERVICE_HOST}:${FRONTEND_SERVICE_PORT};
}

upstream backend {
    server ${BACKEND_SERVICE_HOST}:${BACKEND_SERVICE_PORT};
}

server {
    listen ${NGINX_SERVICE_PORT};
    server_name localhost;

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name localhost;

    ssl_certificate /etc/nginx/certs/localhost.crt;
    ssl_certificate_key /etc/nginx/certs/localhost.key;

    location / {
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;

        proxy_pass https://frontend/;

        resolver 127.0.0.11;
    }

    location /backend/ {
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;

        proxy_pass https://backend/;

        resolver 127.0.0.11;
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker Compose service volume not reflecting my host ...
The only problem I have using the following configuration is that the changes I do on my host machine files, it is not...
Read more >
etc/hosts changes aren't getting reflected on Mac
I've a Spring Boot application which uses an external service. I want to reproduce a scenario where that service is not reachable after...
Read more >
How to Modify Your hosts File Using Windows and Notepad
In this article, we will discuss how to modify your hosts file on your computer.
Read more >
Find and fix issues after adding your domain or DNS records
Learn to track down any problems you run into while setting up a custom domain by making sure the DNS records are set...
Read more >
Troubleshooting Reflection X 14.x XDMCP Connections to ...
The troubleshooting options in this note apply to XDMCP connections made from Reflection X 14.x to the most common UNIX and Linux hosts....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found