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

Dashboard does not shut down when running Java play framework application #6715

Open
davidfowl opened this issue Nov 18, 2024 · 0 comments
Open
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

Discussed in #6672

Originally posted by schmitch November 14, 2024
Hello I have a scala application that I want to run with dotnet/aspire it's a playframework application, however when I try to run it it crashes the aspire dashboard and it does not work:

var builder = DistributedApplication.CreateBuilder(args);

var baseDirectory = Directory.GetParent(builder.AppHostDirectory)?.FullName;
ArgumentException.ThrowIfNullOrEmpty(baseDirectory);

Console.WriteLine($"Using {baseDirectory} as a base path");

var isWin = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
var isMac = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);

builder
    .AddExecutable("scala-web", "sbt", baseDirectory,
        args: ["run", "-Dplay.server.http.port=9001", "-Dsbt.server.autostart=false"]);

builder.Build().Run();
<Project Sdk="Microsoft.NET.Sdk">
  
  <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsAspireHost>true</IsAspireHost>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
    <PackageReference Include="Aspire.Hosting.NodeJs" Version="9.0.0" />
  </ItemGroup>
</Project>

What might be problematic is that sbt starts in a reloading mode, i.e. something like dotnet watch. After the run I press Ctrl+C however aspire dashboard keeps running besides that it does not work anymore and I cant rerun it.
the dashboard can be accessed shortly after starting and it also prints that it starts playframework however it does not print everything and than the log just hangs and nothing works.

if I use:

var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
        WorkingDirectory = baseDirectory,
        FileName = "sbt",
        UseShellExecute = true,
        Arguments = "run -Dplay.server.http.port=9001 -Dsbt.server.autostart=false",
    }
};
process.Start();

basically everthing works.

Is there something I'm missing?

@joperezr joperezr added the untriaged New issue has not been triaged label Nov 18, 2024
@joperezr joperezr added this to the Backlog milestone Nov 20, 2024
@joperezr joperezr removed the untriaged New issue has not been triaged label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants