-
Notifications
You must be signed in to change notification settings - Fork 245
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: Reload support for backend, changes to entrypoint script #1100
Open
chandrasekharan-zipstack
wants to merge
10
commits into
main
Choose a base branch
from
feat/reload-support-for-backend
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+185
−77
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
79b39d6
Reload support for backend, changes to entrypoint script
chandrasekharan-zipstack d45c715
Changes to support new migrate option in entrypoint.sh script
chandrasekharan-zipstack 75c9f57
Minor doc changes
chandrasekharan-zipstack 71c6a06
Added logger to specify startup time
chandrasekharan-zipstack fb80454
Commit pdm.lock changes
chandrasekharan-zipstack a7a56fa
feat: Added compose override support and docs to use it
chandrasekharan-zipstack 900ee19
Commit pdm.lock changes
chandrasekharan-zipstack 1b0ff65
Update backend/backend/wsgi.py
chandrasekharan-zipstack dbf7ea0
Commit pdm.lock changes
chandrasekharan-zipstack 02fdfbb
Merge branch 'main' into feat/reload-support-for-backend
hari-kuriakose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
cmd=$1 | ||
if [ "$cmd" = "migrate" ]; then | ||
show_help() { | ||
echo "Usage: ./entrypoint.sh [OPTIONS]" | ||
echo "" | ||
echo "Options:" | ||
echo " --migrate Perform database migrations before starting the server." | ||
echo " --dev Run Gunicorn in development mode with --reload and reduced graceful timeout (5s)." | ||
echo " --help, -h Show this help message and exit." | ||
} | ||
|
||
# Parse arguments | ||
migrate=false | ||
dev=false | ||
|
||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--migrate) migrate=true ;; | ||
--dev) dev=true ;; | ||
--help|-h) show_help; exit 0 ;; | ||
*) echo "Unknown argument: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
# Perform database migration if --migrate is provided | ||
if [ "$migrate" = true ]; then | ||
echo "Migration initiated" | ||
.venv/bin/python manage.py migrate | ||
fi | ||
|
||
# NOTE: Leaving below for reference incase required in the future | ||
# python manage.py runserver 0.0.0.0:8000 --insecure | ||
# NOTE updated socket threads | ||
.venv/bin/gunicorn \ | ||
--bind 0.0.0.0:8000 \ | ||
--workers 2 \ | ||
--threads 2 \ | ||
--log-level debug \ | ||
--timeout 600 \ | ||
--access-logfile - \ | ||
backend.wsgi:application | ||
# Configure Gunicorn based on --dev flag | ||
gunicorn_args=( | ||
--bind 0.0.0.0:8000 | ||
--workers 2 | ||
--threads 2 | ||
--log-level debug | ||
--timeout 600 | ||
--access-logfile - | ||
) | ||
|
||
if [ "$dev" = true ]; then | ||
echo "Running in development mode" | ||
gunicorn_args+=(--reload --graceful-timeout 5) | ||
else | ||
echo "Running in production mode" | ||
fi | ||
|
||
# Start Gunicorn | ||
.venv/bin/gunicorn "${gunicorn_args[@]}" backend.wsgi:application |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@chandrasekharan-zipstack This might not be needed.
We can check in the actual overrides yaml themselves. It will be activated only when you pass them via the
-f
flag, hence mentioned.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.
@hari-kuriakose I considered adding this here since each user might be motivated to run as per their own configuration which might not apply to all. For example, I might wish to mount the workflow dir from a different path in my machine / use different ports. I'm treating this similar to
proxy_overrides
we do withtraefik
. Let me know what you thinkI was also hoping to populate the sample file with different examples that people can simply uncomment and use as per their need