refactor: determine docker compose command based on system

- Determine whether to use `docker compose` or `docker-compose` based on whether
  the former is available on the system at hand.
- Use the `--remove-orphanS` flag, supported since v1.7.0, instead of its
  singular form which was removed at some point.
This commit is contained in:
mirdono
2025-01-28 21:03:09 +01:00
parent 730e531387
commit eb55bc9def

View File

@@ -1,11 +1,19 @@
#!/bin/bash
version=$(docker compose version)
if [ $? -eq 0 ]; then
DRC_COMMAND="docker compose"
else
DRC_COMMAND="docker-compose"
fi
echo "warning this will run queries on the triplestore and delete containers, you have 3 seconds to press ctrl+c"
sleep 3
docker-compose rm -fs elasticsearch search
eval "$DRC_COMMAND rm -fs elasticsearch search"
sudo rm -rf data/elasticsearch/
docker-compose exec -T triplestore isql-v <<EOF
eval "$DRC_COMMAND exec -T triplestore isql-v <<EOF
SPARQL DELETE WHERE { GRAPH <http://mu.semte.ch/authorization> { ?s ?p ?o. } };
exec('checkpoint');
exit;
EOF
docker-compose up -d --remove-orphan
EOF"
eval "$DRC_COMMAND up -d --remove-orphans"