0

I have a spring boot application that I am running on Azure App Service (Linux). My application has a dependency on a binary and needs it to be present on the system. How do I install it on my App service?

I tried the following two options:

  1. Did ssh via Kudu and installed the package ($ apk add package). But the changes are not persisted beyond /home. The dependencies were installed in other folders and when the app service was re-deployed all those dependencies were gone
  2. Used the post deployment hook to run the command "$ apk add package" to install once the deployment finishes. This script is run as can be seen from the custom log statements but still i do not see the installed package. Even when is use apt-get it says "unable to lock administration directory"

Using a statically compiled binary is not an option for me since that has its own issues. Thanks

Austin
  • 404
  • 4
  • 14

2 Answers2

1

For the Tomcat, Java SE and WildFly apps on App Service Linux, you can create a file at /home/startup.sh and use it to initialize the container in any way you want (Example: you can install the required packages using this script).

App Service Linux checks for the presence of /home/startup.sh at the time of startup. If it exists, it is executed. This provides web app developers with an extension point which can be used to perform necessary customization during startup, like installing necessary packages during container startup.

  • Thats what i did by the post deployment hooks. Added commands to install the dependencies, but neither of "ap-get" or "apk add" are working. The file is executing as can be seen from another dummy command but on the apt-get and "apk add" i get the error: unable to lock administration directory – Austin Oct 15 '19 at 09:37
  • Can you please explain how exactly we use startup.sh in azure app service as startup command – Muthu Kumar Nov 26 '19 at 05:40
  • Though it's old post, for sake of someone . https://stackoverflow.com/questions/59315050/asp-net-core-nodeservices-on-azure-linux-webapp – Explore Jan 31 '20 at 17:09
  • 1
    Updated my earlier reply to clarify on the question by @MuthuKumar. This is a belated response, but might help others having the same question. Thanks! – Shrirang - Microsoft Apr 22 '20 at 21:39
0

I think this is a common problem with Linux on Azure. I recommend having a step back and consider one of the following options.

  1. Run your application in a container that has all the dependencies you are looking for.
  2. Run your application on Linux VM IaaS instead of Azure App Service (Linux),PaaS.
  3. Run your application on Windows OS PaaS and add extension for your dependency.(Most likely you won't run into this problem when using Windows OS)

While I understand that none of them might be acceptable by you, but I have not found a solution for that problem in those specific circumstances.

Assil
  • 572
  • 6
  • 21