Mirror from bluesky-social/pds
1#!/bin/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
23if cmp --quiet "${COMPOSE_FILE}" "${COMPOSE_TEMP_FILE}"; then
24 echo "PDS is already up to date"
25 rm --force "${COMPOSE_TEMP_FILE}"
26 exit 0
27fi
28
29echo "* Updating PDS"
30mv "${COMPOSE_TEMP_FILE}" "${COMPOSE_FILE}"
31
32echo "* Restarting PDS"
33systemctl restart pds
34
35cat <<MESSAGE
36PDS has been updated
37---------------------
38Check systemd logs: journalctl --unit pds
39Check container logs: docker logs pds
40
41MESSAGE