R
Railway10mo ago
Raigato

Elasticsearch docker image

Did anyone manage to run elasticsearch docker image in Railway? I created a docker image service from elasticsearch:8.12.1 with the following env
ELASTIC_PASSWORD=SUPER_SECRET_PASSWORD
ELASTIC_USERNAME=elastic
discovery.type=single-node
ELASTIC_PASSWORD=SUPER_SECRET_PASSWORD
ELASTIC_USERNAME=elastic
discovery.type=single-node
but it keeps crashing with the following logs
loaded module [runtime-fields-common]

loaded module [x-pack-async]

loaded module [vector-tile]

loaded module [lang-expression]

loaded module [x-pack-eql]

fatal exception while booting Elasticsearch

ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log

ERROR: Elasticsearch exited unexpectedly, with exit code 1
loaded module [runtime-fields-common]

loaded module [x-pack-async]

loaded module [vector-tile]

loaded module [lang-expression]

loaded module [x-pack-eql]

fatal exception while booting Elasticsearch

ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log

ERROR: Elasticsearch exited unexpectedly, with exit code 1
It runs fine locally with railway run docker run elasticsearch:8.12.1 I have no clue how to get said logs as the container dies on exit and I can't mount a volume on another path than /usr/share/elasticsearch/data
Solution:
looks like the image wants a volume mounted at /usr/share/elasticsearch/data instead
Jump to solution
17 Replies
Percy
Percy10mo ago
Project ID: 21336b7e-4344-41de-b812-f1d71747e697
Brody
Brody10mo ago
please send the full dockerfile you are using
Brody
Brody10mo ago
any reason why you are using a dockerfile instead of deploying the image directly? (I have never used elastic search before)
Raigato
RaigatoOP10mo ago
I am using the image directly
No description
Raigato
RaigatoOP10mo ago
I think the solution is this: https://stackoverflow.com/a/53097050/13735374 but I have no idea how to pull this up in Railway
Brody
Brody10mo ago
you can't, is that needed?
Raigato
RaigatoOP10mo ago
I think so but I can't be sure as I can't access the logs when the container crashed after writing in the logs 🥲
Brody
Brody10mo ago
why can't you mount a volume to /usr/share/elasticsearch/logs?
Raigato
RaigatoOP10mo ago
When I do, I get this:
Raigato
RaigatoOP10mo ago
It somehow need a volume on /usr/share/elasticsearch/data to run
Brody
Brody10mo ago
set a service variable RAILWAY_RUN_UID to 0
Raigato
RaigatoOP10mo ago
Ok, it still doesn't work but I can move logs to the volume, I can investigate now 🙏
Brody
Brody10mo ago
progress!
Raigato
RaigatoOP10mo ago
Ok made some progress, it seems to be somehow related to volumes. With no volume attached, it works fine. When I mount a volume on /usr/share/elasticsearch, I get /usr/local/bin/docker-entrypoint.sh: line 49: /usr/share/elasticsearch/bin/elasticsearch-env-from-file: No such file or directory Also, I still have the vm.max_map_count=262144 thing (https://discord.com/channels/713503345364697088/1206911735399849984/1207002891022372967) but as I understand from your previous answer, I cannot change it, right ? Any solution ?
Brody
Brody10mo ago
that's something railway would need to change on the host machine, realistically that's not going to happen but yes you are mounting an empty volume to a path that contains files, thus the path now contains what's on the volume, aka nothing, so getting that no such file or directory makes sense
Solution
Brody
Brody10mo ago
looks like the image wants a volume mounted at /usr/share/elasticsearch/data instead
Want results from more Discord servers?
Add your server