- Improve perf with calculate local size only one time

- Add TODO file
This commit is contained in:
Gregory Colpart 2010-10-03 03:30:32 +02:00
parent c7bca62c89
commit ecd7728877
3 changed files with 8 additions and 5 deletions

3
TODO Normal file
View File

@ -0,0 +1,3 @@
- Clean old deployment on remote servers
- Git support
- Amazon S3/CloudFront support for static files

View File

@ -12,7 +12,7 @@ subdocroot="/srv/www"
excludelist="--exclude global.ini --exclude database.ini --exclude config.ini" excludelist="--exclude global.ini --exclude database.ini --exclude config.ini"
# Static (CSS/JS/IMG/etc.) list # Static (CSS/JS/IMG/etc.) list
# TODO: Gerer Amazon S3/CloudFront # TODO: Amazon S3/CloudFront support
staticlist="static00.example.com static01.example.com" staticlist="static00.example.com static01.example.com"
# SSH key # SSH key
@ -49,3 +49,4 @@ staticfilesdir="static"
# email address for notification (empty if no notification) # email address for notification (empty if no notification)
mailnotif="" mailnotif=""

View File

@ -94,11 +94,11 @@ echo
#set +e #set +e
local_space=`du -sm $dir_export/ | sed 's/^\([0-9]\+\)\t.*$/\1/'`
# Deploy on WWW servers # Deploy on WWW servers
for remote in $wwwlist; do for remote in $wwwlist; do
# Be sure to have space for deploying # Be sure to have space for deploying
local_space=`du -sm $dir_export/ | sed 's/^\([0-9]\+\)\t.*$/\1/'`
remote_space=`ssh -p $sshport -o UserKnownHostsFile=$full_path/known_hosts -i $full_path/$sshkey $sshuser@$remote df -lPm $subdocroot | grep ^/ | tr -s " " | cut -d" " -f4` remote_space=`ssh -p $sshport -o UserKnownHostsFile=$full_path/known_hosts -i $full_path/$sshkey $sshuser@$remote df -lPm $subdocroot | grep ^/ | tr -s " " | cut -d" " -f4`
if [ $local_space -ge $remote_space ]; then echo "WARNING... $remote has only $remote_space Mo while you want upload $local_space Mo. Do you want stop ? [y/N]"; read_confirm; fi if [ $local_space -ge $remote_space ]; then echo "WARNING... $remote has only $remote_space Mo while you want upload $local_space Mo. Do you want stop ? [y/N]"; read_confirm; fi
@ -123,12 +123,11 @@ for remote in $wwwlist; do
done done
local_space=`du -sm $dir_export/$staticfilesdir | sed 's/^\([0-9]\+\)\t.*$/\1/'`
for remote in $staticlist; do for remote in $staticlist; do
#TODO: calculer la taille de la destination (df $subdocroot) && pas de deploiement si cela depasse !!
# Be sure to have space for deploying # Be sure to have space for deploying
local_space=`du -sm $dir_export/www/static/ | sed 's/^\([0-9]\+\)\t.*$/\1/'` remote_space=`ssh -p $sshport -o UserKnownHostsFile=$full_path/known_hosts -i $full_path/$sshkey $sshuser@$remote df -lPm $subdocroot | grep ^/ | tr -s " " | cut -d" " -f4`
remote_space=`ssh -p $sshport -o UserKnownHostsFile=$full_path/known_hosts -i $full_path/$sshkey $sshuser@$remote df -lPm /var/www/$staticdestdir | grep ^/ | tr -s " " | cut -d" " -f4`
if [ $local_s -ge $remote_s ]; then echo "WARNING... $remote has only $remote_s Mo while you want upload $local_s Mo : stop deploy now with Ctrl+C"; read enter; fi if [ $local_s -ge $remote_s ]; then echo "WARNING... $remote has only $remote_s Mo while you want upload $local_s Mo : stop deploy now with Ctrl+C"; read enter; fi
echo "sending static on $remote" echo "sending static on $remote"