2021-03-27 04:51:45 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-03-31 02:04:17 +02:00
|
|
|
# If we have an .env file then we're likely running on a dev machine
|
|
|
|
# in which case auto optimization on start up is not necessary.
|
|
|
|
if [ ! -f .env ]; then
|
|
|
|
sudo -Esu www-data php artisan optimize
|
|
|
|
fi
|
2021-03-29 01:51:06 +02:00
|
|
|
|
2021-03-27 04:51:45 +01:00
|
|
|
MODE=$1
|
|
|
|
|
|
|
|
case $MODE in
|
|
|
|
web)
|
|
|
|
php-fpm -D
|
|
|
|
nginx -g 'pid /tmp/nginx.pid; daemon off;'
|
|
|
|
;;
|
|
|
|
|
|
|
|
worker)
|
|
|
|
sudo -Esu www-data php artisan queue:listen --queue=default,notifications,indexing --sleep=5 --tries=3
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Unknown mode given"
|
|
|
|
;;
|
|
|
|
esac
|