33
44cd /app
55
6+ mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \
7+ && rmdir /app/storage/logs/ \
8+ && chmod 777 /var/log/panel/logs/ \
9+ && ln -s /var/log/panel/logs/ /app/storage/
10+
611# # check for .env file and generate app keys if missing
712if [ -f /app/var/.env ]; then
8- echo " external vars exist"
13+ echo " external vars exist. "
914 rm /app/.env
1015
1116 ln -s /app/var/.env /app/
1217else
13- echo " external vars don't exist"
18+ echo " external vars don't exist. "
1419 rm /app/.env
1520 touch /app/var/.env
1621
1722 # # manually generate a key because key generate --force fails
18- echo -e " Generating key"
23+ echo -e " Generating key. "
1924 APP_KEY=$( cat /dev/urandom | tr -dc ' a-zA-Z0-9' | fold -w 32 | head -n 1)
2025 echo -e " Generated app key: $APP_KEY "
2126 echo -e " APP_KEY=$APP_KEY " > /app/var/.env
2227
2328 ln -s /app/var/.env /app/
2429fi
2530
31+ echo " Checking if https is required."
32+ if [ -f /etc/nginx/conf.d/default.conf ]; then
33+ echo " Using nginx config already in place."
34+ else
35+ echo " Checking if letsencrypt email is set."
36+ if [ -z $LE_EMAIL ]; then
37+ echo " No letsencrypt email is set Failing to http."
38+ cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf
39+
40+ else
41+ echo " writing ssl config"
42+ cp .dev/docker/default_ssl.conf /etc/nginx/conf.d/default.conf
43+ echo " updating ssl config for domain"
44+ sed -i " s|<domain>|$( echo $APP_URL | sed ' s~http[s]*://~~g' ) |g" /etc/nginx/conf.d/default.conf
45+ echo " generating certs"
46+ certbot certonly -d $( echo $APP_URL | sed ' s~http[s]*://~~g' ) --standalone -m $LE_EMAIL --agree-tos -n
47+ fi
48+ fi
49+
2650# # check for DB up before starting the panel
2751echo " Checking database status."
2852until nc -z -v -w30 $DB_HOST 3306
3458done
3559
3660# # make sure the db is set up
37- echo -e " Migrating and Seeding DB "
61+ echo -e " Migrating and Seeding D.B "
3862php artisan migrate --force
3963php artisan db:seed --force
4064
4165# # start cronjobs for the queue
42- echo -e " Starting cron jobs"
43- crond
66+ echo -e " Starting cron jobs. "
67+ crond -L /var/log/crond -l 5
4468
45- echo -e " Starting supervisord"
69+ echo -e " Starting supervisord. "
4670exec " $@ "
0 commit comments