Skip to content

Commit

Permalink
chore: improved documentation for smart developers (#181)
Browse files Browse the repository at this point in the history
* chore: improved documentation for smart developers

* chore: improved documentation for smart developers
  • Loading branch information
peppelinux authored Jan 27, 2025
1 parent 1572e34 commit 243c018
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ services:
tty: ${SATOSA_DEBUG:-false} # enables PDB when attach to the compose
environment:
- TZ=${TZ:-Europe/Rome}
- SATOSA_DEBUG=${SATOSA_DEBUG:-false}
- SATOSA_BY_DOCKER=1
- GET_IDEM_MDQ_KEY=${GET_IDEM_MDQ_KEY:-true}

Expand Down Expand Up @@ -122,6 +123,7 @@ services:
- "10000:10000"
volumes:
- ./satosa-project:/satosa_proxy:rwx
# - ./eudi-wallet-it-python/pyeudiw:/.venv/lib/python3.12/site-packages/pyeudiw:rwx
# - iam-proxy-italia-data:/satosa_proxy # to be used for external volumes
working_dir: /satosa_proxy
entrypoint: "sh entrypoint.sh"
Expand Down
43 changes: 36 additions & 7 deletions README-Python-Dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Developing a Python dependency of this project
# Developing a Python package for this project

This document contains a suggested approach on how to develop or modify a Python library that uses the current project Docker as a test or develop environment.
This document contains a smart approach about how to develop or modify a Python library that uses the current project Docker as a test or develop environment.
For example, those instructions can be used to create a developer environment for further development of [eudi-wallet-it-python](https://github.com/italia/eudi-wallet-it-python).
The instructions below are intended to be a suggestion or a guideline rather than a standard.

Expand All @@ -21,6 +21,7 @@ In the file [docker-compose.yml](Docker-example/docker-compose.yml), among the v
volumes:
- /home/username/my/development/folder/eudi-wallet-it-python/pyeudiw:/.venv/lib/python3.12/site-packages/pyeudiw:rw

Please note that `python3.12/` may vary depending new versions of the project.
This will replace the installed dependency package with your own local code.

**NOTE:** at the time of writing, container volume is binded to the location `/.venv/lib/python3.12/site-packages`, but your location might be different as it always reference the Python version that is awailable in the container, which in this case is `Python3.12`. Check che actual python version of your container before completing with this step.
Expand Down Expand Up @@ -50,7 +51,34 @@ The following steps instructs on how to install a new pip dependency to an exist

At the end of the procedure, you will find the required dependency as part of your container.

### Options 4.2: Create a new image Dockerfile
### Option 4.2: mount a volume containing your dev package

Instead of installing by hand a new package and commit the change on the container,
you can stop the container, mount the path of your package and restart the container.

This enables fast updates to your code, that would only require the respawn of the uwsgi process:

- restart iam-proxy-italia container
- respawn process by touching the uwsgi respawn file through an attached shell

This can be easily achieved by doing a configuration like the one below,
in the documer compose section about the container iam-proxy-italia

````
volumes:
- ./satosa-project:/satosa_proxy:rwx
- /home/User/Dev/eudi-wallet-it-python/pyeudiw:/.venv/lib/python3.12/site-packages/pyeudiw:rwx
````

If you might not see the changes in realtime, you shoud `down` the compose and do an `up`.

````
docker compose down
# ...
docker compose up
````

### Option 4.3: Create a new image Dockerfile

The following steps instruct on how to create a new image with the new required python dependency. This new image will be the base of the updated container.

Expand All @@ -69,8 +97,9 @@ The following steps instruct on how to create a new image with the new required

## Step 5 (Optional): Insert a breakpoint to check that your setting is working as intended

1. Stop the container `docker stop iam-proxy-italia`.
2. Add the line `breakpoint()` to a file of that package eudi-wallet-it-python that requires investigation.
3. Start the container `docker start iam-proxy-italia`.
1. Add the line `breakpoint()` to a file of that package eudi-wallet-it-python that requires investigation.
2. restart the iam-proxy-italia container (`docker stop iam-proxy-italia && docker start iam-proxy-italia`.) or touch the uwsgi reload file within the running container: `touch /satosa_proxy/proxy_conf.yaml`

If everything worked as intended, the program execution should stop at the given `breakpoint()`. To further investigate the state of the program at the time it was stopped, you can use the command `docker attach iam-proxy-italia` in a new terminal.
If everything worked as intended, the program execution should stop at the given `breakpoint()`.
To further investigate the state of the program at the time it was stopped,
you can use the command `docker attach iam-proxy-italia` in a new terminal.

0 comments on commit 243c018

Please sign in to comment.