Add possibility to rollback installation. Update function/argument names to be more clear and update readme
This commit is contained in:
12
README.md
12
README.md
@@ -15,10 +15,17 @@ Optional plugins can be installed. They are included in XO repository, but not i
|
|||||||
Clone this repository, edit variables to suit your preferences from the xo-install.sh script and run it as root
|
Clone this repository, edit variables to suit your preferences from the xo-install.sh script and run it as root
|
||||||
|
|
||||||
```
|
```
|
||||||
|
basic functionality including menu:
|
||||||
./xo-install.sh
|
./xo-install.sh
|
||||||
|
|
||||||
for non-interactive update task:
|
non-interactive update task (option 2):
|
||||||
./xo-install.sh --update
|
./xo-install.sh --update
|
||||||
|
|
||||||
|
non-interactive install task (option 1):
|
||||||
|
./xo-install.sh --install
|
||||||
|
|
||||||
|
non-interactive rollback task (option 4):
|
||||||
|
./xo-install.sh --rollback
|
||||||
```
|
```
|
||||||
|
|
||||||
Tool makes some checks and offers options:
|
Tool makes some checks and offers options:
|
||||||
@@ -34,6 +41,9 @@ Tool makes some checks and offers options:
|
|||||||
3. Deploy container
|
3. Deploy container
|
||||||
- Offers options to build container locally or pull from dockerhub
|
- Offers options to build container locally or pull from dockerhub
|
||||||
|
|
||||||
|
4. Rollback installation
|
||||||
|
- Offers option to choose which installation to use from existing ones (if more than 1)
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
|
|
||||||
- If you choose to install with option 2, you need to take care that required packages are already installed
|
- If you choose to install with option 2, you need to take care that required packages are already installed
|
||||||
|
2
tests/CentOS/Vagrantfile
vendored
2
tests/CentOS/Vagrantfile
vendored
@@ -43,6 +43,6 @@ Vagrant.configure(2) do |config|
|
|||||||
#
|
#
|
||||||
# Run automated test installation
|
# Run automated test installation
|
||||||
#
|
#
|
||||||
config.vm.provision :shell, path: "../../xo-install.sh", args: "--run-test", run: 'always'
|
config.vm.provision :shell, path: "../../xo-install.sh", args: "--install", run: 'always'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
2
tests/Debian/Vagrantfile
vendored
2
tests/Debian/Vagrantfile
vendored
@@ -43,6 +43,6 @@ Vagrant.configure(2) do |config|
|
|||||||
#
|
#
|
||||||
# Run automated test installation
|
# Run automated test installation
|
||||||
#
|
#
|
||||||
config.vm.provision :shell, path: "../../xo-install.sh", args: "--run-test", run: 'always'
|
config.vm.provision :shell, path: "../../xo-install.sh", args: "--install", run: 'always'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
2
tests/Ubuntu/Vagrantfile
vendored
2
tests/Ubuntu/Vagrantfile
vendored
@@ -43,6 +43,6 @@ Vagrant.configure(2) do |config|
|
|||||||
#
|
#
|
||||||
# Run automated test installation
|
# Run automated test installation
|
||||||
#
|
#
|
||||||
config.vm.provision :shell, path: "../../xo-install.sh", args: "--run-test", run: 'always'
|
config.vm.provision :shell, path: "../../xo-install.sh", args: "--install", run: 'always'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@@ -340,14 +340,14 @@ function UpdateXO {
|
|||||||
|
|
||||||
} 2>$LOGFILE
|
} 2>$LOGFILE
|
||||||
|
|
||||||
function UpdateXOAutomate {
|
function HandleArgs {
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--update)
|
--update)
|
||||||
UpdateNodeYarn
|
UpdateNodeYarn
|
||||||
UpdateXO
|
UpdateXO
|
||||||
;;
|
;;
|
||||||
--run-test)
|
--install)
|
||||||
if [ $OSNAME == "CentOS" ]; then
|
if [ $OSNAME == "CentOS" ]; then
|
||||||
InstallDependenciesCentOS
|
InstallDependenciesCentOS
|
||||||
InstallXO
|
InstallXO
|
||||||
@@ -358,6 +358,10 @@ function UpdateXOAutomate {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--rollback)
|
||||||
|
RollBackInstallation
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
StartUpScreen
|
StartUpScreen
|
||||||
;;
|
;;
|
||||||
@@ -365,6 +369,44 @@ function UpdateXOAutomate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function RollBackInstallation {
|
||||||
|
|
||||||
|
INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*"))
|
||||||
|
|
||||||
|
if [[ $(echo ${#INSTALLATIONS[@]}) -le 1 ]]; then
|
||||||
|
echo "Only one installation exists, nothing to change"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Which installation to roll back?"
|
||||||
|
echo
|
||||||
|
local PS3="Pick a number. CTRL+C to exit: "
|
||||||
|
select INSTALLATION in "${INSTALLATIONS[@]}"; do
|
||||||
|
case $INSTALLATION in
|
||||||
|
*xen-orchestra*)
|
||||||
|
echo
|
||||||
|
echo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
|
||||||
|
ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server
|
||||||
|
echo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
|
||||||
|
ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web
|
||||||
|
echo
|
||||||
|
echo "Updating xo-server.service systemd configuration file location"
|
||||||
|
ln -sfn $INSTALLDIR/xo-server/xo-server.service /etc/systemd/system/xo-server.service
|
||||||
|
/bin/systemctl daemon-reload
|
||||||
|
echo
|
||||||
|
echo "Restarting xo-server..."
|
||||||
|
/bin/systemctl restart xo-server
|
||||||
|
echo
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Try again"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function CheckOS {
|
function CheckOS {
|
||||||
|
|
||||||
if [ -f /etc/centos-release ] ; then
|
if [ -f /etc/centos-release ] ; then
|
||||||
@@ -452,6 +494,7 @@ echo "- Option 2. actually creates a new build from sources but works as an upda
|
|||||||
echo " NodeJS and Yarn packages are updated automatically. Check AUTOUPDATE variable to disable this"
|
echo " NodeJS and Yarn packages are updated automatically. Check AUTOUPDATE variable to disable this"
|
||||||
echo " Data stored in redis and /var/lib/xo-server/data will not be touched during update procedure."
|
echo " Data stored in redis and /var/lib/xo-server/data will not be touched during update procedure."
|
||||||
echo " 3 latest installations will be preserved and older ones are deleted after successful update. Fresh installation is symlinked as active"
|
echo " 3 latest installations will be preserved and older ones are deleted after successful update. Fresh installation is symlinked as active"
|
||||||
|
echo " Rollback to another installation with --rollback"
|
||||||
echo
|
echo
|
||||||
echo "- To run option 2. without interactive mode (as cronjob for automated updates for example) use --update"
|
echo "- To run option 2. without interactive mode (as cronjob for automated updates for example) use --update"
|
||||||
echo
|
echo
|
||||||
@@ -477,7 +520,8 @@ echo
|
|||||||
echo "1. Autoinstall"
|
echo "1. Autoinstall"
|
||||||
echo "2. Update / Install without packages"
|
echo "2. Update / Install without packages"
|
||||||
echo "3. Deploy docker container"
|
echo "3. Deploy docker container"
|
||||||
echo "4. Exit"
|
echo "4. Rollback to another existing installation"
|
||||||
|
echo "5. Exit"
|
||||||
echo
|
echo
|
||||||
read -p ": " option
|
read -p ": " option
|
||||||
|
|
||||||
@@ -540,6 +584,10 @@ read -p ": " option
|
|||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
|
RollBackInstallation
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
5)
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -556,7 +604,7 @@ CheckOS
|
|||||||
CheckSystemd
|
CheckSystemd
|
||||||
|
|
||||||
if [[ $# == "1" ]]; then
|
if [[ $# == "1" ]]; then
|
||||||
UpdateXOAutomate "$1"
|
HandleArgs "$1"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
StartUpScreen
|
StartUpScreen
|
||||||
|
Reference in New Issue
Block a user