-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
56 lines (49 loc) · 1.52 KB
/
start.sh
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
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
# Use the `ENTRYPOINT` DeploymentConfig environment variable to specify
# which command to run. This enables the same Dockerfile to be used for
# web and worker processes. This script contains the basics for a standard
# Laravel app but it can be customized to add other entrypoints.
#
sed -i "/server_name YOUR_DOMAIN/c server_name ${SERVER_DOMAIN}}" \
/etc/nginx/conf.d/default.conf
#
if [ "$ENTRYPOINT" = "complete" ]; then
echo Starting workers
php artisan queue:work --tries=1 &
echo Starting web
/usr/bin/supervisord -c /supervisord.conf &
rm -rf storage/tnt
php artisan index:posts
php artisan index:tags
php artisan index:places
php artisan index:events
php artisan searchable:all
php artisan categories:refresh
php artisan reverse:locations
php artisan geo:places
echo Starting schedule_run
while [ 1 ]
do
php artisan schedule:run
sleep 60
done
# If the entrypoint is `workers`, run the Laravel worker.
elif [ "$ENTRYPOINT" = "workers" ]; then
echo Starting workers
php artisan queue:work --tries=3
# If the entrypoint is `schedule_run`, run the Laravel scheduler.
elif [ "$ENTRYPOINT" = "schedule_run" ]; then
echo Starting schedule_run
while [ 1 ]
do
php artisan schedule:run
sleep 60
done
# If the entrypoint is blank or `web`, run the web supervisord process.
elif [ -z "$ENTRYPOINT" ] || "$ENTRYPOINT" = "web" ]
then
echo Starting web
/usr/bin/supervisord -c /supervisord.conf
else
echo Error, cannot find entrypoint $ENTRYPOINT to start
fi