Commit a18966ca authored by Miloš Diviš's avatar Miloš Diviš
Browse files

config deployment added, index condition improved

parent 10c092e4
......@@ -9,7 +9,9 @@ key_path='/home/mario/.ssh/websupport_key'
rsync_exclude=('/www/images/uploads/*')
# index.php excluded and send last because of maintenance mode
common_exclude=('*.ssh' '/temp/*' '/log/*' '/nbproject' '/.git' '.gitignore' 'composer.json' '/www/index.php')
common_exclude=('*.ssh' '/temp/*' '/log/*' '/nbproject' '/.git' \
'.gitignore' 'composer.json' '/www/index.php' \
'config.local.neon' 'config.production.neon')
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
......@@ -19,15 +21,19 @@ cd $current_dir
# set maintenance mode
echo '* setting maintenance mode on remote app'
scp -i $key_path $user@$server:$remote_dir/www/index.php temp/
scp -q -i $key_path $user@$server:$remote_dir/www/index.php temp/
if [-f temp/index.php)]; then
sed -i "s/\/\/\s*require '.maintenance.php';/require '.maintenance.php';/" temp/index.php
fi
# set maintance mode if app is on remote
if [ -f temp/index.php ]
then
sed -i "s/\/\/\s*require '.maintenance.php';/require '.maintenance.php';/" \
temp/index.php
rsync -az \
temp/index.php $user@$server:$remote_dir/www/
rm temp/index.php
rsync -az \
temp/index.php $user@$server:$remote_dir/www/
rm temp/index.php
fi
# create exclude text file
for i in "${rsync_exclude[@]}"
......@@ -41,6 +47,7 @@ done
echo "* Starting rsync to $server:$remote_dir"
echo " * sendig project files"
rsync -az \
--delete \
--filter "P log/*.log" --filter "P log/*.html" \
......@@ -49,10 +56,17 @@ rsync -az \
rm exclude.txt
echo '* files uploaded. Sending index.php'
echo ' * sending production config'
cp app/config/config.production.neon temp/config.local.neon
rsync -az \
temp/config.local.neon $user@$server:$remote_dir/app/config/
rm temp/config.local.neon
echo ' * sending index.php'
rsync -az \
www/index.php $user@$server:$remote_dir/www/
echo '* maintance mode off. files uploaded'
echo '* maintance mode off. files uploaded! Yeeeeah!!'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment