-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a02142
commit a44f46b
Showing
7 changed files
with
64 additions
and
67 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Set default values if not provided | ||
: ${CONTAINER_MODE:='manual'} | ||
: ${CONTAINER_ROLE:='app'} | ||
: ${APP_ENV:='production'} | ||
ARTISAN="php -d variables_order=EGPCS /var/www/html/artisan" | ||
|
||
# Function to run setup tasks | ||
run_setup_tasks() { | ||
echo "Preparing application..." | ||
chown -R nobody:nobody /var/www/html/storage | ||
php artisan storage:link || true | ||
php artisan config:cache || true | ||
php artisan migrate --force || true | ||
} | ||
|
||
if [ -d "/var/www/html/vendor" ] ; then | ||
# Run setup tasks if in automatic mode | ||
if [ "$CONTAINER_MODE" = "automatic" ]; then | ||
run_setup_tasks | ||
fi | ||
|
||
# Execute role-specific commands | ||
case "$CONTAINER_ROLE" in | ||
app) | ||
echo "INFO: Running octane..." | ||
exec $ARTISAN octane:start --server=frankenphp --host=0.0.0.0 --port=8000 | ||
;; | ||
worker) | ||
echo "INFO: Running the queue..." | ||
exec $ARTISAN queue:work -vv --no-interaction --tries=3 --sleep=5 --timeout=300 --delay=10 | ||
;; | ||
horizon) | ||
echo "INFO: Running the horizon..." | ||
exec $ARTISAN horizon | ||
;; | ||
scheduler) | ||
while true; do | ||
echo "INFO: Running scheduled tasks." && exec $ARTISAN schedule:run --verbose --no-interaction & | ||
sleep 60s | ||
done | ||
;; | ||
*) | ||
echo "Could not match the container role \"$CONTAINER_ROLE\"" | ||
exit 1 | ||
;; | ||
esac | ||
else | ||
echo "WARNING: The directory /var/www/html/vendor does not exist yet. Please run the composer install command to ensure that all necessary dependencies are properly installed." | ||
fi |