Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
08e67b66
Commit
08e67b66
authored
12 years ago
by
Dmitry Simonenko
Browse files
Options
Downloads
Patches
Plain Diff
bug1050951: extend rpm deployment heuristics to check instance existance
(
https://bugs.launchpad.net/tarantool/+bug/1050951
)
parent
9e096611
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extra/tarantool_deploy.sh
+39
-23
39 additions, 23 deletions
extra/tarantool_deploy.sh
with
39 additions
and
23 deletions
extra/tarantool_deploy.sh
+
39
−
23
View file @
08e67b66
...
...
@@ -74,7 +74,7 @@ rollback_instance() {
}
rollback
()
{
log
">>> roll
ing
back changes"
log
">>> rollback changes"
rollback_instance
$deploy_name
exit
1
}
...
...
@@ -95,34 +95,56 @@ deploy() {
workdir
=
"
${
prefix_var
}
/tarantool_box
$id
"
config
=
"
${
prefix
}
/etc/tarantool_box
$id
.cfg"
log
">>> deploy
ing
instance
$id
"
log
">>> deploy instance
$id
"
# set
ting
up work environment
# setup work environment
try
"mkdir -p
$workdir
/logs"
# set
ting
up startup snapshot
# setup startup snapshot
try
"cp
\"
${
prefix
}
/share/tarantool/00000000000000000001.snap
\"
$workdir
"
try
"chown tarantool:tarantool -R
$workdir
"
# set
ting
up configuration file
# setup configuration file
try
"cp
\"
${
prefix
}
/etc/tarantool.cfg
\"
$config
"
try
'echo work_dir = \"$workdir\" >> $config'
try
'echo username = \"tarantool\" >> $config'
try
'echo logger = \"cat - \>\> logs/tarantool.log\" >> $config'
# set
ting
up wrapper
# setup wrapper
try
"ln -s
\"
${
prefix
}
/bin/tarantool_multi.sh
\"
\"
${
prefix
}
/bin/tarantool_box
$id
.sh
\"
"
# set
ting
up startup script
# setup startup script
try
"ln -s
\"
${
prefix_etc
}
/init.d/tarantool_box
\"
\"
${
prefix_etc
}
/init.d/tarantool_box
$id
\"
"
}
deploy_check
()
{
id
=
$1
# check, if instance is already exist (configuration file, consistent way)
if
[
$deploy_exists
-eq
1
]
;
then
grep
"^
\(
${
id
}
\)
$"
$deploy_cfg
>
/dev/null
if
[
$?
-eq
0
]
;
then
log
"Instance '
${
id
}
' is already deployed."
exit
0
fi
fi
# check, if there are any instance-related files exists that could be
# accidently removed or overwritten by setup.
instance_workdir
=
"
${
prefix_var
}
/tarantool_box
$id
"
instance_config
=
"
${
prefix
}
/etc/tarantool_box
$id
.cfg"
instance_wrapper
=
"
${
prefix
}
/bin/tarantool_box
$id
.sh"
isntance_startup
=
"
${
prefix_etc
}
/init.d/tarantool_box
$id
"
[
-d
$instance_workdir
]
&&
error
"Instance workdir exists: '
$instance_workdir
'"
[
-f
$instance_config
]
&&
error
"Instance configuration file exists:
$instance_config
"
[
-f
$instance_wrapper
]
&&
error
"Instance wrapper file exists:
$instance_wrapper
"
[
-f
$instance_startup
]
&&
error
"Instance startup file exists:
$instance_startup
"
}
commit
()
{
log
">>> updating deployment config"
try
"echo
$1
>>
$deploy_cfg
"
}
# process
ing
command line arguments
# process command line arguments
[
$#
-eq
0
]
&&
usage 1
deploy_name_set
=
0
...
...
@@ -148,10 +170,10 @@ set ${prefix_etc:="/etc"}
deploy_cfg
=
"
${
prefix
}
/etc/tarantool_deploy.cfg"
deploy_exists
=
0
# check
ing
deployment configuration file
# check deployment configuration file
[
-f
$deploy_cfg
]
&&
deploy_exists
=
1
# display
ing
status
# display status
if
[
$act_status
-ne
0
]
;
then
if
[
$deploy_exists
-eq
0
]
;
then
log
"No tarantool instances found."
...
...
@@ -161,25 +183,19 @@ if [ $act_status -ne 0 ]; then
exit
0
fi
# check
ing
that instance name was specified
# check that instance name was specified
[
$deploy_name_set
-eq
0
]
&&
usage 1
# checking if instance already deployed
if
[
$deploy_exists
-eq
1
]
;
then
grep
"^
\(
${
deploy_name
}
\)
$"
$deploy_cfg
>
/dev/null
if
[
$?
-eq
0
]
;
then
log
"Instance '
${
deploy_name
}
' is already deployed."
exit
0
fi
fi
# validating instance name
# validate instance name
echo
$deploy_name
|
grep
'^[[:digit:]]\+.\(1\|2\)'
>
/dev/null
if
[
$?
-eq
1
]
;
then
error
"Bad instance name format, should be e.g: 1.1, 1.2, etc."
fi
# asking permission to continue
# check if it consistent to deploy new instance
deploy_check
$deploy_name
# ask permission to continue
if
[
$act_prompt
-eq
1
]
;
then
[
$act_dry
-ne
0
]
&&
log
"(dry mode)"
log
"About to deploy Tarantool instance
$deploy_name
."
...
...
@@ -188,7 +204,7 @@ if [ $act_prompt -eq 1 ]; then
case
"
$answer
"
in
[
Yy]
)
;;
*
)
log
"Abort
ing
"
log
"Abort"
exit
0
;;
esac
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment