Azure / InnovationEngine

An experiment in simplicity for complex environments
MIT License
30 stars 14 forks source link

Unable to run background processes #200

Open rgardler-msft opened 3 weeks ago

rgardler-msft commented 3 weeks ago

It seems that IE can't currently execute background processes. This means that some scripts are not possible, for example, I'm trying to write a doc that will create and deploy a functions + storage application. To do this it is I am using the Functions Core Tools as follows:

Install dependencies

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt update
sudo apt-get install -y azure-functions-core-tools-4
export FUNCTION_RUNTIME_VERSION="20"
curl -fsSL https://deb.nodesource.com/setup_$FUNCTION_RUNTIME_VERSION.x | sudo -E bash -
sudo apt install -y nodejs
sudo apt install -y npm

Create local functions project.

func init --javascript
npm install

This works when running manually, but the npm install requires return to be pressed to get control back. In IE it never returns control, the "busy" indicator just keeps spinning:

  \[2024-06-07T23:43:03.538Z] Worker process started and initialized.
  /[2024-06-07T23:43:08.535Z] Host lock lease acquired by instance ID '000000000000000000000000B8866BB3'.
  /
vmarcella commented 2 weeks ago

Is func init supposed to spawn a new process that lives during the entire execution of the scenario? From IEs perspective, there's no notion of background/foreground processes. Everything in ie is currently treated as a foreground process because executing a command blocks the execution of all other commands until it is finished so that it's result and status can be checked. Commands that have lifetimes which exist beyond the codeblock they're spawned are going to have to be treated differently than commands that don't, but I will need to investigate further into the exact usage you're looking for.

SorraTheOrc commented 2 weeks ago

Yes, it is intended to run a background process. The use case here is that it is the local Azure Functions emulation used when developing functions. However, with my testing so far it seems that using func init is a best practice as it not only creates the local functions server but it also scaffolds the application.

We can work around this by moving the developer parts of the documentation into a different doc and starting our exec doc for deployment from the point of having a working local app. This isn't ideal, but it should work.

Consider this a low pri ask until we get more use cases.