aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-05-14 14:22:58 -0700
committerJade Lovelace <lix@jade.fyi>2024-05-14 14:28:01 -0700
commit58ff8960cd32e0ad9765315e6500fb8e4e43575d (patch)
tree392b64ae013a7c77bbaaf3bada9aa309651077e1
parent4b35e6a75e35e0f79bdadfd5e0d44bc870dcc135 (diff)
doc: add a script to upload the nightly manual manually
This is not like, perfect, since it is a manual operation, but we can automate it in the future. rclone is used, since it seems like awscli is not (obviously at least?) able to sync directories such that old things are deleted, and rclone does this thing properly. Fixes: https://git.lix.systems/lix-project/meta/issues/2 Change-Id: Ia6a46d861342a6d29b22f981ba4e35e79f79e60e
-rw-r--r--doc/manual/rclone.conf8
-rwxr-xr-xmaintainers/upload_manual.sh40
2 files changed, 48 insertions, 0 deletions
diff --git a/doc/manual/rclone.conf b/doc/manual/rclone.conf
new file mode 100644
index 000000000..c37c12638
--- /dev/null
+++ b/doc/manual/rclone.conf
@@ -0,0 +1,8 @@
+[lix-docs]
+type = s3
+provider = Other
+env_auth = true
+endpoint = https://s3.lix.systems
+location_constraint = garage
+region = garage
+acl = private
diff --git a/maintainers/upload_manual.sh b/maintainers/upload_manual.sh
new file mode 100755
index 000000000..f50520490
--- /dev/null
+++ b/maintainers/upload_manual.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+cd "$(dirname -- "$0")/.."
+
+# This script uploads the Lix manual to the Lix s3 store.
+# It expects credentials to be configured like so:
+#
+# ~/.aws/credentials:
+#
+# [default]
+# aws_access_key_id = SOMEACCESSKEY
+# aws_secret_access_key = SOMESECRETKEY
+#
+# default can also be replaced by some other string if AWS_PROFILE is set in
+# environment.
+#
+# See: https://rclone.org/s3/#authentication
+#
+# To obtain such a key, log into the garage host and run:
+# (obtain GARAGE_RPC_SECRET into environment perhaps by systemctl cat garage)
+# garage key create SOME-KEY-NAME
+# garage bucket allow --read --write docs --key SOME-KEY-NAME
+
+if [[ ! -f result-doc/share/doc/nix/manual/index.html ]]; then
+ echo -e "result-doc does not appear to contain a Lix manual. You can build one with:\n nix build '.#default^*'" >&2
+ exit 1
+fi
+
+# --checksum: https://rclone.org/s3/#avoiding-head-requests-to-read-the-modification-time
+# By default rclone uses the modification time to determine if something needs
+# syncing. This is actually very bad for our use case, since we have small
+# files that have meaningless (Unix epoch) local modification time data. We can
+# make it go both 16x faster and more correct by using md5s instead.
+rclone \
+ --config doc/manual/rclone.conf \
+ -vv \
+ sync \
+ --checksum \
+ result-doc/share/doc/nix/manual/ lix-docs:docs/manual/nightly/