Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Miloš Diviš
deploy script
Commits
fd0c4ee3
Commit
fd0c4ee3
authored
Mar 19, 2014
by
Miloš Diviš
Browse files
delete logs option added, coments altered
parent
c595b097
Changes
3
Hide whitespace changes
Inline
Side-by-side
deploy.sh
View file @
fd0c4ee3
# /bin/bash
# Deply script for Nette application
#
# minified nette version expected in ./Nette-minified/nette.min.php
#
# setup
server
=
'195.210.29.9'
user
=
'k-architekt.cz'
remote_dir
=
'/web'
key_path
=
'/home/mario/.ssh/websupport_key'
rsync_exclude
=(
'/www/images/uploads/*'
)
delete_logs
=
0
# index.php excluded and send last because of maintenance mode
common_exclude
=(
'*.ssh'
'/temp/*'
'/log/*'
'/nbproject'
'/.git'
\
# index.php excluded
from project files sync
and send last because of maintenance mode
common_exclude
=(
'*.ssh'
'/temp/*'
'/log/*'
'/nbproject'
'/.git'
'deploy.sh'
'*~'
\
'.gitignore'
'composer.json'
'/www/index.php'
\
'config.local.neon'
'config.production.neon'
)
# check options
delete_logs
=
0
while
getopts
":d"
opt
;
do
case
$opt
in
d
)
...
...
@@ -82,7 +88,7 @@ echo ' * sending index.php'
rsync
-az
\
www/index.php
$user
@
$server
:
$remote_dir
/www/
echo
'* rsync completed'
echo
'* rsync completed
, maitenance mode off.
'
if
[
$delete_logs
-eq
1
]
then
...
...
@@ -95,6 +101,6 @@ if [ $delete_logs -eq 1 ]
SFTPDELIM
fi
echo
'*
maintance mode off. files upload
ed! Yeeeeah!
!
'
echo
'*
** Deploy complet
ed! Yeeeeah!
***
'
exit
0
deploy_test.sh
deleted
100755 → 0
View file @
c595b097
# /bin/bash
# setup
server
=
'aaaa'
remote_dir
=
'/www/'
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'
)
current_dir
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
cd
$current_dir
# set maintenance mode
echo
'* setting maintenance mode on remote app'
rsync
-v
--dry-run
\
"
$server
:
$remote_dir
/www/index.php temp/"
sed
-i
"s/
\/\/\s
*require '.maintenance.php';/require '.maintenance.php';/"
index.php
rsync
-v
--dry-run
\
"temp/index.php
$server
:
$remote_dir
/www/"
rm
temp/index.php
# create exclude text file
for
i
in
"
${
rsync_exclude
[@]
}
"
do
echo
$i
>>
exclude.txt
done
for
i
in
"
${
common_exclude
[@]
}
"
do
echo
$i
>>
exclude.txt
done
echo
'* Starting rsync to $server:$target_dir/test/'
rsync
-v
--dry-run
\
-r
--delete
\
--filter
"P log/*.log"
--filter
"P log/*.html"
\
--include
".htaccess"
--exclude-from
exclude.txt
\
"."
"moved/"
# . "$server:$target_dir/test/"
rm
exclude.txt
echo
'* files uploaded. Sending index.php'
rsync
-v
--dry-run
\
www/index.php
"
$server
:
$remote_dir
/www/"
echo
'* maintance mode off. files uploaded'
test.sh.save
0 → 100755
View file @
fd0c4ee3
#!/bin/bash
while
getopts
":d"
opt
;
do
case
$opt
in
d
)
echo
"-d was triggered!"
;;
\?
)
echo
"Invalid option: -d to delete remote logs"
>
&2
;;
esac
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment