summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-09-04 19:18:39 +0200
committerLibravatar GitHub <noreply@github.com>2023-09-04 19:18:39 +0200
commit9f2199f9a9efa25cdb9952c1bc469d9d19d34d73 (patch)
tree406f79c72ba20d4fdf97bbedb3bc2141256b4381
parent[feature] Don't trace non-existing routes (#2172) (diff)
downloadgotosocial-9f2199f9a9efa25cdb9952c1bc469d9d19d34d73.tar.xz
[chore] Add script for downloading latest snapshot tar.gz (#2157)
* [chore] Add script for downloading latest snapshot tar.gz * Update scripts/get_latest_snapshot.sh Co-authored-by: Daenney <daenney@users.noreply.github.com> * Update scripts/get_latest_snapshot.sh Co-authored-by: Daenney <daenney@users.noreply.github.com> * update comment --------- Co-authored-by: Daenney <daenney@users.noreply.github.com>
-rwxr-xr-xscripts/get_latest_snapshot.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/get_latest_snapshot.sh b/scripts/get_latest_snapshot.sh
new file mode 100755
index 000000000..39cb54798
--- /dev/null
+++ b/scripts/get_latest_snapshot.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -eu
+
+# Cheeky little convenience script for fetching
+# the latest snapshot build of GoToSocial from
+# the Minio S3 bucket.
+#
+# Requires curl and jq.
+#
+# Change the variables below for your particular
+# platform and architecture (default linux amd64).
+GTS_PLATFORM="linux"
+GTS_ARCH="amd64"
+GTS_FILENAME="gotosocial_${GTS_PLATFORM}_${GTS_ARCH}.tar.gz"
+
+GITHUB_API_HOST="api.github.com"
+GITHUB_ORG="superseriousbusiness"
+GITHUB_REPO="gotosocial"
+GITHUB_BRANCH="main"
+GITHUB_ENDPOINT="https://${GITHUB_API_HOST}/repos/${GITHUB_ORG}/${GITHUB_REPO}/commits/${GITHUB_BRANCH}"
+
+echo "fetching latest hash from endpoint '${GITHUB_ENDPOINT}'"
+LATEST_HASH="$(curl --silent --fail --retry 5 --retry-max-time 180 --max-time 30 "${GITHUB_ENDPOINT}" | jq -r .sha)"
+echo "got latest hash = ${LATEST_HASH}"
+
+MINIO_HOST="s3.superseriousbusiness.org"
+MINIO_BUCKET="gotosocial-snapshots"
+MINIO_ENDPOINT="https://${MINIO_HOST}/${MINIO_BUCKET}/${LATEST_HASH}/${GTS_FILENAME}"
+
+echo "fetching latest snapshot tar.gz from endpoint '${MINIO_ENDPOINT}'"
+curl --silent --fail --retry 5 --retry-max-time 600 --max-time 1800 "${MINIO_ENDPOINT}" --output "./${GTS_FILENAME}"
+echo "got latest snapshot!"