separate dummy runs

This commit is contained in:
Antonio J. Delgado 2024-02-16 18:06:29 +02:00
parent f87ee554c2
commit 124580379d
2 changed files with 26 additions and 12 deletions

View file

@ -75,12 +75,6 @@ else
fi fi
fi fi
if [ "${dummy}" == "true" ]; then
pre_command="echo "
else
pre_command=""
fi
mastodon_home="$(grep "^mastodon:" /etc/passwd | awk 'BEGIN {FS=":"} {print($6)}')/live" mastodon_home="$(grep "^mastodon:" /etc/passwd | awk 'BEGIN {FS=":"} {print($6)}')/live"
if [ ! -d "${mastodon_home}" ]; then if [ ! -d "${mastodon_home}" ]; then
printf "The home for the user mastodon '%s', doesn't exist." "${mastodon_home}" printf "The home for the user mastodon '%s', doesn't exist." "${mastodon_home}"
@ -96,11 +90,19 @@ if [ "${current_tag}" != "${tag}" ]; then
if [ "${DEBUG}" == "true" ]; then if [ "${DEBUG}" == "true" ]; then
echo "Fetching from repository..." echo "Fetching from repository..."
fi fi
"${pre_command}"sudo -u mastodon git fetch if [ "${dummy}" == "true" ]; then
echo sudo -u mastodon git fetch
else
sudo -u mastodon git fetch
fi
if [ "${DEBUG}" == "true" ]; then if [ "${DEBUG}" == "true" ]; then
echo "Changing to reference '${tag}'..." echo "Changing to reference '${tag}'..."
fi fi
"${pre_command}"sudo -u mastodon git checkout "${tag}" if [ "${dummy}" == "true" ]; then
echo sudo -u mastodon git checkout "${tag}"
else
sudo -u mastodon git checkout "${tag}"
fi
current_date=$(date +%Y-%m-%d-%H-%M-%S) current_date=$(date +%Y-%m-%d-%H-%M-%S)
mkdir -p /var/backups/postgres mkdir -p /var/backups/postgres
backup_file="/var/backups/postgres/pgdump_pre_update_mastodon_to_${tag}_${current_date}.sql.gz" backup_file="/var/backups/postgres/pgdump_pre_update_mastodon_to_${tag}_${current_date}.sql.gz"
@ -115,15 +117,27 @@ if [ "${current_tag}" != "${tag}" ]; then
if [ "${DEBUG}" == "true" ]; then if [ "${DEBUG}" == "true" ]; then
echo "Running bundle install..." echo "Running bundle install..."
fi fi
"${pre_command}"sudo -u mastodon bundle install if [ "${dummy}" == "true" ]; then
echo sudo -u mastodon bundle install
else
sudo -u mastodon bundle install
fi
if [ "${DEBUG}" == "true" ]; then if [ "${DEBUG}" == "true" ]; then
echo "Running yarm install..." echo "Running yarm install..."
fi fi
"${pre_command}"sudo -u mastodon yarn install --frozen-lockfile if [ "${dummy}" == "true" ]; then
echo sudo -u mastodon yarn install --frozen-lockfile
else
sudo -u mastodon yarn install --frozen-lockfile
fi
if [ "${DEBUG}" == "true" ]; then if [ "${DEBUG}" == "true" ]; then
echo "Restarting Mastodon services..." echo "Restarting Mastodon services..."
fi fi
"${pre_command}"sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service if [ "${dummy}" == "true" ]; then
echo sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service
else
sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service
fi
else else
echo "Current branch is already '${tag}'" echo "Current branch is already '${tag}'"
exit 0 exit 0

View file

@ -79,7 +79,7 @@ class mastodon (
String $db_user = 'mastodon', String $db_user = 'mastodon',
String $db_password = 'S3cr3TP4ssw0rd', String $db_password = 'S3cr3TP4ssw0rd',
Integer $db_port = 5432, Integer $db_port = 5432,
String $mastodon_version = 'v4.2.5', String $mastodon_version = 'v4.2.7',
String $ruby_version = '3.2.3', String $ruby_version = '3.2.3',
String $mastodon_user = 'mastodon', String $mastodon_user = 'mastodon',
String $mastodon_group = 'mastodon', String $mastodon_group = 'mastodon',