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

docker-entrypoint.sh needs to be updated to run manage.py reindex --lazy after migrations #947

Closed
kkthxbye-code opened this issue Feb 23, 2023 · 1 comment

Comments

@kkthxbye-code
Copy link

Desired Behavior

manage.py reindex --lazy needs to be executed on startup because of netbox-community/netbox#11787

Contrast to Current Behavior

The search index is not regenerated as it should be.

Required Changes

The following command:

./manage.py reindex --lazy

Should be added somewhere here (after migrations have run):

# Check if update is needed
if ! ./manage.py migrate --check >/dev/null 2>&1; then
echo "⚙️ Applying database migrations"
./manage.py migrate --no-input
echo "⚙️ Running trace_paths"
./manage.py trace_paths --no-input
echo "⚙️ Removing stale content types"
./manage.py remove_stale_contenttypes --no-input
echo "⚙️ Removing expired user sessions"
./manage.py clearsessions
fi

Discussion: Benefits and Drawbacks

Users will be able to search for IPAddresses, Aggregates and Prefixes again.

Any users that have already updated can run the reindex command manually.

tobiasge added a commit to tobiasge/netbox-docker that referenced this issue Feb 23, 2023
This rebuilds the search index when models where updated.
tobiasge added a commit that referenced this issue Mar 14, 2023
Fixes #947: Rebuild search index when needed
@tobiasge
Copy link
Member

Closed with #948

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

No branches or pull requests

2 participants