Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to run Openverse from an offline media #4484

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
images/
39 changes: 39 additions & 0 deletions docker/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
set dotenv-load := false

COLOR := "\\033[0;35m"
NO_COLOR := "\\033[0m"

# Show all available recipes
@_default:
printf "\n{{ COLOR }}# Docker (path: \`docker/\`)\n"
printf "=========================={{ NO_COLOR }}\n"
just --list --unsorted

################
# Offline mode #
################

# Save all Docker images needed for all services
save:
#!/usr/bin/env bash
mkdir -p images/;
git grep "image:" \
| grep "compose.yml" \
| grep --invert-match "openverse" \
| awk 'NF>1{print $NF}' \
| while read line; do
name="docker/images/"$(echo $line | sed 's:/:-:g')".tar.gz";
echo "Exporting image $line to file $name";
docker image pull --quiet $line;
docker image save $line | gzip > $name;
done

# Load all images saved in the `images/` dir
load:
#!/usr/bin/env bash
ls images/ \
| while read line; do
name="images/"$line;
echo "Importing image from $name";
docker image load < $name;
done
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DC_USER := env_var_or_default("DC_USER", "opener")
@_default:
just --list --unsorted
cd packages/python/openverse-attribution && just
cd docker/ && just
cd docker/cache && just
cd docker/nginx && just
cd docker/es && just
Expand Down Expand Up @@ -146,6 +147,15 @@ lint-codeowners checks="stable":
([ ! -f ingestion_server/.env ] && cp ingestion_server/env.template ingestion_server/.env) || true
([ ! -f api/.env ] && cp api/env.template api/.env) || true

# Delete `.env` files
unenv:
rm \
.env \
docker/minio/.env \
catalog/.env \
ingestion_server/.env \
api/.env

##########
# Docker #
##########
Expand Down