Skip to content

Commit

Permalink
Create default collection before setting up auth. Closes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
csandanov committed Apr 12, 2023
1 parent 02379f8 commit 6b91795
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bin/init_solr
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ fi
host=$1

if [[ -n "${ZK_HOST}" ]]; then
solr zk cp file:/security.json zk:/security.json
if [[ -n "${SOLR_CLOUD_PASSWORD}" ]]; then
sleep 5
make update-password host="${host}" username=solr password=SolrRocks new_password="${SOLR_CLOUD_PASSWORD}" \
-f /usr/local/bin/actions.mk
fi
# Create default collection if there are no collections.
if curl -s "http://${host}:8983/solr/admin/collections?action=LIST" | grep -q '"collections":\[\]'; then
echo "No collections found, creating a default collection"
IFS=',' read -ra num_shards <<< "$ZK_HOST"
make create-collection collection="default" host="${host}" num_shards="${#num_shards[@]}" config="_default" \
-f /usr/local/bin/actions.mk
fi
solr zk cp file:/security.json zk:/security.json
if [[ -n "${SOLR_CLOUD_PASSWORD}" ]]; then
sleep 5
make update-password host="${host}" username=solr password=SolrRocks new_password="${SOLR_CLOUD_PASSWORD}" \
-f /usr/local/bin/actions.mk
fi
else
# Create default core if there are no cores.
cores=$(curl -s "http://${host}:8983/solr/admin/cores?action=STATUS" | { grep -c "instanceDir" || true; })
Expand Down

0 comments on commit 6b91795

Please sign in to comment.