-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/page-break-on-promptstudio
- Loading branch information
Showing
53 changed files
with
1,075 additions
and
406 deletions.
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
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
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 |
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
Oops, something went wrong.