sh Laravel Forge无需停机即可部署脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Laravel Forge无需停机即可部署脚本相关的知识,希望对你有一定的参考价值。

# stop script on error signal
set -e

# remove old deployment folders
if [ -d "/home/forge/deploy" ]; then
  rm -R /home/forge/deploy
fi
if [ -d "/home/forge/backup" ]; then
  rm -R /home/forge/backup
fi

cp -R /home/forge/default /home/forge/deploy

# Update
cd /home/forge/deploy
git pull origin master
composer install
php artisan migrate --force

# Switch (downtime for microseconds)
mv /home/forge/default /home/forge/backup
mv /home/forge/deploy /home/forge/default

# Reset opcache
echo "<?php opcache_reset(); echo 'opcache reset' . PHP_EOL; ?>" > /home/forge/default/public/opcachereset.php
curl http://localhost/opcachereset.php
rm /home/forge/default/public/opcachereset.php

以上是关于sh Laravel Forge无需停机即可部署脚本的主要内容,如果未能解决你的问题,请参考以下文章

sh 使用iptables规则进行IP转发以更新DNS而无需停机时间\o /

无需停机即可配置谷歌云负载均衡器和托管 SSL

在 Heroku 上进行热部署,无需停机

Terraform GCP:无需用户停机即可更新 Cloud Run 服务

使用Redis无需停机即可丢失数据

无法在 Laravel 项目中使用 deploy.sh 文件运行“npm run prod”(使用 Laravel Mix)