Created
April 11, 2016 03:22
-
-
Save phnessu4/226c09dfed00adb3095841c86696f952 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_ENV=development | |
APP_DEBUG=true | |
APP_KEY=SomeRandomString | |
APP_URL=http://beta.domain | |
DB_CONNECTION=mysql | |
DB_HOST=127.0.0.1 | |
DB_PORT=3306 | |
DB_DATABASE=homestead | |
DB_USERNAME=homestead | |
DB_PASSWORD=secret | |
CACHE_DRIVER=file | |
SESSION_DRIVER=file | |
QUEUE_DRIVER=sync | |
REDIS_HOST=127.0.0.1 | |
REDIS_PASSWORD=null | |
REDIS_PORT=6379 | |
MAIL_DRIVER=smtp | |
MAIL_HOST=mailtrap.io | |
MAIL_PORT=2525 | |
MAIL_USERNAME=null | |
MAIL_PASSWORD=null | |
MAIL_ENCRYPTION=null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_ENV=production | |
APP_DEBUG=false | |
APP_KEY=SomeRandomString | |
APP_URL=http://domain | |
DB_CONNECTION=mysql | |
DB_HOST=127.0.0.1 | |
DB_PORT=3306 | |
DB_DATABASE=homestead | |
DB_USERNAME=homestead | |
DB_PASSWORD=secret | |
CACHE_DRIVER=file | |
SESSION_DRIVER=file | |
QUEUE_DRIVER=sync | |
REDIS_HOST=127.0.0.1 | |
REDIS_PASSWORD=null | |
REDIS_PORT=6379 | |
MAIL_DRIVER=smtp | |
MAIL_HOST=mailtrap.io | |
MAIL_PORT=2525 | |
MAIL_USERNAME=null | |
MAIL_PASSWORD=null | |
MAIL_ENCRYPTION=null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#部署开发环境 | |
#bash bin/deploy.sh development | |
#部署正式环境 | |
#bash bin/deploy.sh production | |
if [ $# -lt 1 ];then | |
echo "却少部署环境参数. 开发配置 'development' 或 部署配置 'production' ?" | |
exit 2 | |
fi | |
#是否正式部署 | |
is_production=0 | |
if [ "${1}" = "development" ];then | |
is_production=0 | |
elif [ "${1}" = "production" ];then | |
is_production=1 | |
else | |
echo "却少部署环境参数. 开发配置 'development' 或 部署配置 'production' ?" | |
exit 2 | |
fi | |
#获取脚本目录 | |
bin_dir=$(cd `dirname $0`; pwd) | |
#获取项目目录 | |
app_dir=$(cd `dirname $0`; cd ..; pwd) | |
#存储目录 | |
storage_dir="${app_dir}/storage" | |
#缓存目录 | |
cache_dir="${app_dir}/bootstrap/cache" | |
#环境文件 | |
env_file="${app_dir}/.env" | |
#开发环境配置文件 | |
env_development="${app_dir}/.env.development" | |
#部署环境配置文件 | |
env_production="${app_dir}/.env.production" | |
#echo | |
echo '--------------------------------------' | |
echo '脚本目录: ' $bin_dir | |
echo '项目目录: ' $app_dir | |
echo '--------------------------------------' | |
echo '存储目录: ' $storage_dir | |
echo '存储目录: ' $cache_dir | |
echo '--------------------------------------' | |
echo '环境文件: ' $env_file | |
echo '开发环境: ' $env_development | |
echo '部署环境: ' $env_production | |
echo '--------------------------------------' | |
#修改目录权限 | |
chmod -R 777 $storage_dir | |
chmod -R 777 $cache_dir | |
echo '--------------------------------------' | |
echo '修改后目录权限' | |
echo '--------------------------------------' | |
ls -l $storage_dir | |
ls -l $cache_dir | |
echo '删除原始配置文件------------------------' | |
cat $env_file | |
rm -rf .env | |
echo '--------------------------------------' | |
#删除配置文件,重新部署 | |
if [ "$is_production" = 0 ];then | |
echo '开发环境-------------------------------' | |
cp $env_development $env_file | |
else | |
echo '部署环境-------------------------------' | |
cp $env_production $env_file | |
fi | |
echo '生成应用密钥' | |
php "${app_dir}/artisan" key:generate | |
echo '--------------------------------------' | |
cat $env_file | |
echo '--------------------------------------' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment