Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

🔨(dev) add Makefile targets to list and download files from Garage

briquet6cde1b44619f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ffd29bb..ee0b403d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ and this project adheres to
- ✨(backend) make the LiveKit default video codec configurable
- 🔧(dev) add support for Bureautix workstations
- ✨(frontend) add screen share zoom controls #1498
+- 🔨(makefile) add targets to list and download files stored in Garage
### Changed
diff --git a/Makefile b/Makefile
index ccaf1974..43693654 100644
--- a/Makefile
+++ b/Makefile
@@ -69,6 +69,22 @@ LINT_SUMMARY = echo 'lint:ruff-format started…' && $(LINT_RUFF_FORMAT)
# -- Frontend
PATH_FRONT = ./src/frontend
+# -- Storage
+GARAGE_BUCKET = meet-media-storage
+STORAGE_FOLDERS = recordings transcripts summaries
+STORAGE_DIRS = $(addprefix data/,$(STORAGE_FOLDERS))
+COMPOSE_RUN_AWS = $(COMPOSE_RUN) --user $(DOCKER_USER)
+AWS_CLI = garage-cors --endpoint-url=http://garage:9000
+# Extensions listed in each folder (skips the Egress manifests in recordings/)
+recordings_EXTENSIONS = mp4 ogg
+transcripts_EXTENSIONS = json
+summaries_EXTENSIONS = txt
+# $(1): folder. Lists its objects with a known extension, most recent first
+storage_list = s3api list-objects-v2 --bucket $(GARAGE_BUCKET) \
+ --prefix $(1)/
+storage_query = reverse(sort_by(Contents[?$(foreach ext,$($(1)_EXTENSIONS), \
+ ends_with(Key, `".$(ext)"`) ||) `false`] || `[]`, &LastModified))
+
# ==============================================================================
# RULES
@@ -77,6 +93,9 @@ default: help
data/media:
@mkdir -p data/media
+$(STORAGE_DIRS):
+ @mkdir -p $@
+
data/static:
@mkdir -p data/static
@@ -328,6 +347,28 @@ env.d/development/multi_user_transcriber:
env.d/development/metadata_collector:
cp -n env.d/development/metadata_collector.dist env.d/development/metadata_collector
+# -- Storage
+
+recordings-download-latest: ## download the latest recording from Garage into data/recordings
+transcripts-download-latest: ## download the latest transcript from Garage into data/transcripts
+summaries-download-latest: ## download the latest summary from Garage into data/summaries
+$(STORAGE_FOLDERS:%=%-download-latest): %-download-latest: data/%
+ @key=$$($(COMPOSE_RUN_AWS) -T $(AWS_CLI) $(call storage_list,$*) \
+ --query '$(call storage_query,$*)[0].Key' --output text) && \
+ if [ "$$key" = "None" ]; then echo "No $* found"; exit 1; fi && \
+ $(COMPOSE_RUN_AWS) --volume $(CURDIR)/data/$*:/aws/data/$* \
+ $(AWS_CLI) s3 cp "s3://$(GARAGE_BUCKET)/$$key" data/$*/
+.PHONY: $(STORAGE_FOLDERS:%=%-download-latest)
+
+recordings-list: ## list recordings stored in Garage, most recent first
+transcripts-list: ## list transcripts stored in Garage, most recent first
+summaries-list: ## list summaries stored in Garage, most recent first
+$(STORAGE_FOLDERS:%=%-list): %-list:
+ @$(COMPOSE_RUN_AWS) $(AWS_CLI) $(call storage_list,$*) \
+ --query '$(call storage_query,$*)[].{Date: LastModified, Key: Key, "Size (bytes)": Size}' \
+ --output table
+.PHONY: $(STORAGE_FOLDERS:%=%-list)
+
# -- Internationalization
env.d/development/crowdin:
diff --git a/docker/compose.d/compose.podman.yml b/docker/compose.d/compose.podman.yml
index 42a0871b..af661b33 100644
--- a/docker/compose.d/compose.podman.yml
+++ b/docker/compose.d/compose.podman.yml
@@ -21,6 +21,8 @@ services:
<<: *keep-id
garage:
<<: *keep-id
+ garage-cors:
+ <<: *keep-id
node:
<<: *keep-id
crowdin: