Skip to content

Commit

Permalink
Introduce Horizon Worker for task scheduling and modify the Docker en…
Browse files Browse the repository at this point in the history
…trypoint script to execute queue size check as the Octane user.
  • Loading branch information
nsouto committed Dec 12, 2023
1 parent d5fc64e commit 92ffbac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions octane/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ services:
- APP_ENV=develop
environment:
- APP_ENV=develop
- ENABLE_HORIZON=true
- ENABLE_SCHEDULER=true
ports:
- "${FORWARD_APP_PORT:-9000}:${OCTANE_APP_PORT-9000}"
volumes:
- /etc/localtime:/etc/localtime:ro

horizon-worker:
build:
context: .
args:
- PACKAGIST_TOKEN=${PACKAGIST_TOKEN}
- DOTENV_TOKEN=${DOTENV_TOKEN}
- APP_ENV=develop
environment:
- APP_ENV=develop
- HORIZON_WORKER=true
ports:
- "${FORWARD_APP_PORT:-9000}:${OCTANE_APP_PORT-9000}"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion octane/usr/local/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ startSupervisord &
if [ "${HORIZON_WORKER}" == "true" ]; then
# Start the loop to monitor the PHP command
while true; do
result=$(php artisan tinker --execute="\Illuminate\Support\Facades\Queue::size('default');")
result=$(su octane -c "php artisan tinker --execute=\"echo \Illuminate\Support\Facades\Queue::size('default');\"")
if [ "$result" -eq 0 ]; then
echo "Queue size is 0. Stopping Supervisord programs."
supervisorctl stop all
Expand Down

0 comments on commit 92ffbac

Please sign in to comment.