diff --git a/demo/Dockerfile-canaille b/demo/Dockerfile-canaille index 05d419aa..1697679e 100644 --- a/demo/Dockerfile-canaille +++ b/demo/Dockerfile-canaille @@ -9,8 +9,9 @@ RUN \ libldap2-dev \ libssl-dev -COPY setup.cfg setup.py /opt/canaille/ -RUN pip install --editable /opt/canaille - +COPY poetry.lock pyproject.toml /opt/canaille/ +RUN pip install poetry WORKDIR /opt/canaille -ENTRYPOINT ["flask", "run", "--host=0.0.0.0"] +RUN poetry install + +ENTRYPOINT ["poetry", "run", "flask", "run", "--host=0.0.0.0"] diff --git a/demo/Dockerfile-client b/demo/Dockerfile-client index d340d649..e51917d8 100644 --- a/demo/Dockerfile-client +++ b/demo/Dockerfile-client @@ -5,8 +5,8 @@ RUN \ apt -y upgrade RUN pip install \ - flask \ - "authlib<1.0.0" \ + "flask<3" \ + "authlib<2" \ requests WORKDIR /opt/client diff --git a/demo/Procfile b/demo/Procfile index 3d382797..5f7ff816 100644 --- a/demo/Procfile +++ b/demo/Procfile @@ -1,4 +1,4 @@ slapd: ./slapd.sh -canaille: env AUTHLIB_INSECURE_TRANSPORT=1 FLASK_ENV=development CONFIG=conf/canaille.toml FLASK_APP=../../canaille env/bin/flask run --extra-files conf/canaille.toml -client1: env FLASK_ENV=development CONFIG=../conf/client1.cfg FLASK_APP=client env/bin/flask run --port=5001 -client2: env FLASK_ENV=development CONFIG=../conf/client2.cfg FLASK_APP=client env/bin/flask run --port=5002 +canaille: env AUTHLIB_INSECURE_TRANSPORT=1 FLASK_ENV=development CONFIG=conf/canaille.toml FLASK_APP=../../canaille flask run --extra-files conf/canaille.toml +client1: env FLASK_ENV=development CONFIG=../conf/client1.cfg FLASK_APP=client flask run --port=5001 +client2: env FLASK_ENV=development CONFIG=../conf/client2.cfg FLASK_APP=client flask run --port=5002 diff --git a/demo/run.sh b/demo/run.sh index ee849ae4..f4dded77 100755 --- a/demo/run.sh +++ b/demo/run.sh @@ -17,22 +17,23 @@ function run { return 1 fi - if ! test -d "$DIR/env"; then - { - virtualenv "$DIR/env" && - "$DIR/env/bin/pip" install --editable "$DIR/.." && - "$DIR/env/bin/pip" install honcho requests slapd - } || rm --recursive --force "$DIR/env" + if ! type poetry > /dev/null 2>&1; then + echo "Cannot start the LDAP server. Please install python on your system." + echo "https://python-poetry.org/docs/#installation" + return 1 fi + poetry install + poetry run pip install honcho requests slapd + if [ "$1" == "--ldap-native" ]; then - env "SLAPD_BINARY=NATIVE" "PWD=$DIR" "$DIR/env/bin/honcho" start + env "SLAPD_BINARY=NATIVE" "PWD=$DIR" poetry run honcho start elif [ "$1" == "--ldap-docker" ]; then - env "SLAPD_BINARY=DOCKER" "PWD=$DIR" "$DIR/env/bin/honcho" start + env "SLAPD_BINARY=DOCKER" "PWD=$DIR" poetry run honcho start else - env "PWD=$DIR" "$DIR/env/bin/honcho" start + env "PWD=$DIR" poetry run honcho start fi } diff --git a/demo/slapd.sh b/demo/slapd.sh index b9cfeccf..ee65fd4f 100755 --- a/demo/slapd.sh +++ b/demo/slapd.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ "$SLAPD_BINARY" == "NATIVE" ] || ([ "$SLAPD_BINARY" == "" ] && type slapd > /dev/null 2>&1); then - env BIN=$BIN:/usr/bin:/usr/sbin env/bin/python ldap-server.py + env BIN=$BIN:/usr/bin:/usr/sbin python ldap-server.py elif [ "$SLAPD_BINARY" == "DOCKER" ] || ([ "$SLAPD_BINARY" == "" ] && type docker-compose > /dev/null 2>&1); then docker-compose run --service-ports --rm ldap