docker demo initial data pythonic loading

This commit is contained in:
Éloi Rivard 2023-05-19 15:53:56 +02:00
parent 4f0381e9e8
commit 0992bec5b1
4 changed files with 6 additions and 54 deletions

View file

@ -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

View file

@ -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
@ -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

View file

@ -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
@ -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

View file

@ -1,48 +0,0 @@
dn: oauthClientID=1JGkkzCbeHpGtlqgI5EENByf,ou=clients,ou=oauth,dc=mydomain,dc=tld
objectclass: oauthClient
oauthClientID: 1JGkkzCbeHpGtlqgI5EENByf
oauthClientSecret: 2xYPSReTQRmGG1yppMVZQ0ASXwFejPyirvuPbKhNa6TmKC5x
oauthClientName: Client1
oauthClientContact: admin@mydomain.tld
oauthClientURI: http://localhost:5001
oauthRedirectURIs: http://localhost:5001/authorize
oauthPostLogoutRedirectURI: http://localhost:5001/
oauthTermsOfServiceURI: http://localhost:5001/tos
oauthPolicyURI: http://localhost:5001/policy
oauthGrantType: authorization_code
oauthGrantType: refresh_token
oauthScope: openid
oauthScope: profile
oauthScope: email
oauthScope: groups
oauthScope: address
oauthScope: phone
oauthResponseType: code
oauthResponseType: id_token
oauthTokenEndpointAuthMethod: client_secret_basic
oauthAudience: oauthClientID=1JGkkzCbeHpGtlqgI5EENByf,ou=clients,ou=oauth,dc=mydomain,dc=tld
dn: oauthClientID=gn4yFN7GDykL7QP8v8gS9YfV,ou=clients,ou=oauth,dc=mydomain,dc=tld
objectclass: oauthClient
oauthClientID: gn4yFN7GDykL7QP8v8gS9YfV
oauthClientSecret: ouFJE5WpICt6hxTyf8icXPeeklMektMY4gV0Rmf3aY60VElA
oauthClientName: Client2
oauthClientContact: admin@mydomain.tld
oauthClientURI: http://localhost:5002
oauthRedirectURIs: http://localhost:5002/authorize
oauthPostLogoutRedirectURI: http://localhost:5002/
oauthTermsOfServiceURI: http://localhost:5002/tos
oauthPolicyURI: http://localhost:5002/policy
oauthGrantType: authorization_code
oauthGrantType: refresh_token
oauthScope: openid
oauthScope: profile
oauthScope: email
oauthScope: groups
oauthScope: address
oauthScope: phone
oauthResponseType: code
oauthResponseType: id_token
oauthTokenEndpointAuthMethod: client_secret_basic
oauthAudience: oauthClientID=gn4yFN7GDykL7QP8v8gS9YfV,ou=clients,ou=oauth,dc=mydomain,dc=tld
oauthPreconsent: TRUE