2023-12-09 10:28:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
2023-12-11 14:40:29 +01:00
|
|
|
services=(coturn element etebase nginx-www searxng synapse syncthing vw)
|
2023-12-09 10:28:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
rel_path="$(dirname "$0")"
|
|
|
|
|
|
|
|
|
|
|
|
function compose_up {
|
|
|
|
docker-compose -f "$rel_path/$1/docker-compose.yaml" pull
|
|
|
|
docker-compose -f "$rel_path/$1/docker-compose.yaml" up -d
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function coturn_update {
|
|
|
|
sudo docker-compose -f "$rel_path/coturn/docker-compose.yaml" pull
|
|
|
|
sudo docker-compose -f "$rel_path/coturn/docker-compose.yaml" up -d
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-12-11 14:40:29 +01:00
|
|
|
function element_update {
|
|
|
|
compose_up element
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-12-09 10:28:33 +01:00
|
|
|
function etebase_update {
|
|
|
|
if ! docker pull victorrds/etebase:alpine | grep -q 'Image is up to date' ; then
|
|
|
|
echo "Update available for etebase."
|
|
|
|
sudo "$rel_path/backup.sh" etebase --norestart
|
|
|
|
compose_up etebase
|
|
|
|
else
|
|
|
|
echo "No update available for etebase."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function nginx-www_update {
|
|
|
|
compose_up nginx-www
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function searxng_update {
|
|
|
|
compose_up searxng
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function synapse_update {
|
|
|
|
has_update=0
|
|
|
|
if ! docker pull postgres:alpine | grep -q 'Image is up to date' || ! docker pull matrixdotorg/synapse:latest | grep -q 'Image is up to date'; then
|
|
|
|
has_update=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $has_update -eq 1 ]]; then
|
|
|
|
echo "Update available for synapse and/or postgres."
|
|
|
|
sudo "$rel_path/backup.sh" synapse --norestart
|
|
|
|
compose_up synapse
|
|
|
|
else
|
|
|
|
echo "No update available for synapse and postgres."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function syncthing_update {
|
|
|
|
compose_up syncthing
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function vw_update {
|
|
|
|
sudo "$rel_path/backup.sh" vw
|
|
|
|
compose_up vw
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -z "$1" || ! $(echo "${services[*]} all" | grep -P "\b$1\b" ) ]]; then
|
|
|
|
echo "Wrong argument."
|
|
|
|
echo "Options: ${services[*]}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$1" != "all" ]]; then
|
|
|
|
echo "Running $1 update."
|
|
|
|
${1}_update
|
|
|
|
else
|
|
|
|
for service in "${services[@]}"; do
|
|
|
|
echo "Running $service update."
|
|
|
|
${service}_update
|
|
|
|
done
|
|
|
|
fi
|