ibraheemalayan commented on issue #513:
URL: https://github.com/apache/solr-operator/issues/513#issuecomment-2676883924

   For anyone interested in a guide.
   
   1. Create a custom `web.xml`
   
       - Get the default web.xml from solr's repository or from your container 
at `/opt/solr-9.7.0/server/solr-webapp/webapp/WEB-INF/web.xml` ( make sure to 
put the correct version )
       - follow https://laurenthinoul.com/how-to-enable-cors-in-solr/ to do the 
required changes
    
   2. Create a ConfigMap that contains the new web.xml file. You can do this by 
running the following command:
   
   ```bash
   kubectl create configmap custom-web-xml 
--from-file=web.xml={{path/to/your/web.xml on machine running kubectl}}
   ```
   
   3. Attach a volume to solr containers
   
   In SolrCloud resource file, create a new volume under 
`SolrCloud.spec.customSolrKubeOptions.podOptions.volumes` as follows:
   
   ```yaml
   # specs: 
https://apache.github.io/solr-operator/docs/solr-cloud/solr-cloud-crd.html
   apiVersion: solr.apache.org/v1beta1
   kind: SolrCloud
   metadata:
     name: search-cluster
   spec:
     # <new config>
     customSolrKubeOptions:
       podOptions:
         # override /opt/solr-9.7.0/server/solr-webapp/webapp/WEB-INF/web.xml 
with custom web.xml to enable CORS
         volumes:
           - name: custom-web-xml-volume
             source:
               configMap:
                 name: custom-web-xml
                 items:
                   - key: web.xml
                     path: web.xml
             defaultContainerMount:
               name: custom-web-xml-volume
               mountPath: 
/opt/solr-9.7.0/server/solr-webapp/webapp/WEB-INF/web.xml # ! match solr version
               subPath: web.xml
               readOnly: true
     # </new config>
     # rest of the file ....
     replicas: 2
     solrJavaMem: -Xms512M -Xmx1G
     solrImage:
       tag: 9.7.0
   ```
   
   4. Apply changes
   5. Verify
   
   get one of your pods' names, and verify that it has the new xml file:
   ```bash
   kubectl exec -it <solr-pod-name> -- cat 
/opt/solr-9.7.0/server/solr-webapp/webapp/WEB-INF/web.xml
   ```
   
   


-- 
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-unsubscr...@solr.apache.org

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


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

Reply via email to