Skip to content

Commit 080b5a3

Browse files
committed
Merge branch '59-provide-a-docker-image' into 'main'
Provide a docker image Closes #59 See merge request yaal/canaille!236
2 parents 0898736 + 6709a21 commit 080b5a3

File tree

5 files changed

+150
-5
lines changed

5 files changed

+150
-5
lines changed

CHANGES.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
Added
55
^^^^^
6-
6+
- Instructions in CONTRIBUTING.rst to update the docker image :issue:`59`
7+
- Instructions in README.md to discover Canaille interface with a docker image :issue:`59`
78
- The :ref:`cli dump <cli_dump>` command can dump only some given models.
89

910
Fixed

CONTRIBUTING.rst

+42
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,47 @@ Documentation translation
222222

223223
.. include:: ../locales/readme.rst
224224

225+
Production Docker image
226+
-----------------------
227+
228+
Build
229+
~~~~~
230+
231+
The ``nix-build`` command is needed to create the Canaille Docker image.
232+
Follow the `NixOS documentation instructions <https://nix.dev/manual/nix/stable/installation/installing-binary>`__ to install it on your system.
233+
234+
The Docker image can be built with the following command:
235+
236+
.. code-block:: bash
237+
238+
docker load < $(nix-build --no-out-link canaille.nix)
239+
240+
Check the Docker image with the following command:
241+
242+
.. code-block:: bash
243+
244+
docker run -it -p 5000:5000 canaille:latest
245+
246+
Publish
247+
~~~~~~~
248+
249+
.. code-block:: bash
250+
251+
export CANAILLE_VERSION=$(python -c "from importlib.metadata import version; print(version('canaille'))")
252+
docker tag canaille:latest "yaalcoop/canaille:latest"
253+
docker tag canaille:latest "yaalcoop/canaille:${CANAILLE_VERSION}"
254+
255+
docker login --username <hub docker login>
256+
docker push yaalcoop/canaille:latest
257+
docker push yaalcoop/canaille:${CANAILLE_VERSION}
258+
259+
Use
260+
~~~
261+
262+
.. code-block:: bash
263+
264+
docker pull yaalcoop/canaille:latest
265+
225266
Build a release
226267
---------------
227268

@@ -262,3 +303,4 @@ Publish a new release
262303
13. Publish the Python package on production PyPI ``uv publish``;
263304
14. Tag the commit with ``git tag XX.YY.ZZ``;
264305
15. Push the release commit and the new tag on the repository with ``git push --tags``.
306+
16. Try to :ref:`pull and run the docker image of Canaille <development/contributing:Production Docker image>` and update the ``canaille.nix`` file if necessary.

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ as in *Can I access your data?* Canaille is a lightweight identity and authoriza
88
It aims to be very light, simple to install and simple to maintain. Its main features are :
99
- User profile and groups management;
1010
- Authentication, registration, email confirmation, "I forgot my password" emails;
11-
- Authorization management with [OpenID Connect identity](https://openid.net/developers/how-connect-works);
11+
- Authorization management with [OpenID Connect](https://openid.net/developers/how-connect-works) identity;
1212
- Provisioning with [SCIM](https://scim.libre.sh);
1313
- postgresql, mariadb and OpenLDAP first-class citizenship;
1414
- Customizable, themable;
@@ -20,10 +20,12 @@ It aims to be very light, simple to install and simple to maintain. Its main fea
2020

2121
```bash
2222
git clone https://gitlab.com/yaal/canaille.git && cd canaille
23-
# Either run the demo locally
23+
24+
# Either run the development server
2425
uv sync --all-extras --group demo && uv run devserver
25-
# or run the demo in docker
26-
docker compose --file demo/docker-compose-sql.yml up
26+
27+
# or run the Docker image
28+
docker run -it -p 5000:5000 yaalcoop/canaille:latest
2729
```
2830

2931
## Online!

canaille.nix

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{ pkgs ? import <nixpkgs> {} }:
2+
3+
pkgs.dockerTools.buildImage {
4+
name = "canaille";
5+
tag = "latest";
6+
7+
copyToRoot = pkgs.buildEnv {
8+
name = "canaille-env";
9+
paths = [
10+
pkgs.bashInteractive
11+
pkgs.python3
12+
pkgs.python3Packages.setuptools
13+
pkgs.python3Packages.pip
14+
pkgs.coreutils-full
15+
];
16+
};
17+
18+
config = {
19+
Cmd = [
20+
"/bin/sh"
21+
"-c"
22+
"
23+
python3 -m venv /opt/canaille/venv && \
24+
. /opt/canaille/venv/bin/activate && \
25+
pip install canaille[front,oidc,postgresql,server,otp,sms,scim] && \
26+
mkdir -p /opt/canaille && \
27+
echo 'bind = [\"0.0.0.0:5000\"]' > /opt/canaille/hypercorn.toml && \
28+
echo '
29+
SERVER_NAME = \"canaille.localhost:5000\"\n
30+
PREFERRED_URL_SCHEME = \"https\"\n
31+
[CANAILLE]\n
32+
LOGO = \"/static/img/canaille-head.webp\"\n
33+
FAVICON = \"/static/img/canaille-c.webp\"\n
34+
ENABLE_REGISTRATION = 1\n
35+
ADMIN_EMAIL = \"[email protected]\"\n
36+
TIMEZONE = \"UTC\"\n
37+
[CANAILLE_SQL]\n
38+
DATABASE_URI = \"sqlite:///demo.sqlite\"\n
39+
[CANAILLE.ACL.DEFAULT]\n
40+
PERMISSIONS = [\"edit_self\", \"use_oidc\"]\n
41+
READ = [
42+
\"user_name\",
43+
\"groups\",
44+
\"lock_date\",
45+
]\n
46+
WRITE = [
47+
\"photo\",
48+
\"given_name\",
49+
\"family_name\",
50+
\"display_name\",
51+
\"password\",
52+
\"phone_numbers\",
53+
\"emails\",
54+
\"profile_url\",
55+
\"formatted_address\",
56+
\"street\",
57+
\"postal_code\",
58+
\"locality\",
59+
\"region\",
60+
\"preferred_language\",
61+
\"employee_number\",
62+
\"department\",
63+
\"title\",
64+
\"organization\",
65+
]\n
66+
[CANAILLE.ACL.ADMIN]\n
67+
FILTER = {groups = \"admins\"}\n
68+
PERMISSIONS = [
69+
\"manage_users\",
70+
\"manage_groups\",
71+
\"manage_oidc\",
72+
\"delete_account\",
73+
\"impersonate_users\",
74+
]\n
75+
WRITE = [
76+
\"groups\",
77+
\"lock_date\",
78+
]\n
79+
[CANAILLE.ACL.HALF_ADMIN]\n
80+
FILTER = {groups = \"moderators\"}\n
81+
PERMISSIONS = [\"manage_users\", \"manage_groups\", \"delete_account\"]\n
82+
WRITE = [\"groups\"]\n
83+
' > /opt/canaille/config.toml && \
84+
export CONFIG=/opt/canaille/config.toml && \
85+
canaille db upgrade && \
86+
canaille create user --user-name admin --password admin --emails [email protected] --given-name George --family-name Abitbol && \
87+
canaille create group --display-name admins --members admin && \
88+
canaille run --config /opt/canaille/hypercorn.toml
89+
"
90+
];
91+
};
92+
}

doc/tutorial/install.rst

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ This page describes how to get and set-up Canaille.
1919
Get the code
2020
============
2121

22+
Docker image
23+
------------
24+
25+
A Docker image is available:
26+
27+
docker pull yaalcoop/canaille:latest
28+
docker run -it -p 5000:5000 yaalcoop/canaille:latest
29+
2230
Binaries
2331
--------
2432

0 commit comments

Comments
 (0)