Set Docker upgrade process as optional
This commit is contained in:
parent
cc4387898b
commit
bf62bfda98
@ -1,6 +1,7 @@
|
|||||||
# Containers management
|
# Containers management
|
||||||
|
|
||||||
These scripts and Systemd units manage the daily snapshoting of our Nspawn containers, and update of Docker containers.
|
These scripts and Systemd units manage the daily snapshoting of our Nspawn containers, and (optionally) update of Docker
|
||||||
|
containers.
|
||||||
|
|
||||||
### Introduction
|
### Introduction
|
||||||
All running Nspawn containers are stopped, snapshoted (using Btrfs subvolumes) and restarted
|
All running Nspawn containers are stopped, snapshoted (using Btrfs subvolumes) and restarted
|
||||||
|
14
install.sh
14
install.sh
@ -16,19 +16,23 @@ if [[ $user != 'root' ]]; then
|
|||||||
sudo cp systemd-templates/conts-snap.service /etc/systemd/system/
|
sudo cp systemd-templates/conts-snap.service /etc/systemd/system/
|
||||||
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
|
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
|
||||||
sudo cp systemd-templates/conts-snap.timer /etc/systemd/system/
|
sudo cp systemd-templates/conts-snap.timer /etc/systemd/system/
|
||||||
|
sudo cp systemd-templates/machines-start.timer /etc/systemd/system/
|
||||||
|
if [ $docker -eq 1 ]; then
|
||||||
sudo cp systemd-templates/docker-upgrade.service /etc/systemd/system/
|
sudo cp systemd-templates/docker-upgrade.service /etc/systemd/system/
|
||||||
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
|
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
|
||||||
sudo cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
|
sudo cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
|
||||||
sudo cp systemd-templates/machines-start.timer /etc/systemd/system/
|
fi
|
||||||
else
|
else
|
||||||
cp systemd-templates/cont-snap@.service /etc/systemd/system/
|
cp systemd-templates/cont-snap@.service /etc/systemd/system/
|
||||||
cp systemd-templates/conts-snap.service /etc/systemd/system/
|
cp systemd-templates/conts-snap.service /etc/systemd/system/
|
||||||
sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
|
sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
|
||||||
cp systemd-templates/conts-snap.timer /etc/systemd/system/
|
cp systemd-templates/conts-snap.timer /etc/systemd/system/
|
||||||
|
cp systemd-templates/machines-start.timer /etc/systemd/system/
|
||||||
|
if [ $docker -eq 1 ]; then
|
||||||
cp systemd-templates/docker-upgrade.service /etc/systemd/system/
|
cp systemd-templates/docker-upgrade.service /etc/systemd/system/
|
||||||
sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
|
sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
|
||||||
cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
|
cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
|
||||||
cp systemd-templates/machines-start.timer /etc/systemd/system/
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Reloading Systemd..."
|
echo "Reloading Systemd..."
|
||||||
if [[ $user != 'root' ]]; then
|
if [[ $user != 'root' ]]; then
|
||||||
@ -36,13 +40,17 @@ if [[ $user != 'root' ]]; then
|
|||||||
else
|
else
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
echo "Enabling timer (not starting it, either do it manually or reboot)..."
|
echo "Enabling timer(s) (not starting it, either do it manually or reboot)..."
|
||||||
if [[ $user != 'root' ]]; then
|
if [[ $user != 'root' ]]; then
|
||||||
sudo systemctl enable conts-snap.timer
|
sudo systemctl enable conts-snap.timer
|
||||||
|
if [ $docker -eq 1 ]; then
|
||||||
sudo systemctl enable docker-upgrade.timer
|
sudo systemctl enable docker-upgrade.timer
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
systemctl enable conts-snap.timer
|
systemctl enable conts-snap.timer
|
||||||
|
if [ $docker -eq 1 ]; then
|
||||||
systemctl enable docker-upgrade.timer
|
systemctl enable docker-upgrade.timer
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Finished install. Exiting..."
|
echo "Finished install. Exiting..."
|
||||||
|
@ -3,3 +3,4 @@
|
|||||||
# Copy this file as variables.conf, with the correct values
|
# Copy this file as variables.conf, with the correct values
|
||||||
|
|
||||||
containers_dir="" # Path to containers subvolumes main directory
|
containers_dir="" # Path to containers subvolumes main directory
|
||||||
|
docker=0 # Boolean (0 or 1); Set to 1 if Docker is running on the server
|
||||||
|
Loading…
Reference in New Issue
Block a user