Azurite
Azurite copied to clipboard
azurite launch scripts should support disconnecting from parent process stdio streams
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
3.8.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
npm (the NuGet one hasn't been touched in years. Is it deprecated?)
What's the Node.js version?
12
What problem was encountered?
The azurite
scripts should support spinning off a child process that doesn't use its parent process's stdio streams, so that a script can start the emulator and proceed to do other things (e.g. run tests) while the emulator continues to run.
I find the solution to #382 unsatisfactory.
Azure Pipelines doesn't like that azurite &
leads to a child process that doesn't exit when bash
does:
https://dev.azure.com/andrewarnott/OSS/_build/results?buildId=3547&view=logs&j=2d2b3007-3c5c-5840-9bb0-2b1ea49925f3&t=3cfa5d13-d456-5c32-1f87-e23b82c00683&l=15
The STDIO streams did not close within 10 seconds of the exit event from process 'C:\Program Files\Git\bin\bash.exe'. This may indicate a child process inherited the STDIO streams and has not yet exited.
Besides the ignorable warning this presents, it also represents 10 seconds of an unnecessary pause in the pipeline.
Most other emulators including Azure Storage Emulator support a command that allows the process to continue running while the console that spawned it goes on (or exits). Can azurite please support this?
Steps to reproduce the issue?
azurite-blob
Have you found a mitigation/solution?
I'd like to see usage like this where a script could contain:
azurite start
dotnet test
azurite stop
But more than that, I want one step in Azure Pipelines to be azurite start
while the next step is the use of the DotNetCoreCLI
task to run tests so I get all the test integration features of Azure Pipelines. But right now, I can't do that because the stdio-bound azurite process gets terminated when the prior bash step exits.
@AArnott
Thanks for raising the issue! We will evaluate it.
We welcome contribution to Azurite. It would be great if you could contribute the the fix of this issue.
So was there any progress in this?
@trailmax
Would you please share you user scenario, why you don't want to show the console of Azurite running?
Besides that, from https://github.com/Azure/Azurite/issues/1984 I see you use Azurite in Visual Studio. In this way, the Azurite executable is usually in "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\azurite.exe"
There are several ways to create windows service some executable in https://stackoverflow.com/questions/3582108/create-windows-service-from-executable, not sure if it can help you.
@blueww Well, why would I want an extra console window floating about all the time? I work on legacy MVC5 app that needs local storage. In and out of debugging all the time. Previously Storage Emulator was doing just that in the background with no issue, now I need to have to think if I have started the azurite or not.
I'll try sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
next time.
@blueww Well, why would I want an extra console window floating about all the time? I work on legacy MVC5 app that needs local storage. In and out of debugging all the time. Previously Storage Emulator was doing just that in the background with no issue, now I need to have to think if I have started the azurite or not.
I'll try
sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
next time.
I second this, azurite should be a background process, optionally with an icon in the tray. I have it running continuously and I don't want a console window open all the time.
@trailmax , @PehrGit
I have tried the way (sc.exe) in https://stackoverflow.com/questions/3582108/create-windows-service-from-executable, and successfully start Azurite with a windows service.
@trailmax , @PehrGit
I have tried the way (sc.exe) in https://stackoverflow.com/questions/3582108/create-windows-service-from-executable, and successfully start Azurite with a windows service.
That's awesome. Could you share the exact command you used? I'm getting an error "Windows could not start the azuritesvc service on Local Computer. Error 192: 0xc1"
@PehrGit
I create the service with "nssm.exe" in https://stackoverflow.com/questions/3582108/create-windows-service-from-executable
Please note I have Visual studio installed on my machine , and start the service with Azurite.exe inside VS. Normally it will be in: "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\azurite.exe".
Please note "nssm.exe" is not controlled by us, so make sure it will not harm your computer before use it.
@blueww I hate that. Instead of writing code an be productive, I'm now mucking about with some third party nssm.exe
and trying to configure it. And then trying to resolve port conflicts because something else is also trying to start azurite on the same ports. Such a let down from Microsoft. Again. Sigh 😢
@trailmax
Azurite is a cross platform application, and has several distribution channels (npm, docker, VS, Vscode extention), And the way to start Azurite in different channels are different, so currently we can't find a way to stop Azurite starting from conflict port besides reporting error. Please make sure you only have 1 Azurite instance start on you machine, or start different Azurite instance with different ports.
For the service, as we are still working on new feature implementation, and this issue has workaround, it might won't be our priority recently.
Azurite welcome contribution! If you have a good idea to implement running Azurite as a service, you might can raise a PR to implement it (It's better to raise the design first, and get agreement with us, so the PR can pass review easier).
There is a way to make Visual Studio start Azurite with the web project but it installs several nuget packages, a secrets file, and multiple config files. Unfortunately I am sticking with the legacy Storage Emulator as its much easier to live with.