Skip to content

feat: add SOLR_PASSWORD, generate the security.json hash on start - #81

Merged
stasadev merged 1 commit into
mainfrom
20261028_stasadev_solr_password
Oct 28, 2026
Merged

stasadev merged 1 commit into
mainfrom
20261028_stasadev_solr_password

Conversation

@stasadev

@stasadev stasadev commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Short Summary (TL;DR)

Users can change the Solr admin password with one ddev dotenv set command, instead of editing two files and generating a hash by hand.

The Issue

To change the password, users had to remove #ddev-generated from docker-compose.solr.yaml and security.json, edit the password in two places, and generate the security.json hash with an external tool. After that, the add-on no longer updated those files.

How This PR Solves The Issue

The password is set with ddev dotenv set .ddev/.env.solr --solr-password=... and applied with ddev restart -s solr. It is used by the Solr Admin UI login form, SOLR_AUTHENTICATION_OPTS and security.json, where ${SOLR_PASSWORD_HASH} is replaced on every start. The username stays solr, because the Solr image already defines SOLR_USER.

The README uses ddev utility delete-volume solr for Solr downgrades, so the add-on requires DDEV v1.25.5 for ddev restart -s.

Manual Testing Instructions

https://github.com/ddev/ddev-solr/tree/20261028_stasadev_solr_password#solr-admin-credentials

ddev add-on get ddev/ddev-solr --pr 81
ddev restart
ddev dotenv set .ddev/.env.solr --solr-password=SolrRocksSolrRocks
ddev restart -s solr
ddev exec "curl -sS -u solr:SolrRocksSolrRocks http://solr:8983/solr/admin/info/system"
# Expect JSON with "solr_home"; with solr:SolrRocks expect a 401
ddev describe
# Expect "Pass: SolrRocksSolrRocks" for the solr service

Automated Testing Overview

health_checks now checks authenticated admin access, a 401 without credentials, and the prefilled login form. The new test install from directory with custom password changes the password in a running project and runs health_checks with it.

tests/test.bats sets CI=true, as ddev utility addon-update-checker requires.

Release/Deployment Notes

Projects that removed #ddev-generated to change the password keep their customized files and password. To use SOLR_PASSWORD, delete .ddev/docker-compose.solr.yaml and .ddev/solr/security.json, then run ddev add-on get ddev/ddev-solr.

🤖 Developed with assistance from Claude Code

## Short Summary (TL;DR)

Users can change the Solr admin password with one `ddev dotenv set` command, instead of editing two files and generating a hash by hand.

## The Issue

To change the password, users had to remove `#ddev-generated` from `docker-compose.solr.yaml` and `security.json`, edit the password in two places, and generate the `security.json` hash with an external tool. After that, the add-on no longer updated those files.

## How This PR Solves The Issue

The password is set with `ddev dotenv set .ddev/.env.solr --solr-password=...` and applied with `ddev restart -s solr`. It is used by the Solr Admin UI login form, `SOLR_AUTHENTICATION_OPTS` and `security.json`, where `${SOLR_PASSWORD_HASH}` is replaced on every start. The username stays `solr`, because the Solr image already defines `SOLR_USER`.

The README uses `ddev utility delete-volume solr` for Solr downgrades, so the add-on requires DDEV v1.25.5 for `ddev restart -s`.

## Manual Testing Instructions

```bash
ddev add-on get ddev/ddev-solr --pr 81
ddev restart
ddev dotenv set .ddev/.env.solr --solr-password=SolrRocksSolrRocks
ddev restart -s solr
ddev exec "curl -sS -u solr:SolrRocksSolrRocks http://solr:8983/solr/admin/info/system"
# Expect JSON with "solr_home"; with solr:SolrRocks expect a 401
ddev describe
# Expect "Pass: SolrRocksSolrRocks" for the solr service
```

## Automated Testing Overview

`health_checks` now checks authenticated admin access, a 401 without credentials, and the prefilled login form. The new test `install from directory with custom password` changes the password in a running project and runs `health_checks` with it.

`tests/test.bats` sets `CI=true`, as `ddev utility addon-update-checker` requires.

## Release/Deployment Notes

Projects that removed `#ddev-generated` to change the password keep their customized files and password. To use `SOLR_PASSWORD`, delete `.ddev/docker-compose.solr.yaml` and `.ddev/solr/security.json`, then run `ddev add-on get ddev/ddev-solr`.

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stasadev
stasadev force-pushed the 20261028_stasadev_solr_password branch from 5967abe to 9eef99e Compare October 28, 2026 15:32
@stasadev
stasadev merged commit 8c217c4 into main Oct 28, 2026
4 checks passed
@stasadev
stasadev deleted the 20261028_stasadev_solr_password branch October 28, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant