Skip to content

Commit 4ec113a

Browse files
authored
Poetry (#179)
* dependency mangmtn migrated to poetry * readme: intro * chore: removed requirements.txt * fix: packaging dep in CI * fix: dep in setup * chore: poetry update * fix: CI workaround poetry/pip * fix: CI workaround poetry/pip spid_sp_test * fix: remove sd-jwt from poetry lock * fix: CI with spid sp test bin env * fix: static venv using poetry * dockerfile updated, poetry and alpine * fix: dockerfile build * docker compose with build * fix: poetry migrations and several general projects dependency and configurations
1 parent 243c018 commit 4ec113a

16 files changed

+2567
-134
lines changed

.dockerignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
!example_sp
66
!requirements.txt
77
!oids.conf
8-
!build_spid_certs.sh
8+
!build_spid_certs.sh
9+
!pyproject.toml
10+
!poetry.lock

.github/workflows/python-app.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: iam-proxy-italia
55

66
on:
77
push:
8-
branches: [ master, dev, eudi ]
8+
branches: [ master, dev ]
99
pull_request:
10-
branches: [ master, dev, eudi ]
10+
branches: [ master, dev ]
1111

1212
jobs:
1313
build:
@@ -30,11 +30,15 @@ jobs:
3030
python-version: ${{ matrix.python-version }}
3131
- name: Install Python dependencies
3232
run: |
33-
pip install spid-sp-test>=1.2.17
34-
pip install flake8
33+
pip install --upgrade pip
34+
pip install flake8 pipx poetry
35+
pip install --upgrade packaging
36+
poetry install
37+
source $(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin/activate
38+
pip install "spid-sp-test>=1.2.17"
3539
- name: Ispect Python dependencies
3640
run: |
37-
pip list
41+
poetry show --tree
3842
- name: Lint with flake8
3943
run: |
4044
## stop the build if there are Python syntax errors or undefined names
@@ -65,13 +69,19 @@ jobs:
6569
- name: spid-sp-test SPID metadata, requests and responses
6670
run: |
6771
cd Docker-compose/satosa-project
72+
source $(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin/activate
73+
export PATH=$PATH:$(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin
6874
spid_sp_test --idp-metadata > metadata/idp/spid-sp-test.xml
6975
spid_sp_test --metadata-url https://localhost/spidSaml2/metadata --authn-url "http://localhost:8000/saml2/login/?idp=https://localhost/Saml2IDP/metadata&next=/saml2/echo_attributes&idphint=https%253A%252F%252Flocalhost%253A8443" -ap spid_sp_test.plugins.authn_request.SatosaSaml2Spid --extra --debug ERROR -tr
7076
- name: spid-sp-test CIE id metadata
7177
run: |
7278
cd Docker-compose/satosa-project
79+
source $(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin/activate
80+
export PATH=$PATH:$(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin
7381
spid_sp_test --profile cie-sp-public --metadata-url https://localhost/cieSaml2/metadata
7482
- name: spid-sp-test eIDAS FiCEP metadata
7583
run: |
7684
cd Docker-compose/satosa-project
85+
source $(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin/activate
86+
export PATH=$PATH:$(poetry env info | grep -m1 Path | awk -F" " {'print $2'})/bin
7787
spid_sp_test --profile ficep-eidas-sp --metadata-url https://localhost/spidSaml2/metadata

Docker-compose/docker-compose.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ services:
6161
- iam-proxy-italia
6262

6363
iam-proxy-italia:
64-
image: ghcr.io/italia/iam-proxy-italia:latest
64+
#image: ghcr.io/italia/iam-proxy-italia:latest
6565
#image: iam-proxy-italia:latest
66-
#build:
67-
# context: ../
68-
# args:
69-
# - NODE_ENV=local
70-
# dockerfile: Dockerfile
66+
build:
67+
context: ../
68+
args:
69+
- NODE_ENV=local
70+
dockerfile: Dockerfile
7171
container_name: iam-proxy-italia
7272
# depends_on:
7373
# - satosa-mongo

Docker-compose/run-docker-compose.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function update {
3636
docker compose -f docker-compose.yml down -v
3737
echo -e "\n"
3838
echo -e "Tiro su la composizione, in caso, con le nuove versioni delle immagini. \n"
39-
docker compose -f docker-compose.yml build django_sp
39+
docker compose -f docker-compose.yml build django_sp
4040
fi
4141
}
4242

Dockerfile

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.20
1+
FROM alpine:3.21.2
22

33
# Metadata params
44
ARG BUILD_DATE
@@ -18,19 +18,24 @@ LABEL org.opencontainers.image.authors=$AUTHORS \
1818
org.opencontainers.image.revision=$VCS_REF \
1919
org.opencontainers.image.description="Docker Image di iam-proxy-italia."
2020

21-
COPY requirements.txt /
22-
2321
ENV BASEDIR="/satosa_proxy"
22+
RUN mkdir $BASEDIR
23+
24+
RUN addgroup -S satosa && adduser -S satosa -G satosa && chown satosa:satosa $BASEDIR
2425

2526
# "tzdata" package is required to set timezone with TZ environment
2627
# "mailcap" package is required to add mimetype support
27-
RUN apk add --update --no-cache tzdata mailcap xmlsec libffi-dev openssl-dev python3 py3-pip python3-dev procps git openssl build-base gcc wget bash jq yq-go pcre-dev
28-
29-
RUN python3 -m venv .venv && . .venv/bin/activate && pip3 install --upgrade pip setuptools \
30-
&& pip3 install -r requirements.txt --ignore-installed --root-user-action=ignore && mkdir $BASEDIR \
31-
&& addgroup -S satosa && adduser -S satosa -G satosa \
32-
&& chown satosa:satosa $BASEDIR
33-
34-
RUN pip list
28+
RUN apk add --update --no-cache tzdata mailcap xmlsec libffi-dev openssl-dev python3-dev py3-pip openssl build-base gcc wget bash pcre-dev
29+
30+
COPY poetry.lock /
31+
COPY pyproject.toml /
32+
33+
RUN python3 -m venv .venv && . .venv/bin/activate
34+
RUN pip3 install --upgrade pip --break-system-packages
35+
RUN pip3 install flake8 pipx poetry --break-system-packages
36+
RUN poetry self update
37+
RUN poetry config virtualenvs.in-project true
38+
RUN poetry install
39+
RUN poetry add setuptools
3540

3641
WORKDIR $BASEDIR/

README-Setup.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,20 @@ Within the directory `/{your path}/iam-proxy-italia` execute the following comma
2828

2929
```
3030
pip install --upgrade pip
31-
pip install virtualenv
31+
pip install flake8 pipx poetry
32+
pip install --upgrade packaging
33+
poetry config virtualenvs.in-project true
34+
poetry install
35+
source .venv/bin/activate
36+
pip install "spid-sp-test>=1.2.17"
3237
3338
mkdir satosa_proxy && cd satosa_proxy
34-
virtualenv -ppython3 satosa.env
35-
source satosa.env/bin/activate
3639
3740
git clone https://github.com/italia/iam-proxy-italia.git repository
3841
cd repository
39-
pip install -r requirements.txt
42+
43+
poetry install
44+
poetry env info
4045
```
4146

4247
## Configure the Proxy
@@ -64,7 +69,6 @@ Remember to:
6469
This project uses [SATOSA_oidcop](https://github.com/UniversitaDellaCalabria/SATOSA-oidcop) as OAuth2/OIDC frontend module.
6570
Comment/uncomment the following statement in the proxy_configuration to enable it.
6671

67-
https://github.com/italia/iam-proxy-italia/blob/oidcop/example/proxy_conf.yaml#L32
6872

6973
### Configuration by environment variables
7074

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# IAM Proxy Italia
22

3-
IAM Proxy Italia is the SAML2/OIDC IAM Proxy based on [SATOSA](https://github.com/IdentityPython/SATOSA)
4-
for **SAML-to-SAML**, **OIDC-to-SAML**, **SAML-to-Wallet** and **OIDC-to-Wallet** interoperability
3+
IAM Proxy Italia is the distribution of the [SATOSA](https://github.com/IdentityPython/SATOSA) SAML2/OIDC IAM Proxy allowing
4+
**SAML-to-SAML**, **OIDC-to-SAML**, **SAML-to-Wallet** and **OIDC-to-Wallet** interoperability
55
with the **Italian Digital Identity Systems**.
66

77
## Table of Contents

example/entrypoint.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if [[ $GET_IDEM_MDQ_KEY == true ]]; then
1111
wget $REMOTE_DATA_LOCATION
1212
status=$?
1313
while [[ $status != 0 && $MAX_RETRY -gt 0 ]]; do
14-
echo "Retrying download from registry.spid.gov.it..."
14+
echo "Retrying download from registry.spid.gov.it ..."
1515
wget $REMOTE_DATA_LOCATION
1616
status=$?
1717
MAX_RETRY=$((MAX_RETRY-1))
@@ -25,6 +25,8 @@ if [[ $GET_IDEM_MDQ_KEY == true ]]; then
2525
echo "Downloaded IDEM MDQ key"
2626
fi
2727

28+
poetry show
29+
2830
wsgi_file=/.venv/lib/$(python -c 'import sys; print(f"python{sys.version_info.major}.{sys.version_info.minor}")')/site-packages/satosa/wsgi.py
2931
wsgi_cmd="uwsgi --ini /satosa_proxy/uwsgi_setup/uwsgi/uwsgi.ini.docker --wsgi-file $wsgi_file"
3032
if [[ $SATOSA_DEBUG == true ]]; then

0 commit comments

Comments
 (0)