You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/11/03 09:16:28 UTC

[GitHub] [solr-operator] fernaspiazu opened a new issue #364: JTS and Polygons jar file

fernaspiazu opened a new issue #364:
URL: https://github.com/apache/solr-operator/issues/364


   Hi,
   Is there a way to install/download the library `jts-core` in the folder `SOLR_INSTALL/server/solr-webapp/webapp/WEB-INF/lib/`? As specified in the official guide: https://solr.apache.org/guide/8_10/spatial-search.html#jts-and-polygons-flat
   
   Actually, I tried to put in the middle an `initContainer` that downloads such jar, but I get obviously a `Permission denied` from the Solr container since only root can write on the final solr container.
   
   I tried also to set a `securityContext` only for my `initContainer`, in order to run as root, but that configuration has no effect in the `initContainer`, I think it is not seen by the Solr CRD.
   
   ```
   podOptions:
     initContainers:
     - name: "install-jts-core"
       image: solr:8.9.0
       command: ['sh', '-c', 'wget -O /opt/solr-8.9.0/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.15.1.jar https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar']
       securityContext:   <--- this has no effect on SolrCloud CRD
         runAsUser: 0
   ```
   
   Another disperate attempt was to set a `podSecurityContext.runAsUser: 0`, so for all containers in the pod, but Solr does not run as `root`, I discarded that option by the way.
   
   Any hint/idea/solution please?
   
   Thank you very much in advance.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] dsmiley commented on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
dsmiley commented on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-972535665


   Seeing two people independently try to do this (and its awkward) makes me wonder if Solr should finally ship with JTS.  There used to be a license issue many years ago but no longer an issue.  https://issues.apache.org/jira/browse/SOLR-11953
   Annoyingly, due to the way JTS is referenced via Spatial4j via Lucene, it has to go in WEB-INF/lib, not in a solr/lib


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] fernaspiazu commented on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
fernaspiazu commented on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-964156262


   Hi @HoustonPutman,
   
   Thank you very much for your answer.
   
   I have recently found a solution that may not be elegant, but works well in any version of Solr image, below a configuration example:
   
   ```yaml
   podOptions:
     initContainers:
     - name: "install-jts-lib"
       image: solr:8.9.0
       command:
       - 'sh'
       - '-c'
       - |
         wget -O /tmp-webinf-lib/jts-core-1.15.1.jar https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar
         cp -R /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/* /tmp-webinf-lib
       volumeMounts:
       - mountPath: /tmp-webinf-lib
         name: web-inf-lib
     volumes:
     - name: web-inf-lib
       source:
         emptyDir: {}
       defaultContainerMount:
         name: web-inf-lib
         mountPath: /opt/solr/server/solr-webapp/webapp/WEB-INF/lib
   ```
   
   In this example, I create an `emptyDir` volume, attach it in any directory of the `initContainer`, but in the `target directory` of the final Solr image, this will empty the `WEB-INF/lib` directory, but since I'm using the same Solr image, I can copy the content of `WEB-INF/lib` (jars and folders) at the end.
   
   The effect is that the final container will have all the content it should have had plus the `jts-core-1.15.1.jar` jar.
   
   This works also with other files or libraries you want to bring in the Solr container.
   
   Let me know what do you thing of this workaround 👍
   
   Thank you again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] fernaspiazu closed issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
fernaspiazu closed issue #364:
URL: https://github.com/apache/solr-operator/issues/364


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] dalbani commented on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
dalbani commented on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-969062840


   For those who might be interested in an alternative to @fernaspiazu's trick, here's how I did it:
   ```
   lifecycleHooks:
     postStart:
       exec:
         command:
           - /bin/sh
           - -ceux
           - >
             jts_version=1.18.2 &&
             dir=/opt/bitnami/solr/server/solr-webapp/webapp/WEB-INF/lib &&
             test -f ${dir}/jts-core-${jts_version}.jar ||
             curl -o ${dir}/jts-core-${jts_version}.jar https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/${jts_version}/jts-core-${jts_version}.jar
   ```
   
   Although it works fine for me in practice, this solution probably relies on the `postStart` being called _before_ the app starts up.
   And no such guarantee in terms of timing exists as far as I can read on <https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/>.
   > This hook is executed immediately after a container is created. However, there is no guarantee that the hook will execute before the container ENTRYPOINT.
   
   So your mileage may vary.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] fernaspiazu edited a comment on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
fernaspiazu edited a comment on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-964156262


   Hi @HoustonPutman,
   
   Thank you very much for your answer.
   
   I have recently found a solution that may not be elegant, but works well in any version of Solr image, below a configuration example:
   
   ```yaml
   podOptions:
     initContainers:
     - name: "install-jts-lib"
       image: solr:8.9.0
       command:
       - 'sh'
       - '-c'
       - |
         wget -O /tmp-webinf-lib/jts-core-1.15.1.jar https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar
         cp -R /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/* /tmp-webinf-lib
       volumeMounts:
       - mountPath: /tmp-webinf-lib
         name: web-inf-lib
     volumes:
     - name: web-inf-lib
       source:
         emptyDir: {}
       defaultContainerMount:
         name: web-inf-lib
         mountPath: /opt/solr/server/solr-webapp/webapp/WEB-INF/lib
   ```
   
   In this example, I create an `emptyDir` volume, attach it in any directory of the `initContainer`, but in the `target directory` of the final Solr image, this will empty the `WEB-INF/lib` directory, but since I'm using the same Solr image, I can copy the content of `WEB-INF/lib` (jars and folders) at the end.
   
   The effect is that the final container will have all the content it should have had plus the `jts-core-1.15.1.jar` jar.
   
   This works also with other files or libraries you want to bring in the Solr container.
   
   Let me know what do you think of this workaround 👍
   
   Thank you again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] HoustonPutman commented on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-963323967


   Hello @fernaspiazu, this is a good question.
   
   Starting with Solr Operator `v0.5.0`, you should be able to do the following:
   
   1. Use the init container, and save it in an empty-dir volume. Mount this volume into your init-container at any location. 2. Mount this emtpy-dir jar volume in your Solr container, somewhere under the data path (`/var/solr/data/libs`).
   3. Then use `SolrCloud.spec.additionalLibs=['/var/solr/data/libs']`. (Note this will only work for more recent solr versions, but that is fine since you are running `8.9.0`.
   
   I recognize that the Solr documentation says the Jar has to be placed in WEB_INF/lib, but I really don't think that's possible given the Solr docker image.
   
   Give this a try and let me know if it works.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] HoustonPutman commented on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-965535798


   That's really clever!
   
   Glad it's working for you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr-operator] fernaspiazu commented on issue #364: JTS and Polygons jar file

Posted by GitBox <gi...@apache.org>.
fernaspiazu commented on issue #364:
URL: https://github.com/apache/solr-operator/issues/364#issuecomment-966115739


   I close this issue, till another similar use case appears.
   
   Thanks again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org