Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic auth to docker-compose's solr cloud #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
image: solr:8.7.0
container_name: solr1
ports:
- "8981:8983"
- "8981:8983"
environment:
- ZK_HOST=zoo1:2181,zoo2:2181,zoo3:2181
networks:
Expand All @@ -27,7 +27,7 @@ services:
image: solr:8.7.0
container_name: solr2
ports:
- "8982:8983"
- "8982:8983"
environment:
- ZK_HOST=zoo1:2181,zoo2:2181,zoo3:2181
networks:
Expand All @@ -41,7 +41,7 @@ services:
image: solr:8.7.0
container_name: solr3
ports:
- "8983:8983"
- "8983:8983"
environment:
- ZK_HOST=zoo1:2181,zoo2:2181,zoo3:2181
networks:
Expand All @@ -51,6 +51,26 @@ services:
- zoo2
- zoo3

# Add a basic auth to the solr cluster, so that you can upload your own schema config
# default user/password is solr/SolrRocks
# See: https://solr.apache.org/guide/8_7/basic-authentication-plugin.html
solrEnableAuth:
image: solr:8.7.0
container_name: solrEnableAuth
ports:
- "8984:8983"
environment:
- ZK_HOST=zoo1:2181,zoo2:2181,zoo3:2181
networks:
- solr
volumes:
- ./security.json:/opt/solr/server/solr/security.json
command: bash -c "solr zk cp /opt/solr/server/solr/security.json zk:/security.json"
depends_on:
- zoo1
- zoo2
- zoo3

zoo1:
image: zookeeper:3.6.2
container_name: zoo1
Expand Down
23 changes: 23 additions & 0 deletions docker-compose/security.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"authentication": {
"blockUnknown": true,
"class": "solr.BasicAuthPlugin",
"credentials": {
"solr": "IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="
},
"realm": "My Solr users",
"forwardCredentials": false
},
"authorization": {
"class": "solr.RuleBasedAuthorizationPlugin",
"permissions": [
{
"name": "security-edit",
"role": "admin"
}
],
"user-role": {
"solr": "admin"
}
}
}