July 10, 2017 Engineering

Elastic :heart: Windows (aka Windows MSI Installer release)

By Russ CamMartijn Laarman

With the 5.5 release of the Elastic Stack, we're proud to announce the first release of the Windows Installer for Elasticsearch. This first release is the culmination of a collective effort to provide a native installation experience for Windows users getting started with Elasticsearch, in addition to providing a friendlier distribution for scripted installations.

First came .zip

Since the beginning, Elasticsearch and the rest of the Elastic Stack have fully supported cross-platform deployments, allowing developers to run Elasticsearch in production, irrespective of whether their environment of choice is a Linux distribution or a flavour of Windows Server.

The humble .zip package ships both batch and shell scripts to start a single Elasticsearch node on Linux, Mac or Windows, with a sensible default configuration to get you started. This is great for getting started but we can do better on Windows!

Here comes .msi

For those unfamiliar, MSIs (Microsoft Installers) or Windows Installers as they are also known, are packages used for the installation and maintenance of software on Windows. They're a mature technology for performing transactional installs and uninstalls of software, with the ability to easily manage upgrades to newer versions. In addition, Installer packages can be digitally signed to help authenticate the identity of the creator, providing confidence in the integrity of downloaded software.

Graphical user interface

Most importantly, the getting started experience for those new to Elasticsearch on Windows is much improved with a Windows Installer, providing a modern graphical user interface (GUI) to guide the user through the installation process:

Windows Installer - Select locations step

Each step within the process provides contextual help for each displayed input:

msi_installer_help.png

And the interface exposes common configuration options, allowing changes to configuration files to be handled at installation time:

Windows Installer - Configuration step

Further, the installer takes care of installing Elasticsearch as a Windows Service:

Windows Installer - Install as a service step

In contrast to the .zip package, the Windows service configuration included with the Windows Installer no longer relies on Apache Commons™ Daemon Procrun to host the JVM to allow running Elasticsearch as a Windows service. The benefits here are that the Windows service can be controlled with the more familiar sc.exe, and changes to configuration no longer require the service to be reinstalled, as is the case sometimes with using the elasticsearch-service.bat batch file included with the .zip distribution.

Finally, common Elasticsearch plugins can be downloaded and installed at the same time as installing Elasticsearch:

Windows Installer - Select plugins step

The interface offers to download and install commonly used Ingest GeoIP and Ingest Attachment processor plugins, as well as offering our popular X-Pack commercial extensions to the Stack, for example.

Command line

Windows Installers are great for providing installation GUIs but they are equally at home for silent scripted installations. All of the inputs provided within the GUI are also available as command line options for automated deployments. Running the installer from the command line with the defaults is as simple as

start /wait msiexec.exe /i elasticsearch-5.5.0.msi /qn

And to uninstall

start /wait msiexec.exe /x elasticsearch-5.5.0.msi /qn

elasticsearch.exe

The Windows Installer package includes an elasticsearch.exe executable that takes the place of the elasticsearch.bat batch script that ships with the zip archive package. Besides being digitally signed and supporting all of the command line options available that the batch script does, the executable also prints messages to standard output in colour, making it easier to see what's going on whilst developing against Elasticsearch:

Elasticsearch.exe executable

Furthermore, the executable does not require explicitly setting a JAVA_HOME environment variable pointing to the bin directory of the Java installation; the executable can find an installation of Java to use from a number of different places. In order of precedence:

  1. JAVA_HOME process environment variable
  2. JAVA_HOME user environment variable
  3. JAVA_HOME machine environment variable
  4. 64-Bit JDK registry key
  5. 64-Bit JRE registry key
  6. 32-Bit JDK registry key
  7. 32-Bit JRE registry key

The advantage of picking up the location of Java from the registry is that one no longer needs to remember to update JAVA_HOME environment variable after installing an upgraded version of Java.

Thank you Microsoft and .NET Open Source

The development of the MSI would not have gone as quickly or as smoothly without being able to leverage existing Open Source toolsets, libraries and packages. We'd like to give particular shout outs to the following awesome projects in particular:

  • WiX toolset for unravelling the secrets of Windows Installer packages for mere mortals
  • WixSharp for making working with WiX easier for even merer mortals
  • Mahapps for making it easy to build Windows Metro styled desktop interfaces
  • Reactive UI for providing a rich MVVM framework for building elegant and testable user interfaces
  • Fody for providing easy to use tooling for IL merging and weaving

Feedback

We'd love to get your feedback on your installer experience; please take it for a spin and let us know if you run into issues. For future, we're looking to leverage the Windows MSI installer for our chocolatey package and other package managers for Windows.

To be clear, we have no plans to remove the .zip distribution in the future for Windows, so if this is working great for you already, rest assured you can keep doing what you’re doing.

For our Microsoft fans, now you can deploy Elasticsearch using any of your favourite methods; from Azure ARM templates, to on-site MSI installs, to old-fashioned portable zip files, Elastic's got you covered!