This commit is contained in:
Stefan Hardegger
2026-07-20 12:08:57 +02:00
parent e999fd609c
commit dca6ddadd5

View File

@@ -13,19 +13,26 @@ COPY <<EOF /docker-entrypoint-initdb.d/init-cores.sh
#!/bin/bash #!/bin/bash
echo "StoryCove: Initializing cores..." echo "StoryCove: Initializing cores..."
# Always sync configsets to the persistent volume so CoreAdmin CREATE works at runtime
# (needed after unloadCore + recreate without restarting the container)
mkdir -p /var/solr/data/configsets
for core in storycove_stories storycove_authors storycove_collections; do
cp -rf /opt/solr-9.9.0/server/solr/configsets/\$core /var/solr/data/configsets/
done
# Create cores on first startup (no-op if they already exist) # Create cores on first startup (no-op if they already exist)
precreate-core storycove_stories /opt/solr-9.9.0/server/solr/configsets/storycove_stories precreate-core storycove_stories /opt/solr-9.9.0/server/solr/configsets/storycove_stories
precreate-core storycove_authors /opt/solr-9.9.0/server/solr/configsets/storycove_authors precreate-core storycove_authors /opt/solr-9.9.0/server/solr/configsets/storycove_authors
precreate-core storycove_collections /opt/solr-9.9.0/server/solr/configsets/storycove_collections precreate-core storycove_collections /opt/solr-9.9.0/server/solr/configsets/storycove_collections
# Always sync schema files from the image so deployments pick up schema changes # Always sync schema files from the image so deployments pick up schema changes
cp -f /opt/solr-9.9.0/server/solr/configsets/storycove_stories/conf/managed-schema /var/solr/data/storycove_stories/conf/managed-schema for core in storycove_stories storycove_authors storycove_collections; do
if [ -f /opt/solr-9.9.0/server/solr/configsets/storycove_authors/conf/managed-schema ]; then src=/opt/solr-9.9.0/server/solr/configsets/\$core/conf/managed-schema
cp -f /opt/solr-9.9.0/server/solr/configsets/storycove_authors/conf/managed-schema /var/solr/data/storycove_authors/conf/managed-schema dst=/var/solr/data/\$core/conf/managed-schema
fi if [ -f "\$src" ] && [ -d "/var/solr/data/\$core/conf" ]; then
if [ -f /opt/solr-9.9.0/server/solr/configsets/storycove_collections/conf/managed-schema ]; then cp -f "\$src" "\$dst"
cp -f /opt/solr-9.9.0/server/solr/configsets/storycove_collections/conf/managed-schema /var/solr/data/storycove_collections/conf/managed-schema fi
fi done
echo "StoryCove: Core initialization complete!" echo "StoryCove: Core initialization complete!"
EOF EOF
@@ -39,4 +46,4 @@ RUN chown -R solr:solr /opt/solr-9.9.0/server/solr/configsets/ && \
USER solr USER solr
# Use the default Solr entrypoint # Use the default Solr entrypoint
CMD ["solr-foreground"] CMD ["solr-foreground"]