Austin
Austin

Reputation: 424

How to install dependent binaries on Azure App Service with Linux?

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

Upvotes: 2

Views: 6206

Answers (3)

Anh-Thi DINH
Anh-Thi DINH

Reputation: 2374

You can use Azure Functions: https://learn.microsoft.com/en-us/azure/azure-functions/bring-dependency-to-functions

Please note that, with this method, you need a binary file of the package you are going to install.

Upvotes: 0

Shrirang - Microsoft
Shrirang - Microsoft

Reputation: 99

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.

Upvotes: 1

Assil
Assil

Reputation: 690

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.

Upvotes: 1

Related Questions