Running Apache Solr 6.5 on an Azure App Service instance
Thu, Jun 1, 2017This post describes a daring way to attempt to deploy a single Solr node to an Azure App Service. I say daring because I could not find a copy paste solution on Stack Overflow. I saw some light at the end of the tunnel after reading the Upload a custom Java web app to Azure article on Azure documentation which mentions Jetty and since Solr is running in a Jetty Servlet container by default I guessed I should at least give it a try.
Why Azure App Services?
I have a small amount of data to index and I will never need more than one Solr node running, so why not. A pre-configured Linux VM would be an overkill. I haven’t tried Azure Search yet, but with Solr I can retrieve all the stats data for my filters and search results in a single request, not to mention its powerful natural language processing capabilities.
Let’s get to work…
Azure Portal’s configuration UI
You only need to enable Java (at least version 1.8 for Solr > 6.x) and Jetty as a Web Container.

Web.config httpPlatform configuration
Extract contents of solr-6.5.1.zip to %HOME%\site\wwwroot folder of your App Service and add a Web.config with the following settings:
HTTP_PLATFORM_PORT
is the environment variable that holds the port number Azure has dynamically assigned to the Java process. We use its value as a parameter to the -p switch so that Solr does not start on the default port which is 8983.
Having stdoutLogEnabled
enabled causes the stdout and stderr for the process specified in the processPath setting to be redirected to location defined in stdoutLogFile.
The default value of stdoutLogFile should be %HOME%\LogFiles\ but in my case the logs were actually written to %HOME%\site\wwwroot\
Although there seem to be some problems during the startup, Solr starts up successfully and you can access the Admin panel at <yoursite>.azurewebsites.net
Access is denied. Waiting up to 30 to see Solr running on port 16055 INFO - 2017-06-09 12:44:49.394; org.apache.http.impl.client.DefaultRequestDirector; I/O exception (java.net.SocketException) caught when connecting to {}->http://localhost:16055: Permission denied: connect INFO - 2017-06-09 12:44:49.521; org.apache.http.impl.client.DefaultRequestDirector; Retrying connect to {}->http://localhost:16055 INFO - 2017-06-09 12:44:49.659; org.apache.http.impl.client.DefaultRequestDirector; I/O exception (java.net.SocketException) caught when connecting to {}->http://localhost:16055: Permission denied: connect INFO - 2017-06-09 12:44:49.659; org.apache.http.impl.client.DefaultRequestDirector; Retrying connect to {}->http://localhost:16055 Started Solr server on port 16055. Happy searching!That’s it! And oh yeah, don’t forget to enable Authentication (Azure App Service / Solr Authentication Plugins) or else everyone will have access to your Admin panel and Solr API.