-
Notifications
You must be signed in to change notification settings - Fork 1
/
app-start
38 lines (27 loc) · 872 Bytes
/
app-start
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
#!/usr/bin/env bash
set -e
role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-production}
until echo 'PING' | nc -w 1 redis 6379 | grep -q PONG
do
echo "Waiting for Redis connection..."
sleep 5
done
php /var/www/html/artisan config:cache
if [ "$role" = "app" ]; then
exec apache2-foreground
elif [ "$role" = "queue" ]; then
chown ${USER_ID}:${GROUP_ID} storage/app/downloads
gosu ${USER_ID}:${GROUP_ID} php /var/www/html/artisan ytdl:update-youtube-dl
gosu ${USER_ID}:${GROUP_ID} nice php /var/www/html/artisan queue:work --timeout=3500
elif [ "$role" = "migrations" ]; then
gosu ${USER_ID}:${GROUP_ID} touch /tmp/sqlite/database.sqlite
gosu ${USER_ID}:${GROUP_ID} php /var/www/html/artisan migrate --force
while [ true ]
do
sleep 86400
done
else
echo "Could not match the container role \"$role\""
exit 1
fi