Skip to content

Hello Engine

Get started by running the Qlik Associative Engine in a Docker container on your local machine and communicating with it using enigma.js.

Prerequisites

Clone the Get Started Git repository to your local machine. The Hello tutorials are located here, and all commands should be executed from this Git repository.

You must have Node.js and npm installed on your local machine.

Starting the Qlik Associative Engine service

  1. Start the engine in a Docker container. Run the following command in a command shell:

    Note

    Before you deploy, you need to set the ACCEPT_EULA environment variable, otherwise the Qlik Associative Engine won't start.

    ACCEPT_EULA=yes docker-compose up -d
    

    When you run this command, Docker builds the container and leaves it running in the background. If successful, you will see a message that creating the container is done.

  2. Verify that the dockerized engine is running.

    Run the following command in a command shell:

    docker ps -a
    

    The docker ps command lists the containers that are running. The -a option lists all containers, even those that are not running.

Note

You can access the logs for a functional container by running the following command:

   docker logs <container-id>

What is happening

When you execute the docker-compose up command, Docker builds and starts a Docker container with the services configured in the docker-compose.yml file. The -d option keeps the container running in the background. In this example, Docker builds the container from the docker-compose.yml file. This file is located in the root folder of the Getting Started with Web Platform Git repository. Open the docker-compose.yml file to see what the compose file looks like. It specifies how the engine runs as a Docker container, using the qlik/engine Docker image.

Tip

To learn more about Docker compose files, see Compose file.

Communicating with the Qlik Associative Engine

To communicate with the engine in a Docker container, we use a small node.js application that uses enigma.js to retrieve the engine version number.

The application consists of the hello-engine.js file and the package-json file, which is also shared among the Hello Data and Hello Visualization tutorials.

  1. Install dependencies.

    Run the following command in a command shell:

    npm install
    

    This command installs all of the dependent packages listed in the package.json file.

  2. Run the application.

    Run the following command in a command shell:

    npm run hello-engine
    

    This command runs the application, which communicates with Qlik Associative Engine and retrieves the engine semantic version. If successful, you will see a response like the following:

    npm run hello-engine
    Creating and opening session.
    Engine version retrieved: 12.91.0
    Session closed.
    

    Tip

    Open the hello-engine.js file to see how enigma.js is configured to communicate with the Qlik Associative Engine.

  3. Stop and remove the Docker container.

    Note

    To continue with the next tutorial, leave the Docker container running.

    Run the following command from a command shell:

    docker-compose down
    

    This command stops the container and removes it.

Next steps

Continue with the Hello Data tutorial to learn how to load data into the Qlik Associative Engine. Hello Data is a continuation of this tutorial.

Tip

We recommended that you take a look at enigma.js to learn about its many features.