Solr Server Crashing
pa1245
FREEOP

2 months 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'

$10 Bounty

14 Replies

Railway
BOT

2 months 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!


Edit: Sorry, misread. Can't delete my comment.


samgordon

Edit: Sorry, misread. Can't delete my comment.

pa1245
FREEOP

2 months ago

No worries. Thanks for checking.


version3034
HOBBY

2 months 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:

version3034
HOBBY

2 months 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


pa1245
FREEOP

2 months 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

pa1245
FREEOP

2 months 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"


version3034
HOBBY

2 months 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

pa1245
FREEOP

2 months ago

I am not aware how to run it as a non root user. Could you please suggest how to do it?


pa1245
FREEOP

2 months ago

I used an agent to create Dockerfile and solr-entrypoint.sh to fix the issue.


version3034
HOBBY

2 months 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.


version3034
HOBBY

2 months 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.


pa1245
FREEOP

2 months ago

Got it. I will try it out. Thanks a bunch!!


version3034
HOBBY

2 months 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 about 2 months ago


Status changed to Solved brody about 2 months ago


Status changed to Solved pa1245 about 2 months ago


Loading...