a month ago
I am deploying Solr server using the below docker-compose.yaml. However, the server crashes as it tries to mount the volume. How should I fix it? What am I missing? Where should I add the --force argument that is suggested in the error message?
services:
solr:
image: solr:9.9.0
ports:
- "8983:8983"
volumes:
- solr_data:/var/solr
command:
- solr-precreate
- helloworld
volumes:
solr_data:
Other configuration -
1. RAILWAY_RUN_UID=0 for root user permission - according to https://docs.railway.com/guides/volumes#permissions
2. Deploy start command - solr-precreate helloworld
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/xyz/vol_xyz
Executing /opt/solr/docker/scripts/solr-precreate helloworld
Executing /opt/solr/docker/scripts/precreate-core helloworld
Core helloworld already exists
Starting Solr
WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting.
Please consult the Reference Guide. To override this check, start with argument '--force'
14 Replies
a month ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
samgordon
Edit: Sorry, misread. Can't delete my comment.
a month ago
No worries. Thanks for checking.
a month ago
services:
solr:
image: solr:9.9.0
ports:
- "8983:8983"
volumes:
- solr_data:/var/solr
command: >
/bin/bash -c "
solr-precreate helloworld;
exec solr -f --force
"
volumes:
solr_data:
a month ago
It’s crashing because you are running it as a root user, hence why you need the
— force command. It is overriding that security check and allowing the build to formalize
a month ago
ohh okay. I imported the docker-compose.yaml directly into railway. Is there a way to update this in railway? Or do I need to delete the service and add a new one by importing the file again?
version3034
It’s crashing because you are running it as a root user, hence why you need the— force command. It is overriding that security check and allowing the build to formalize
a month ago
I still get the below error.
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/5689ac89-c420-44b4-94ab-75f1ed64b3b2/vol_vsd2baliyp5gvns2
Executing /opt/solr/docker/scripts/solr-precreate helloworld
Executing /opt/solr/docker/scripts/precreate-core helloworld
Core helloworld already exists
Starting Solr
WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting.
Please consult the Reference Guide. To override this check, start with argument '--force'
NOTE- I updated the deploy command to /bin/bash -c "solr-precreate products && exec solr -f --force"
a month ago
Is there a reason your trying to run it as root in the first place ?
While it should have worked, and there are workarounds… For many reasons you shouldn’t be running as a root user, hence why they have the safety checks .
Ideally you should be running it as a non root user
version3034
Is there a reason your trying to run it as root in the first place ?While it should have worked, and there are workarounds… For many reasons you shouldn’t be running as a root user, hence why they have the safety checks .Ideally you should be running it as a non root user
a month ago
I am not aware how to run it as a non root user. Could you please suggest how to do it?
a month ago
I used an agent to create Dockerfile and solr-entrypoint.sh to fix the issue.
a month ago
Yeah docker compose , also provides another way to do it as well.
https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html
Main thing you really want to make sure is your not running it as root. That’s a big no no for public facing servers or apps.
a month ago
Once you do spin up a sever, there is also SSH access via the railway CLI you can use as well.
https://docs.railway.com/guides/cli
Can be pretty helpful for troubleshooting.
a month ago
Got it. I will try it out. Thanks a bunch!!
a month ago
Sure thing, glad you got it figured out. Working in a containerized environment has many advantages….
But there are also some drawbacks, and instances where having SSH and a command line is certainly helpful.
Status changed to Open brody • 29 days ago
Status changed to Solved brody • 29 days ago
Status changed to Solved pa1245 • 27 days ago