Fix update scripts: pixelfed storage backup, github-runner full config backup, forgejo-runner version check
This commit is contained in:
@@ -33,14 +33,20 @@ function update_script() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
RELEASE=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//')
|
||||||
|
if [[ "${RELEASE}" == "$(cat ~/.forgejo-runner 2>/dev/null)" ]]; then
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Stopping Services"
|
msg_info "Stopping Services"
|
||||||
systemctl stop forgejo-runner
|
systemctl stop forgejo-runner
|
||||||
msg_ok "Stopped Services"
|
msg_ok "Stopped Services"
|
||||||
|
|
||||||
RELEASE=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//')
|
|
||||||
msg_info "Updating Forgejo Runner to v${RELEASE}"
|
msg_info "Updating Forgejo Runner to v${RELEASE}"
|
||||||
curl -fsSL "https://code.forgejo.org/forgejo/runner/releases/download/v${RELEASE}/forgejo-runner-${RELEASE}-linux-amd64" -o /usr/local/bin/forgejo-runner
|
curl -fsSL "https://code.forgejo.org/forgejo/runner/releases/download/v${RELEASE}/forgejo-runner-${RELEASE}-linux-amd64" -o /usr/local/bin/forgejo-runner
|
||||||
chmod +x /usr/local/bin/forgejo-runner
|
chmod +x /usr/local/bin/forgejo-runner
|
||||||
|
echo "${RELEASE}" >~/.forgejo-runner
|
||||||
msg_ok "Updated Forgejo Runner"
|
msg_ok "Updated Forgejo Runner"
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
|
|||||||
@@ -40,15 +40,17 @@ function update_script() {
|
|||||||
msg_info "Backing up runner configuration"
|
msg_info "Backing up runner configuration"
|
||||||
BACKUP_DIR="/opt/actions-runner.backup"
|
BACKUP_DIR="/opt/actions-runner.backup"
|
||||||
mkdir -p "$BACKUP_DIR"
|
mkdir -p "$BACKUP_DIR"
|
||||||
[[ -f /opt/actions-runner/.runner ]] && cp -a /opt/actions-runner/.runner "$BACKUP_DIR/"
|
for f in .runner .credentials .credentials_rsaparams .env .path; do
|
||||||
[[ -f /opt/actions-runner/.credentials ]] && cp -a /opt/actions-runner/.credentials "$BACKUP_DIR/"
|
[[ -f /opt/actions-runner/$f ]] && cp -a /opt/actions-runner/$f "$BACKUP_DIR/"
|
||||||
|
done
|
||||||
msg_ok "Backed up configuration"
|
msg_ok "Backed up configuration"
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "actions-runner" "actions/runner" "prebuild" "latest" "/opt/actions-runner" "actions-runner-linux-x64-*.tar.gz"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "actions-runner" "actions/runner" "prebuild" "latest" "/opt/actions-runner" "actions-runner-linux-x64-*.tar.gz"
|
||||||
|
|
||||||
msg_info "Restoring runner configuration"
|
msg_info "Restoring runner configuration"
|
||||||
[[ -f "$BACKUP_DIR/.runner" ]] && cp -a "$BACKUP_DIR/.runner" /opt/actions-runner/
|
for f in .runner .credentials .credentials_rsaparams .env .path; do
|
||||||
[[ -f "$BACKUP_DIR/.credentials" ]] && cp -a "$BACKUP_DIR/.credentials" /opt/actions-runner/
|
[[ -f "$BACKUP_DIR/$f" ]] && cp -a "$BACKUP_DIR/$f" /opt/actions-runner/
|
||||||
|
done
|
||||||
rm -rf "$BACKUP_DIR"
|
rm -rf "$BACKUP_DIR"
|
||||||
msg_ok "Restored configuration"
|
msg_ok "Restored configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,16 @@ function update_script() {
|
|||||||
|
|
||||||
msg_info "Backing up Configuration"
|
msg_info "Backing up Configuration"
|
||||||
cp /opt/pixelfed/.env /opt/pixelfed.env.bak
|
cp /opt/pixelfed/.env /opt/pixelfed.env.bak
|
||||||
|
cp -r /opt/pixelfed/storage /opt/pixelfed-storage.bak
|
||||||
msg_ok "Configuration backed up"
|
msg_ok "Configuration backed up"
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "pixelfed" "pixelfed/pixelfed" "tarball" "latest" "/opt/pixelfed"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "pixelfed" "pixelfed/pixelfed" "tarball" "latest" "/opt/pixelfed"
|
||||||
|
|
||||||
msg_info "Restoring Configuration"
|
msg_info "Restoring Configuration"
|
||||||
cp /opt/pixelfed.env.bak /opt/pixelfed/.env
|
cp /opt/pixelfed.env.bak /opt/pixelfed/.env
|
||||||
|
cp -r /opt/pixelfed-storage.bak /opt/pixelfed/storage
|
||||||
rm -f /opt/pixelfed.env.bak
|
rm -f /opt/pixelfed.env.bak
|
||||||
|
rm -rf /opt/pixelfed-storage.bak
|
||||||
msg_ok "Configuration restored"
|
msg_ok "Configuration restored"
|
||||||
|
|
||||||
msg_info "Updating Pixelfed"
|
msg_info "Updating Pixelfed"
|
||||||
@@ -52,6 +55,7 @@ function update_script() {
|
|||||||
chmod -R 775 /opt/pixelfed/storage /opt/pixelfed/bootstrap/cache
|
chmod -R 775 /opt/pixelfed/storage /opt/pixelfed/bootstrap/cache
|
||||||
export COMPOSER_ALLOW_SUPERUSER=1
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
$STD composer install --no-dev --no-ansi --no-interaction --optimize-autoloader
|
$STD composer install --no-dev --no-ansi --no-interaction --optimize-autoloader
|
||||||
|
$STD sudo -u pixelfed php artisan storage:link
|
||||||
$STD sudo -u pixelfed php artisan migrate --force
|
$STD sudo -u pixelfed php artisan migrate --force
|
||||||
$STD sudo -u pixelfed php artisan route:cache
|
$STD sudo -u pixelfed php artisan route:cache
|
||||||
$STD sudo -u pixelfed php artisan view:cache
|
$STD sudo -u pixelfed php artisan view:cache
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ msg_info "Installing Forgejo Runner"
|
|||||||
RUNNER_VERSION=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | jq -r .name | sed 's/^v//')
|
RUNNER_VERSION=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | jq -r .name | sed 's/^v//')
|
||||||
curl -fsSL "https://code.forgejo.org/forgejo/runner/releases/download/v${RUNNER_VERSION}/forgejo-runner-${RUNNER_VERSION}-linux-amd64" -o /usr/local/bin/forgejo-runner
|
curl -fsSL "https://code.forgejo.org/forgejo/runner/releases/download/v${RUNNER_VERSION}/forgejo-runner-${RUNNER_VERSION}-linux-amd64" -o /usr/local/bin/forgejo-runner
|
||||||
chmod +x /usr/local/bin/forgejo-runner
|
chmod +x /usr/local/bin/forgejo-runner
|
||||||
|
echo "${RUNNER_VERSION}" >~/.forgejo-runner
|
||||||
msg_ok "Installed Forgejo Runner"
|
msg_ok "Installed Forgejo Runner"
|
||||||
|
|
||||||
msg_info "Registering Forgejo Runner"
|
msg_info "Registering Forgejo Runner"
|
||||||
|
|||||||
Reference in New Issue
Block a user