forked from Github-Mirrors/canaille
The demo now uses poetry
This commit is contained in:
parent
9e529c97c6
commit
38401005e7
5 changed files with 21 additions and 19 deletions
|
@ -9,8 +9,9 @@ RUN \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libssl-dev
|
libssl-dev
|
||||||
|
|
||||||
COPY setup.cfg setup.py /opt/canaille/
|
COPY poetry.lock pyproject.toml /opt/canaille/
|
||||||
RUN pip install --editable /opt/canaille
|
RUN pip install poetry
|
||||||
|
|
||||||
WORKDIR /opt/canaille
|
WORKDIR /opt/canaille
|
||||||
ENTRYPOINT ["flask", "run", "--host=0.0.0.0"]
|
RUN poetry install
|
||||||
|
|
||||||
|
ENTRYPOINT ["poetry", "run", "flask", "run", "--host=0.0.0.0"]
|
||||||
|
|
|
@ -5,8 +5,8 @@ RUN \
|
||||||
apt -y upgrade
|
apt -y upgrade
|
||||||
|
|
||||||
RUN pip install \
|
RUN pip install \
|
||||||
flask \
|
"flask<3" \
|
||||||
"authlib<1.0.0" \
|
"authlib<2" \
|
||||||
requests
|
requests
|
||||||
|
|
||||||
WORKDIR /opt/client
|
WORKDIR /opt/client
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
slapd: ./slapd.sh
|
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
|
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 env/bin/flask run --port=5001
|
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 env/bin/flask run --port=5002
|
client2: env FLASK_ENV=development CONFIG=../conf/client2.cfg FLASK_APP=client flask run --port=5002
|
||||||
|
|
19
demo/run.sh
19
demo/run.sh
|
@ -17,22 +17,23 @@ function run {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -d "$DIR/env"; then
|
if ! type poetry > /dev/null 2>&1; then
|
||||||
{
|
echo "Cannot start the LDAP server. Please install python on your system."
|
||||||
virtualenv "$DIR/env" &&
|
echo "https://python-poetry.org/docs/#installation"
|
||||||
"$DIR/env/bin/pip" install --editable "$DIR/.." &&
|
return 1
|
||||||
"$DIR/env/bin/pip" install honcho requests slapd
|
|
||||||
} || rm --recursive --force "$DIR/env"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
poetry install
|
||||||
|
poetry run pip install honcho requests slapd
|
||||||
|
|
||||||
if [ "$1" == "--ldap-native" ]; then
|
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
|
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
|
else
|
||||||
env "PWD=$DIR" "$DIR/env/bin/honcho" start
|
env "PWD=$DIR" poetry run honcho start
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$SLAPD_BINARY" == "NATIVE" ] || ([ "$SLAPD_BINARY" == "" ] && type slapd > /dev/null 2>&1); then
|
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
|
elif [ "$SLAPD_BINARY" == "DOCKER" ] || ([ "$SLAPD_BINARY" == "" ] && type docker-compose > /dev/null 2>&1); then
|
||||||
docker-compose run --service-ports --rm ldap
|
docker-compose run --service-ports --rm ldap
|
||||||
|
|
Loading…
Reference in a new issue