aws / apprunner-roadmap

This is the public roadmap for AWS App Runner.
https://aws.amazon.com/apprunner/
Other
292 stars 13 forks source link

Start command does not support running multiple commands #180

Open TuureKaunisto opened 1 year ago

TuureKaunisto commented 1 year ago

Trying to add multiple commands to the Start command field in the web console gives unexpected results. Adding multiple commands to the Build command is supported, so it's perhaps worth mentioning this limitation in the instructions above the Start command field or adding support for multiple commands.

Here's a minimal reproduction of the issue (using apprunner.yaml instead of the web console for convenience)

expected output:

npm run migrate up && npm start
> app-runner-minimal@1.0.0 migrate
> ./migrate.sh up
Running migrate with the following arguments: "up"

got output:

> app-runner-minimal@1.0.0 migrate
> ./migrate.sh up && npm start
Running migrate with the following arguments: "up && npm start"

The reason we'd like to run two commands at startup is because it seems that the environment variables defined in the web console are not available in the build phase and therefore we needed to move the migrations to run during the Start command.

The issue can of course be fixed by creating another npm script that runs all the start commands (which is what we ended up doing while waiting for a better solution)

If we used the apprunner.yaml instead of the web console we would not have this need in the first place but in that case we would not be able to run separate services for production and staging each with their own environment variables easily.