Skip to content

Commit

Permalink
docker demo initial data pythonic loading
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed May 19, 2023
1 parent 4f0381e commit 0992bec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 54 deletions.
2 changes: 1 addition & 1 deletion demo/Dockerfile-canaille
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN \
libldap2-dev \
libssl-dev

COPY poetry.lock pyproject.toml /opt/canaille/
COPY poetry.lock pyproject.toml demo/demoapp.py /opt/canaille/
RUN pip install poetry
WORKDIR /opt/canaille
RUN poetry install --with demo --without dev
Expand Down
6 changes: 4 additions & 2 deletions demo/demoapp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import sys


sys.path.append("../canaille")
if os.path.exists("../canaille"):
sys.path.append("../canaille")


from canaille import create_app as canaille_app
Expand All @@ -11,7 +13,7 @@ def create_app():
app = canaille_app()

@app.before_first_request
def yolo():
def populate():
from canaille.backends.ldap.backend import setup_backend
from canaille.backends.ldap.backend import teardown_backend
from canaille.core.models import Group
Expand Down
4 changes: 1 addition & 3 deletions demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ services:
- ../canaille/backends/ldap/schemas/oauth2-openldap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/40-oauth2.ldif:ro
- ./ldif/bootstrap-users-tree.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-bootstrap-users-tree.ldif:ro
- ./ldif/bootstrap-oidc-tree.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-bootstrap-oidc-tree.ldif:ro
- ./ldif/bootstrap-users.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/60-bootstrap-users.ldif:ro
- ./ldif/bootstrap-oidc.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/70-bootstrap-oidc.ldif:ro
command: --copy-service --loglevel debug
ports:
- 5389:389
Expand All @@ -31,7 +29,7 @@ services:
- AUTHLIB_INSECURE_TRANSPORT=1
- FLASK_DEBUG=1
- CONFIG=/opt/canaille/conf/canaille.toml
- FLASK_APP=canaille
- FLASK_APP=demoapp
volumes:
- ../canaille:/opt/canaille/canaille
- ./conf-docker:/opt/canaille/conf
Expand Down
48 changes: 0 additions & 48 deletions demo/ldif/bootstrap-oidc.ldif

This file was deleted.

0 comments on commit 0992bec

Please sign in to comment.