4
votes

Is it possible to deploy Elasticsearch on App engine flex environment using a docker image.

I have tried the following My files on the local machine

Folder : elasticsearch

app.yaml
Dockerfile
docker-entrypoint.sh
config folder(containing elasticsearch.yml)file

Contents of app.yaml

runtime: custom 
env: flex

Dockerfile and docker-entrypoint.sh copied from https://github.com/GoogleCloudPlatform/elasticsearch-docker/tree/master/5/5.2.0

Modifications to the Dockerfile

replaced EXPOSE 9200 9300 to EXPOSE 8080

Modification to the elasticsearch.yml

cluster.name: "beaconinside-docker-cluster"
path.data: /usr/share/elasticsearch/data
http.host: 0.0.0.0
http.port: 8080
discovery.zen.minimum_master_nodes: 1

I build a container using the docker file on my local machine

docker build -t elasticdemo .

Then, I run the container

docker run -p 8080:8080 elasticdemo

I am able to access elasticsearch on 0.0.0.0:8080

Problem:

I am trying to deploy elasticsearch as an app to Google app engine flex environment

gcloud app deploy app.yaml --version elasticdocker --project myproject

The deployment fails with the following error

Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]

I was expected elasticsearch to deploy as an app and be available on the deployed url. Could you please provide pointers/help/suggestions with this approach?

1

1 Answers

2
votes

While you can deploy ES to App Engine Flexible environment it's not particularly useful. The VMs hosting GAE Flexible containers are restarted regularly as part of maintenance and whatever data is stored on the local disk will be lost on restart. If you want to use local disk for long term storage, I'd suggest to deploy the GCE VM's (or alternatively use a solution from the GCP Marketplace) or deploy to GKE which supports persistent disks

As for the actual question: you probably don't have a health check handler and therefore App Engine Flexible environment doesn't consider your app healthy after deploying it. The error message is useless, I agree.

From the GAE Flexible docs for building custom images:

"A health check is an HTTP request to the URL /_ah/health. A healthy application should respond with status code 200."

Alternatively you can turn off health checks by adding into app.yaml enable_health_check: False