-
Notifications
You must be signed in to change notification settings - Fork 3
/
startup.prod.sh
49 lines (40 loc) · 1.2 KB
/
startup.prod.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
#!/bin/bash
echo $0
echo "Copy all files in /lticonfig to correct path"
echo "==============="
cp -a /lticonfig/. /var/www/html/database
echo $0
echo "Copy all files in /ltijwt to correct path"
echo "==============="
cp -a /ltijwt/. /var/www/html/app/Ltiv3/jwt_key_kpas
echo $0
echo "Inject canvas url from ENV Variable to nginx-config"
echo "==============="
sed 's@startup_prod:INJECT_CANVAS_HOST@'"$CANVAS_HOST"'@' /etc/nginx/nginx.conf >/etc/nginx/nginx.conf.temp
cp /etc/nginx/nginx.conf.temp /etc/nginx/nginx.conf
echo $0
echo "Make sure storage folder is writable"
echo "==============="
storageDir="/var/www/html/storage"
chown -R www-data:www-data $storageDir
chmod -R u+rw,g+rw $storageDir
echo $0
echo "Run PHP artisan commands"
echo "==============="
su -s /bin/bash -c "
php artisan cache:clear &&
php artisan route:clear &&
php artisan view:clear &&
php artisan config:cache &&
php artisan route:cache &&
php artisan view:cache &&
php artisan migrate --force
" www-data
echo $0
echo "Start sshd"
echo "==============="
/usr/sbin/sshd
echo $0
echo "Start Supervisor with Nginx and PHP-FPM"
echo "==============="
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf