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

Not able to open test application when running app-localtest with podman #84

Open
sbang opened this issue Feb 15, 2024 · 2 comments
Open
Labels
kind/bug Something isn't working

Comments

@sbang
Copy link

sbang commented Feb 15, 2024

Description of the bug

I did the following:

  1. Created a test application as outlined in https://docs.altinn.studio/nb/app/app-dev-course/
  2. Cloned app-localtest and followed the podman instructions in README.md
  3. I tried opening http://local.altinn.cloud:8000/ but got an error message
    An exception occured while fetching applicationData
    No application running on http://host.docker.internal:5005
    Please start your an app on this adress. Typically run the following command in an app directory.
    
    dotnet run
    
    
  4. However the application has been started with "dotnet run" as outlined in README.md and is running, listening to port 5005
image
  1. Tried opening http://host.docker.internal:5005 with curl but got "could not resolve host host.docker.internal":
    EMEAAD+sbang@AAP-5CG32757DH:~$ curl --verbose http://host.docker.internal:5005
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Could not resolve host: host.docker.internal
    * Closing connection
    curl: (6) Could not resolve host: host.docker.internal
    EMEAAD+sbang@AAP-5CG32757DH:~$
    
  2. I tried adding host.docker.internal as an alias for localhost in c:\Windows\System32\Drivers\etc\hosts
    # localhost name resolution is handled within DNS itself.
            127.0.0.1       localhost, host.docker.internal
            ::1             localhost, host.docker.internal
    
  3. This made http://host.docker.internal:5005 work with curl (but got 404 on the root)
  4. But http://local.altinn.cloud:8000/ still got the same error message
  5. Deleted the containers in podman and ran "podman compose --file podman-compose.yml up -d --build" again
  6. After the containers were up, tried http://local.altinn.cloud:8000/ but still got the same error message

Steps To Reproduce

  1. Create an Altinn test application
  2. Clone test application to a windows 11 machine
  3. Install podman desktop as outlined in the app-localtest README
  4. Run app-localtest with podman as outlined in the app-localtest README
  5. Try opening http://local.altinn.cloud:8000/ in a web browser and get the error message

Additional Information

Windows 11 Enterprise, Microsoft .Net SDK 6.0.418, podman desktop 1.7.1, podman 4.9.2

@sbang sbang added the kind/bug Something isn't working label Feb 15, 2024
@olebhansen
Copy link
Contributor

olebhansen commented Jul 29, 2024

Hi, if this is still an issue: Can you try replacing host.docker.internal in \podman-compose.yml and \src\appsettings.Podman.json with the output from running hostname in windows + a ".local" postfix? E.g.

{
  "AuthnGeneralSettings": {
    "PlatformEndpoint": "http://localhost:5101/"
  },
  "LocalPlatformSettings": {
    "LocalAppMode": "http",
    "LocalFrontendHostname": "MyLocalHostName.local",
    "LocalAppUrl": "http://MyLocalHostName.local:5005",
    "LocalTestingStorageBasePath": "/AltinnPlatformLocal/",
    "LocalTestingStaticTestDataPath": "/testdata/",
    "LocalGrafanaUrl": "http://monitoring_grafana:3000"
  }
}

I was facing the same problem and think this was the change that resolved the same error as you observed.

olebhansen added a commit that referenced this issue Aug 2, 2024
@olebhansen
Copy link
Contributor

FYI; Also found that (in my case) the networking must be set to "user-mode" when creating the podman machine. Full description is in the linked PR.

olebhansen added a commit that referenced this issue Sep 27, 2024
* Update based on recent run-through. Updated .net rewuirement, formatting and describing workaround/solution for #84

* Linux users are first class citizens. Vfkit is perhaps not needed after Podman 5.0.0, so splitting this to a separate segment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants