R
Railwayβ€’9mo 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
Percyβ€’9mo ago
Project ID: 21336b7e-4344-41de-b812-f1d71747e697
Brody
Brodyβ€’9mo ago
please send the full dockerfile you are using
Brody
Brodyβ€’9mo ago
any reason why you are using a dockerfile instead of deploying the image directly? (I have never used elastic search before)
Raigato
Raigatoβ€’9mo ago
I am using the image directly
No description
Raigato
Raigatoβ€’9mo 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
Brodyβ€’9mo ago
you can't, is that needed?
Raigato
Raigatoβ€’9mo 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
Brodyβ€’9mo ago
why can't you mount a volume to /usr/share/elasticsearch/logs?
Raigato
Raigatoβ€’9mo ago
When I do, I get this:
Raigato
Raigatoβ€’9mo ago
It somehow need a volume on /usr/share/elasticsearch/data to run
Brody
Brodyβ€’9mo ago
set a service variable RAILWAY_RUN_UID to 0
Raigato
Raigatoβ€’9mo ago
Ok, it still doesn't work but I can move logs to the volume, I can investigate now πŸ™
Brody
Brodyβ€’9mo ago
progress!
Raigato
Raigatoβ€’9mo 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
Brodyβ€’9mo 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
Brodyβ€’9mo ago
looks like the image wants a volume mounted at /usr/share/elasticsearch/data instead
Want results from more Discord servers?
Add your server