canaille-globuzma/demo/run.sh

53 lines
1.5 KiB
Bash
Raw 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
2023-03-11 23:13:09 +00:00
if ! type poetry > /dev/null 2>&1; then
2023-04-15 11:00:02 +00:00
echo "Cannot start the canaille demo server. Please install poetry on your system"
2023-03-11 23:13:09 +00:00
echo "or run the demo with docker-compose."
echo "https://python-poetry.org/docs/#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
poetry install --with demo --without dev --extras front --extras oidc
2023-04-15 11:00:02 +00:00
env poetry run honcho --procfile Procfile-memory start
elif [ "$BACKEND" = "sql" ]; then
poetry install --with demo --without dev --extras front --extras oidc --extras sql
env poetry run honcho --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
poetry install --with demo --without dev --extras front --extras oidc --extras ldap
2023-04-15 11:00:02 +00:00
env poetry run honcho --procfile Procfile-ldap start
else
echo "Usage: run.sh --backend [sql|memory|ldap]"
2023-04-15 11:00:02 +00:00
fi
popd || exit