Changeset View
Changeset View
Standalone View
Standalone View
src/.s2i/bin/run
#!/bin/bash | #!/bin/bash | ||||
shopt -s dotglob | shopt -s dotglob | ||||
pushd /opt/app-root/src | pushd /opt/app-root/src | ||||
echo "----> Remove bootstrap cache" | echo "----> Remove bootstrap cache" | ||||
find bootstrap/cache/ -type f ! -name ".gitignore" -delete | find bootstrap/cache/ -type f ! -name ".gitignore" -delete | ||||
if [ -z ${APP_KEY} ]; then | if [ -z ${APP_KEY} ]; then | ||||
echo "----> Run artisan key:generate" | echo "----> Run artisan key:generate" | ||||
./artisan key:generate | ./artisan key:generate | ||||
unset APP_KEY | |||||
fi | fi | ||||
if [ -z ${JWT_SECRET} ]; then | if [ -z ${JWT_SECRET} ]; then | ||||
echo "----> Run artisan jwt:secret" | echo "----> Run artisan jwt:secret" | ||||
./artisan jwt:secret --always-no | ./artisan jwt:secret --always-no | ||||
fi | fi | ||||
echo "----> Run artisan clear-compiled" | echo "----> Run artisan clear-compiled" | ||||
./artisan clear-compiled | ./artisan clear-compiled | ||||
if [[ "${LARAVEL_ENV}" != "production" || "$LARAVEL_ENV{}" != "prod" ]]; then | |||||
echo "----> Run artisan cache:clear" | echo "----> Run artisan cache:clear" | ||||
./artisan ${ARTISAN_VERBOSITY} cache:clear || true | ./artisan ${ARTISAN_VERBOSITY} cache:clear || true | ||||
fi | |||||
# rpm -qv chromium | # rpm -qv chromium | ||||
# if [ ! -z "$(rpm -qv chromium 2>/dev/null)" ]; then | # if [ ! -z "$(rpm -qv chromium 2>/dev/null)" ]; then | ||||
# echo "---- Run artisan dusk:chrome-driver" | # echo "---- Run artisan dusk:chrome-driver" | ||||
# chver=$(rpmquery --queryformat="%{VERSION}" chromium | awk -F'.' '{print $1}') | # chver=$(rpmquery --queryformat="%{VERSION}" chromium | awk -F'.' '{print $1}') | ||||
# ./artisan dusk:chrome-driver ${chver} | # ./artisan dusk:chrome-driver ${chver} | ||||
# fi | # fi | ||||
if [ ! -f 'resources/countries.php' ]; then | if [ ! -f 'resources/countries.php' ]; then | ||||
echo "----> Run artisan data:countries" | echo "----> Run artisan data:countries" | ||||
./artisan data:countries | ./artisan data:countries | ||||
fi | fi | ||||
rm -rvf bootstrap/cache/ | rm -rvf bootstrap/cache/ | ||||
mkdir -vp bootstrap/cache/ | mkdir -vp bootstrap/cache/ | ||||
chown default bootstrap/cache | chown default bootstrap/cache | ||||
./artisan db:ping --wait || exit 1 | ./artisan db:ping --wait || exit 1 | ||||
./artisan migrate --force || : | ./artisan migrate --force || : | ||||
#./artisan db:seed --force || : | #./artisan db:seed --force || : | ||||
env | |||||
case ${HKCCP_APP} in | case ${HKCCP_APP} in | ||||
worker|WORKER ) | worker|WORKER ) | ||||
echo "----> Running worker " | echo "----> Running worker " | ||||
./artisan queue:work;; | exec ./artisan queue:work;; | ||||
server|SERVER ) | server|SERVER ) | ||||
echo "----> Running server " | echo "----> Running server " | ||||
./artisan serve;; | exec ./artisan serve;; | ||||
apache|APACHE|httpd|HTTPD ) | apache|APACHE|httpd|HTTPD ) | ||||
echo "----> Starting httpd " | echo "----> Starting httpd " | ||||
/usr/libexec/s2i/run 2>&1;; | /usr/libexec/s2i/run 2>&1;; | ||||
swoole|SWOOLE ) | |||||
echo "----> Running swoole" | |||||
exec ./artisan swoole:http start;; | |||||
* ) | * ) | ||||
echo "----> Sleeping" | echo "----> Sleeping" | ||||
sleep 10000;; | exec sleep 10000;; | ||||
esac | esac |