Repository navigation
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·45 lines (33 loc) · 1.46 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·45 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -e
role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-production}
# if [ "$env" != "local" ]; then
# echo "Caching configuration..."
# (cd /var/www/html && php artisan config:cache && php artisan route:cache && php artisan view:cache)
# fi
if [ "$role" = "app" ]; then
exec apache2-foreground
elif [ "$role" = "queue" ] && [ "$HORIZON_ENABLED" = "1" ]; then
php /var/www/html/artisan horizon
elif [ "$role" = "queue" ]; then
echo "Running the $queue_name queue..."
# The `--timeout` and `--tries` options are queue worker defaults.
# A job's `$tries` property or `tries()` method takes precedence over this `--tries` option.
# https://laravel.com/framework/docs/11.x/queues#max-attempts
# A job's `$timeout` property takes precedence over this `--timeout` option.
# https://laravel.com/framework/docs/11.x/queues#timeout
# A job's "timeout" value should always be less than the queue's `retry_after` value.
# Otherwise, the job may be re-attempted before it has actually finished executing or timed out.
# https://laravel.com/framework/docs/11.x/queues#job-expirations-and-timeouts
php /var/www/html/artisan queue:work --verbose --tries=5 --timeout=90 --queue="$queue_name"
elif [ "$role" = "scheduler" ]; then
while [ true ]
do
php /var/www/html/artisan schedule:run --verbose --no-interaction &
sleep 60
done
else
echo "Could not match the container role \"$role\""
exit 1
fi