-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add entrypoint script #40
Conversation
docker-compose.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the right place to store Django superuser credentials? A separate env file?
entrypoint.sh
Outdated
@@ -0,0 +1,5 @@ | |||
#!/bin/sh | |||
python manage.py migrate | |||
python manage.py createsuperuser --noinput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually superusers are created to the database, and not in docker start. Also, it's one time thing, and something that happens differently depending on database purpose and location (local, test, prod).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it might be nice to be able to automatically create an initial superuser from environment variables that are set in secrets, during development. If it seems like an unnecessary feature or a risk, I don't mind if it's removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the user creds go into database that needs to be handled persistently, I think its place is not in container
usually automated local dev superuser creation would be set when adding fixtures/test data to the db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, manually creating manage.py createsuperuser
or loading it from a fixture is a better idea in many/all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed superuser creation and rebased the branch.
The entrypoint script runs migrations
15ab8d4
to
0dbefa7
Compare
The entrypoint script runs migrations and creates a superuser based on environment variables.