Fixed some packaging issues

This commit is contained in:
Éloi Rivard 2022-03-08 19:22:52 +01:00
parent 650a9ab99d
commit 07d1826905
9 changed files with 20 additions and 15 deletions

View file

@ -1,7 +1,6 @@
include schemas/*
include canaille/conf/*.sample.*
graft canaille/ldap_backend/schemas
graft canaille/templates
graft canaille/themes
graft canaille/translations
graft canaille/static
exclude tests/*

View file

@ -71,7 +71,7 @@ def setup_keypair(config):
def setup_schemas(config):
with open("schemas/oauth2-openldap.ldif") as fd:
with open("canaille/ldap_backend/schemas/oauth2-openldap.ldif") as fd:
parser = ldif.LDIFRecordList(fd)
parser.parse()

View file

@ -8,7 +8,7 @@ services:
- LDAP_DOMAIN=mydomain.tld
volumes:
- ./ldif/bootstrap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-boostrap.ldif:ro
- ../schemas/oauth2-openldap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/40-oauth2.ldif:ro
- ../canaille/ldap_backend/schemas/oauth2-openldap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/40-oauth2.ldif:ro
command: --copy-service --loglevel debug
ports:
- 5389:389

View file

@ -14,7 +14,7 @@ slapd = slapd.Slapd(
"cosine.ldif",
"nis.ldif",
"inetorgperson.ldif",
"../schemas/oauth2-openldap.ldif",
"../canaille/ldap_backend/schemas/oauth2-openldap.ldif",
"ldif/memberof.ldif",
),
)

View file

@ -33,8 +33,8 @@ Choose a path where to store your configuration file. You can pass any configura
export CANAILLE_CONF_DIR=/etc/canaille
git clone https://gitlab.com/yaal/canaille.git ~/canaille
sudo mkdir --parents "$CANAILLE_CONF_DIR"
sudo cp ~/canaille/conf/config.sample.toml "$CANAILLE_CONF_DIR/config.toml"
sudo cp ~/canaille/conf/openid-configuration.sample.json "$CANAILLE_CONF_DIR/openid-configuration.json"
sudo cp /opt/canaille/env/lib/python*/site-packages/canaille/conf/config.sample.toml "$CANAILLE_CONF_DIR/config.toml"
sudo cp /opt/canaille/env/lib/python*/site-packages/canaille/conf/openid-configuration.sample.json "$CANAILLE_CONF_DIR/openid-configuration.json"
You should then edit your configuration file to adapt the values to your needs.
@ -69,8 +69,8 @@ Old fashion: Copy the schemas in your filesystem
""""""""""""""""""""""""""""""""""""""""""""""""
.. code-block:: console
test -d /etc/openldap/schema && sudo cp ~/canaille/schemas/* /etc/openldap/schema
test -d /etc/ldap/schema && sudo cp ~/canaille/schemas/* /etc/ldap/schema
test -d /etc/openldap/schema && sudo cp /opt/canaille/env/lib/python*/site-packages/canaille/schemas/* /etc/openldap/schema
test -d /etc/ldap/schema && sudo cp /opt/canaille/env/lib/python*/site-packages/canaille/schemas/* /etc/ldap/schema
sudo service slapd restart
New fashion: Use slapadd to add the schemas
@ -81,7 +81,7 @@ Be careful to stop your ldap server before running ``slapadd``
.. code-block:: console
sudo service slapd stop
sudo -u openldap slapadd -n0 -l ~/canaille/schemas/*.ldif
sudo -u openldap slapadd -n0 -l /opt/canaille/env/lib/python*/site-packages/canaille/schemas/*.ldif
sudo service slapd start
Generate the key pair
@ -117,7 +117,7 @@ uwsgi
[uwsgi]
virtualenv=/opt/canaille/env
socket=/opt/canaille/conf/uwsgi.sock
socket=/etc/canaille/uwsgi.sock
plugin=python3
module=canaille:create_app()
lazy-apps=true
@ -126,7 +126,7 @@ uwsgi
threads=10
need-app=true
thunder-lock=true
touch-chain-reload=/opt/canaille/conf/uwsgi-reload.fifo
touch-chain-reload=/etc/canaille/uwsgi-reload.fifo
enable-threads=true
reload-on-rss=1024
worker-reload-mercy=600
@ -202,7 +202,7 @@ Nginx
location / {
include uwsgi_params;
uwsgi_pass unix:/opt/canaille/config/uwsgi.sock;
uwsgi_pass unix:/etc/canaille/uwsgi.sock;
}
}

View file

@ -41,6 +41,9 @@ install_requires =
[options.packages.find]
exclude =
tests
tests.*
doc
doc.*
[options.entry_points]
console_scripts =

View file

@ -23,13 +23,16 @@ class CustomSlapdObject(slapd.Slapd):
"cosine.ldif",
"nis.ldif",
"inetorgperson.ldif",
"schemas/oauth2-openldap.ldif",
"canaille/ldap_backend/schemas/oauth2-openldap.ldif",
)
)
def _ln_schema_files(self, *args, **kwargs):
dir_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "schemas"
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
"canaille",
"ldap_backend",
"schemas",
)
super()._ln_schema_files(*args, **kwargs)
super()._ln_schema_files(self.custom_schema_files, dir_path)