Metadrop / scripthor

Swiss knife of scripts for speed up the development on drupal projects.
1 stars 10 forks source link

Solr container might not have a /tmp/cores directory and solr-sync will fail #32

Open idiazroncero opened 2 years ago

idiazroncero commented 2 years ago

On a clean Solr container install, i've found repeated times this error when executing make solr-sync (or the script solr-sync.sh) for the first time:

./scripts/solr-sync.sh myproject  
+ PROJECT_NAME=myproject
+ SOLR_CONTAINER=' solr'
+ CORES=' default'
+ for core in ${CORES}
++ docker ps --filter 'name=^myproject_solr' --format '{{ .ID }}'
+ docker cp solr/cores/default b9e7179c6e99:/tmp/cores/default
Error: No such container:path: b9e7179c6e99:/tmp/cores
make: *** [Makefile:69: solr-sync] Error 1

The error points that the directory tmp/cores is nonexistent, and it's right: I had to sh into the container and manually create the directory.

This is happening with the Solr tag 8-4.7.5, but in the past i've reproduced it on other wodby-solr container versions.

The solution might be to try to check if the directory exists and proceed to create it if not.

omarlopesino commented 2 years ago

I see that the bash sentences are from previous version of Scripthor, this has been refactored at https://github.com/Metadrop/scripthor/commit/d6cffc23c72f4b766df710d5505d9d0d8eaa5469 , @idiazroncero please try using the latest Scripthor version and check if it fixes the problem for you.

In addition to this, I see that currently the cores folder is created in each iteration: https://github.com/Metadrop/scripthor/blob/2.x/bin/solr-sync.sh#L8 but it can be moved out of the loop. Working on a PR for this.

omarlopesino commented 2 years ago

@idiazroncero may you try to check also this PR and confirm it works to you? https://github.com/Metadrop/scripthor/pull/33 . It is just a minor fix.

omarlopesino commented 2 years ago

@idiazroncero I've tested it by myself and it works fine. Please check the latest Scripthor version whenever you can and confirm everything works okay.

cc @rsanzante the last change done in 2.x (https://github.com/Metadrop/scripthor/pull/33) is ready to do a release.