Fork of official Bluesky PDS (Personal Data Server).
1#!/usr/bin/env bash
2set -o errexit
3set -o nounset
4set -o pipefail
5
6PDS_DATADIR="/pds"
7COMPOSE_FILE="${PDS_DATADIR}/compose.yaml"
8COMPOSE_URL="https://raw.githubusercontent.com/bluesky-social/pds/main/compose.yaml"
9
10# TODO: allow the user to specify a version to update to.
11TARGET_VERSION="${1:-}"
12
13COMPOSE_TEMP_FILE="${COMPOSE_FILE}.tmp"
14
15echo "* Downloading PDS compose file"
16curl \
17 --silent \
18 --show-error \
19 --fail \
20 --output "${COMPOSE_TEMP_FILE}" \
21 "${COMPOSE_URL}"
22
23sed --in-place "s|/pds|${PDS_DATADIR}|g" "${PDS_DATADIR}/compose.yaml"
24
25if cmp --quiet "${COMPOSE_FILE}" "${COMPOSE_TEMP_FILE}"; then
26 echo "PDS is already up to date"
27 rm --force "${COMPOSE_TEMP_FILE}"
28 exit 0
29fi
30
31echo "* Updating PDS"
32mv "${COMPOSE_TEMP_FILE}" "${COMPOSE_FILE}"
33
34echo "* Restarting PDS"
35systemctl restart pds
36
37cat <<MESSAGE
38PDS has been updated
39---------------------
40Check systemd logs: journalctl --unit pds
41Check container logs: docker logs pds
42
43MESSAGE