Add debug
This commit is contained in:
parent
8e316ef798
commit
4bcc226c4b
1 changed files with 34 additions and 9 deletions
|
@ -53,6 +53,9 @@ if [ -z "${token}" ]; then
|
|||
fi
|
||||
if [ "${tag}" == "latest" ]; then
|
||||
tag=$(curl -L -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${token}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/mastodon/mastodon/releases/latest | jq '.tag_name')
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Latest tag is '${tag}'"
|
||||
fi
|
||||
else
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Looking for tag '${tag}'..."
|
||||
|
@ -67,7 +70,7 @@ else
|
|||
next_page=$(grep '< link: ' "${tmpfile}" | sed 's/< link: //g' | sed 's/, /\n/g' | grep 'rel="next"' | grep -o 'https://[^>]*')
|
||||
done
|
||||
if ! pgrep "${tag}" "${releases_file}"; then
|
||||
echo "The tag '%s' is not part of the releases:\n%s" "${tag}" "${releases}"
|
||||
printf "The tag '%s' is not part of the releases:\n%s" "${tag}" "${releases}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -84,16 +87,38 @@ if [ ! -d "${mastodon_home}" ]; then
|
|||
exit 2
|
||||
fi
|
||||
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Changing to Mastodon's home directory '${mastodon_home}'..."
|
||||
fi
|
||||
cd "${mastodon_home}" || exit 3
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Fetching from repository..."
|
||||
fi
|
||||
"${pre_command}"sudo -u mastodon git fetch
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Changing to reference '${tag}'..."
|
||||
fi
|
||||
"${pre_command}"sudo -u mastodon git checkout "${tag}"
|
||||
current_date=$(date +%Y-%m-%d-%H-%M-%S)
|
||||
mkdir -p /var/backups/postgres
|
||||
backup_file="/var/backups/postgres/pgdump_pre_update_mastodon_to_${tag}_${current_date}.sql.gz"
|
||||
if [ "${dummy}" == "true" ]; then
|
||||
echo "sudo -u postgres pg_dump mastodon | gzip -c > \"/var/backups/postgres/pgdump_pre_update_mastodon_to_${tag}_${current_date}.sql.gz\""
|
||||
echo "sudo -u postgres pg_dump mastodon | gzip -c > \"${backup_file}\""
|
||||
else
|
||||
sudo -u postgres pg_dump mastodon | gzip -c > "/var/backups/postgres/pgdump_pre_update_mastodon_to_${tag}_${current_date}.sql.gz"
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Creating a backup of the database in '${backup_file}'..."
|
||||
fi
|
||||
sudo -u postgres pg_dump mastodon | gzip -c > "${backup_file}"
|
||||
fi
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Running bundle install..."
|
||||
fi
|
||||
"${pre_command}"sudo -u mastodon bundle install
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Running yarm install..."
|
||||
fi
|
||||
"${pre_command}"sudo -u mastodon yarn install --frozen-lockfile
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
echo "Restarting Mastodon services..."
|
||||
fi
|
||||
"${pre_command}"sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service
|
||||
|
|
Loading…
Reference in a new issue