Host Elastic Maps Service locally

I use an offline virtual machine (Red Hat), and I want to create some maps. So, I followed the documentation of hosting Elastic maps service locally, and I'm going to use the Docker image for the map server.

However, when I execute this command :
sudo docker run --rm --init --publish 8080:8080 \docker.elastic.co/elastic-maps-service/elastic-maps-server-ubi8:8.8.1

I receive this error :
{"log.level":"error","@timestamp":"2023-11-03T10:04:34.826Z","process":{"pid":7},"host":{"hostname":"37ce03cfc7b5"},"log":{"logger":"Elastic Maps Server"},"message":"Unable to connect to the Elasticsearch cluster: http://elasticsearch:9200","ecs":{"version":"1.6.0"}}

I'm not sure if I need to configure something before this?

Ps : For your information, I'm using two distinct virtual machines. I pulled the Docker image in my Kibana instance, and Elasticsearch is in another instance.

A command line like that is not passing any configuration, so you are running the server with all the defaults that imply that your elasticsearch server (used to validate you have an Enterprise license) is available at http://elasticsearch:9200.

In general, you need to pass a configuration file as documented here via a docker bind mount.

In that configuration file, you set up your Elasticsearch cluster settings and any other details.

To check the default configuration, you can run this command:

docker run --rm \
 docker.elastic.co/elastic-maps-service/elastic-maps-server-ubi8:8.8.1 \
 cat /usr/src/app/server/config/elastic-maps-server.yml

and check the defaults for connecting to Elasticsearch are:

# Required settings for the URL and basic authentication parameters for your Elasticsearch
# cluster for license verification.
elasticsearch.host: 'http://elasticsearch:9200'
elasticsearch.username: 'ems'
elasticsearch.password: 'changeme'

Thank you very much,
I got this error when running this command:

docker run --rm \
 docker.elastic.co/elastic-maps-service/elastic-maps-server-ubi8:8.8.1 \
 cat /usr/src/app/server/config/elastic-maps-server.yml

I think it's due to the fact that I'm on an offline machine:

Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Trying to pull docker.elastic.co/elastic-maps-service/elastic-maps-server-ubi8:8.8.1...
Error: Error initializing source docker://docker.elastic.co/elastic-maps-service/elastic-maps-server-ubi8:8.8.1: error pinging docker registry docker.elastic.co: Get "[https://docker.elastic.co/v2/":](https://docker.elastic.co/v2/%22:) dial  i/o timeout

If you already have a container running the image, then you can alternatively run docker exec on that container as well.

docker exec [YOUR-CONTAINER] cat /usr/src/app/server/config/elastic-maps-server.yml

Thank you

For updates, it's good. I have my Docker container containing the Docker image. I've created a bind mount, and when I try to run docker-compose up , I encounter this error :

**sudo docker-compose up**
Creating rpm_ElasticMapsServer_1 ... done
Attaching to rpm_ElasticMapsServer_1
ElasticMapsServer_1  | EACCES: permission denied, open '/usr/src/app/server/config/elastic-maps-server.yml'
rpm_ElasticMapsServer_1 exited with code 1

That is more a docker question, check the owner of the configuration file you are binding.

1 Like

It's good, I've resolved the Docker issue.

And I've executed this command, and everything is fine; it doesn't return any errors:

**sudo docker run --rm --init --publish 8080:8080 \5b3b1847374e**
Emulae Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
{"log.level":"info","@timestamp":"2023-11-08T13:09:14.322Z","process":{"pid":8},"host":{"hostname":"b1e90f67b0e4"},"log":{"logger":"Elastic Maps Server"},"created":1699448954274,"started":1699448954314,"host":"b1e90f67b0e4","port":8080,"protocol":"http","id":"b1e90f67b0e4:8:lops11gi","uri":"http://b1e90f67b0e4:8080","address":"10.88.0.20","ecs":{"version":"1.6.0"},"message":"server started"}
{"log.level":"info","@timestamp":"2023-11-08T13:10:56.340Z","process":{"pid":8},"host":{"hostname":"b1e90f67b0e4"},"log":{"logger":"Elastic Maps Server"},"req":{"id":"1699449056319:b1e90f67b0e4:8:lops11gi:10000","method":"get","url":"/","headers":{"host":"10.88.0.20:8080","user-agent":"curl/7.61.1","accept":"*/*"},"remoteAddress":"10.88.0.1","remotePort":58060},"responseTime":21,"ecs":{"version":"1.6.0"},"req":{"id":"1699449056319:b1e90f67b0e4:8:lops11gi:10000","method":"get","url":"/","headers":{"host":"10.88.0.20:8080","user-agent":"curl/7.61.1","accept":"*/*"},"remoteAddress":"10.88.0.1","remotePort":58060},"res":{"statusCode":200,"headers":{"content-length":511,"content-type":"text/html; charset=utf-8","last-modified":"Fri, 02 Jun 2023 09:52:42 GMT","etag":"\"3748990f2f14d021bff2a2794ceca479a5e18b77\"","vary":"origin","access-control-expose-headers":"WWW-Authenticate,Server-Authorization","cache-control":"no-cache","accept-ranges":"bytes"}},"message":"request completed"}

But I'm not sure how to access the map. Is it through the Kibana dashboard interface, or using which address IP?

Thank you

There is a demo interface (same as what you see at https://maps.elastic.co) on the http://{YOUR_EMS_SERVER}/maps route.

Then, to configure Kibana to use that instance, you need to follow the docs:

My map server is well configured now; it manages to connect to Elasticsearch to validate the license.

However, I still cannot visualize the map on the Kibana interface + I have this error: Unable to find the configuration for the EMS tile with the ID: road_map_desaturated. Connection to [http://10.4.1.188:5602](http://10.4.1.188:5602/)."
image

  • i added this line in the Kibana configuration that I am using :
    map.emsUrl: http://10.4.1.188:5602

Check the browser console and especially the network connections for more details.

Is maybe your Kibana instance accessed trough HTTPS? Mind that a webpage served on HTTPS cannot make external requests to an HTTP endpoint for security reasons. This is not specific of Kibana or EMS Server.

1 Like

Thank you so much
It's good, I've set everything up, and I can display the map on Kibana interface.

If I want to show only the cities and streets of a specific country without loading all the data, how can I do that, please?

Sorry, we don't support country downloads :disappointed:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.