I completely agree with this. The default going forward should be to separate the solr config files and the data directory. It's very inconvenient in Kube that we have to go and copy the config files everytime we start a pod. We should be using the default solr.xml by default, and the docker image shouldn't have to prepopulate those files in the /var/solr directory.
I'm not an expert here, so how does the SOLR_DATA_HOME (solr.data.home) variable play into this? On Tue, Aug 10, 2021 at 3:05 PM David Smiley <[email protected]> wrote: > Folks, please let me know what you think of my proposal below. > > PROBLEM: > Today in Docker (and probably the Linux installer), the solr home dir in > /var/solr/... is initialized with solr.xml, zoo.cfg and log4j2.xml [1]. > Consequently, if you deploy new Docker images of Solr with updated built-in > configurations (e.g. with your company/project settings), the old > configuration is *still* used. This is in conflict with the "immutable > infrastructure"[2] principle in which the deployable unit (Docker image) > contains as much configuration as possible (and immutably) to avoid issues > like this and snowflake server configuration. Configuration in a mutable > place like ZooKeeper or the file system is problematic for upgrades, and so > reducing what we put in both is helpful. > > [1]: > https://github.com/apache/solr/blob/main/solr/docker/scripts/init-var-solr > [2]: https://www.bmc.com/blogs/immutable-infrastructure/ > > At work I worked around this by editing my Dockerfile to have > SOLR_HOME=/opt/solr/server/solr and editing my solr.xml coreRootDirectory > to point to /var/solr/data. Since I also use embedded ZK in tests, I > needed to pass -DzkServerDataDir=/var/solr/zoo_data. Overall this was easy > but I'd like to propose Solr running this way auto-magically in Docker and > via the Unix installer script. > > PROPOSAL: > Add an env var SOLR_VAR that both Docker and the Linux installer will set > to /var/solr. When this is set, aspects of SolrXmlConfig, the loader of > solr.xml, will resolve some defaults relative to SOLR_VAR. If the > directory or file is present in SOLR_VAR then it will use that, if it's in > SOLR_HOME, it will use that. Otherwise, try to create it in SOLR_VAR > assuming SOLR_VAR exists. > > Furthermore, the coreRootDirectory shall have a default relative dir of > "data", NOT empty/blank as is now. This will separate cores from other > stuff like configSets, userFiles, fileStore. > > ~ David Smiley > Apache Lucene/Solr Search Developer > http://www.linkedin.com/in/davidwsmiley >
