canaille-globuzma/demo/run.sh

53 lines
1.5 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
2020-11-13 10:15:17 +00:00
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
2023-04-15 11:00:02 +00:00
if [ "$1" = "--backend" -a -n "$2" ]; then
BACKEND="$2"
else
BACKEND="sql"
2023-03-11 23:13:09 +00:00
fi
2023-03-11 23:13:09 +00:00
if ! type python > /dev/null 2>&1 && ! type python3 > /dev/null 2>&1; then
2023-04-15 11:00:02 +00:00
echo "Cannot start the canaille demo server. Please install python on your system"
2023-03-11 23:13:09 +00:00
echo "or run the demo with docker-compose."
2023-03-20 08:56:06 +00:00
exit 1
2023-03-11 23:13:09 +00:00
fi
2024-10-28 08:01:52 +00:00
if ! type uv > /dev/null 2>&1; then
echo "Cannot start the canaille demo server. Please install uv on your system"
2023-03-11 23:13:09 +00:00
echo "or run the demo with docker-compose."
2024-10-28 08:01:52 +00:00
echo "https://docs.astral.sh/uv/getting-started/installation/"
2023-03-20 08:56:06 +00:00
exit 1
fi
2023-03-11 23:13:09 +00:00
pushd "$DIR" > /dev/null 2>&1 || exit
2023-04-15 11:00:02 +00:00
if [ "$BACKEND" = "memory" ]; then
uv sync --inexact --group demo --extra front --extra oidc
2024-10-28 08:01:52 +00:00
uv run honcho --env ../.env --procfile Procfile-memory start
2023-04-15 11:00:02 +00:00
elif [ "$BACKEND" = "sql" ]; then
uv sync --inexact --group demo --extra front --extra oidc --extra sqlite
2024-10-28 08:01:52 +00:00
uv run honcho --env ../.env --procfile Procfile-sql start
2023-04-15 11:00:02 +00:00
elif [ "$BACKEND" = "ldap" ]; then
if ! type slapd > /dev/null 2>&1; then
echo "Cannot start the canaille demo server. Please install OpenLDAP on your system"
echo "or run the demo with docker-compose."
exit 1
fi
uv sync --inexact --group demo --extra front --extra oidc --extra ldap
2024-10-28 08:01:52 +00:00
uv run honcho --env ../.env --procfile Procfile-ldap start
2023-04-15 11:00:02 +00:00
else
echo "Usage: run.sh --backend [sql|memory|ldap]"
2023-04-15 11:00:02 +00:00
fi
popd || exit