Skip to content

Commit

Permalink
update compose with iam-proxy-italia naming (#178)
Browse files Browse the repository at this point in the history
* update compose with iam-proxy-italia naming

* fix: pending iam-proxy-italia labels and names

* fix: iam-proxy-italia replaces every satosa-saml2spid occurency
  • Loading branch information
peppelinux authored Jan 23, 2025
1 parent 37fae2c commit 99ef10e
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 165 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Satosa-Saml2Spid
name: iam-proxy-italia

on:
push:
Expand Down Expand Up @@ -54,14 +54,14 @@ jobs:
cat Docker-compose/satosa-project/metadata/sp/djangosaml2_sp.xml
- name: Inspect Satosa status
run: |
docker container inspect satosa-saml2spid
docker container logs satosa-saml2spid
docker container inspect iam-proxy-italia
docker container logs iam-proxy-italia
- name: Copy Satosa IDP Metadata to djangosaml2 SP
run: |
wget -vd --no-check-certificate https://localhost/Saml2IDP/metadata -O Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/satosa-saml2spid.xml
wget -vd --no-check-certificate https://localhost/Saml2IDP/metadata -O Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/iam-proxy-italia.xml
- name: Inspect Satosa IDP Metadata
run: |
cat Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/satosa-saml2spid.xml
cat Docker-compose/djangosaml2_sp/saml2_sp/saml2_config/iam-proxy-italia.xml
- name: spid-sp-test SPID metadata, requests and responses
run: |
cd Docker-compose/satosa-project
Expand Down
4 changes: 2 additions & 2 deletions Docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The script creates the directories for local mounts and copies all required file
The result is represented by the following services:

* Satosa-saml2spid is published with nginx frontend on https://localhost
* iam-proxy-italia is published with nginx frontend on https://localhost
* Mongo Espress is published on http://localhost:8081
* Django SAML2 SP is published on https://localhost:8000
* Spid-samlcheck is published on https://localhost:8443
Expand All @@ -48,7 +48,7 @@ Enter in `Docker-compose` directory and make required direcotries for local moun
```bash
cd Docker-compose
mkdir -p ./mongo/db # DB Data directory
mkdir -p ./satosa-project # Satosa-saml2spid data istance
mkdir -p ./satosa-project # iam-proxy-italia data istance
mkdir -p ./djangosaml2_sp # Service provider directory
mkdir -p ./nginx/html/static # static files for nginx
```
Expand Down
38 changes: 19 additions & 19 deletions Docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
ports:
- '27017-27019:27017-27019'
networks:
- satosa-saml2spid
- iam-proxy-italia

satosa-mongo-express:
profiles:
Expand All @@ -39,7 +39,7 @@ services:
ME_CONFIG_MONGODB_URL: mongodb://${MONGO_DBUSER:-satosa}:${MONGO_DBPASSWORD:-thatpassword}@satosa-mongo:27017/
TZ: "${TZ:-Europe/Rome}"
networks:
- satosa-saml2spid
- iam-proxy-italia

django_sp:
profiles:
Expand All @@ -58,17 +58,17 @@ services:
ports:
- "8000:8000"
networks:
- satosa-saml2spid
- iam-proxy-italia

satosa-saml2spid:
image: ghcr.io/italia/satosa-saml2spid:latest
#image: satosa-saml2spid:latest
iam-proxy-italia:
image: ghcr.io/italia/iam-proxy-italia:latest
#image: iam-proxy-italia:latest
#build:
# context: ../
# args:
# - NODE_ENV=local
# dockerfile: Dockerfile
container_name: satosa-saml2spid
container_name: iam-proxy-italia
# depends_on:
# - satosa-mongo
stdin_open: ${SATOSA_DEBUG:-false} # enables PDB when attach to the compose
Expand Down Expand Up @@ -122,11 +122,11 @@ services:
- "10000:10000"
volumes:
- ./satosa-project:/satosa_proxy:rwx
# - satosadata:/satosa_proxy # to be used for external volumes
# - iam-proxy-italia-data:/satosa_proxy # to be used for external volumes
working_dir: /satosa_proxy
entrypoint: "sh entrypoint.sh"
networks:
- satosa-saml2spid
- iam-proxy-italia
healthcheck:
test: wget -O - https://satosa-nginx/Saml2IDP/metadata --no-check-certificate || exit 1
interval: 30s
Expand All @@ -138,7 +138,7 @@ services:
image: nginx:alpine
container_name: satosa-nginx
depends_on:
- satosa-saml2spid
- iam-proxy-italia
ports:
- "443:443"
volumes:
Expand All @@ -147,7 +147,7 @@ services:
- ./nginx/certs:/etc/nginx/certs:ro
# - static:/usr/share/nginx/html # to be used for external volumes
networks:
- satosa-saml2spid
- iam-proxy-italia
environment:
- NGINX_HOST=${SATOSA_HOSTNAME:-localhost}
- TZ=${TZ:-Europe/Rome}
Expand All @@ -161,22 +161,22 @@ services:
ports:
- "8443:8443"
networks:
- satosa-saml2spid
- iam-proxy-italia
networks:
satosa-saml2spid:
name: satosa-saml2spid
iam-proxy-italia:
name: iam-proxy-italia

## External volumes
# volumes:
# mongodata:
# name: satosa-saml2spid_mongodata
# name: iam-proxy-italia_mongodata
# external: true
# nginx_certs:
# name: satosa-saml2spid_nginx_certs
# name: iam-proxy-italia_nginx_certs
# external: true
# satosadata:
# name: satosa-data
# iam-proxy-italia:
# name: iam-proxy-italia-data
# external: true
# static:
# name: satosa-static
# name: iam-proxy-italia-static
# external: true
2 changes: 1 addition & 1 deletion Docker-compose/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ server {
location @satosa {
include /etc/nginx/uwsgi_params;

uwsgi_pass satosa-saml2spid:10000;
uwsgi_pass iam-proxy-italia:10000;
uwsgi_param Host $host;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
4 changes: 2 additions & 2 deletions Docker-compose/nginx/html/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<head></head>
<body>Satosa-saml2spid empty index, check docs to edit</body>
</html>
<body>iam-proxy-italia empty index, check docs to edit</body>
</html>
2 changes: 1 addition & 1 deletion Docker-compose/run-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function help {
echo ""
echo "### run-docker-compose.sh ###"
echo ""
echo "initialize check update and start Satosa-Saml2Spid compose structure"
echo "initialize check update and start iam-proxy-italia compose structure"
echo ""
echo "Options"
echo "-f Force clean and reinitialize data for Satosa, MongoDB and Djangosaml2_SP"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ FROM alpine:3.20
# Metadata params
ARG BUILD_DATE
ARG VERSION
ARG VCS_URL="https://github.com/italia/Satosa-Saml2Spid.git"
ARG VCS_URL="https://github.com/italia/iam-proxy-italia.git"
ARG VCS_REF
ARG AUTHORS
ARG VENDOR

# Metadata : https://github.com/opencontainers/image-spec/blob/main/annotations.md
LABEL org.opencontainers.image.authors=$AUTHORS \
org.opencontainers.image.vendor=$VENDOR \
org.opencontainers.image.title="Satosa-Saml2Spid" \
org.opencontainers.image.title="iam-proxy-italia" \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.source=$VCS_URL \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.description="Docker Image di Satosa-Saml2Spid."
org.opencontainers.image.description="Docker Image di iam-proxy-italia."

COPY requirements.txt /

Expand Down
26 changes: 13 additions & 13 deletions README-Python-Dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The instructions below are intended to be a suggestion or a guideline rather tha

## Step 0: Identify which Python dependency requires development

We assume that the developer needs to develop a modified version of the library [eudi-wallet-it-python](https://github.com/italia/eudi-wallet-it-python) which is a dependency of the container `satosa-saml2spid`.
We assume that the developer needs to develop a modified version of the library [eudi-wallet-it-python](https://github.com/italia/eudi-wallet-it-python) which is a dependency of the container `iam-proxy-italia`.
A local copy of the library is required.
We assume that the project eudi-wallet-it-python has been cloned in the folder `/home/username/my/development/folder/eudi-wallet-it-python/pyeudiw`. The path prefix `/home/username/my/development/folder/` is an example and should be replaced here with the location of your own development package.

Expand All @@ -16,7 +16,7 @@ Set the environment variable `SATOSA_DEBUG=true`. This can be done either in the

## Step 2: Update the docker volume by binding the local development directory

In the file [docker-compose.yml](Docker-example/docker-compose.yml), among the volumes of the container `satosa-saml2spid`, add the entry
In the file [docker-compose.yml](Docker-example/docker-compose.yml), among the volumes of the container `iam-proxy-italia`, add the entry

volumes:
- /home/username/my/development/folder/eudi-wallet-it-python/pyeudiw:/.venv/lib/python3.12/site-packages/pyeudiw:rw
Expand All @@ -27,7 +27,7 @@ This will replace the installed dependency package with your own local code.

## Step 3: Run the container

Launch the script [run-docker-compose.sh](Docker-compose/run-docker-compose.sh). This will launch the docker composition that includes the container `satosa-saml2spid`.
Launch the script [run-docker-compose.sh](Docker-compose/run-docker-compose.sh). This will launch the docker composition that includes the container `iam-proxy-italia`.

## Step 4 (Optional): Install further dependencies in the container

Expand All @@ -36,16 +36,16 @@ Two different options are presented, based on your preferences or requirements.

### Option 4.1: Add the dependency to an existing container

The following steps instructs on how to install a new pip dependency to an existing container. We will assume that the container has name `satosa-saml2spid`.
The following steps instructs on how to install a new pip dependency to an existing container. We will assume that the container has name `iam-proxy-italia`.

1. Enter in the container environment with `docker exec -it satosa-saml2spid bash`. Note that to perform the `docker exec` command, the container MUST be running.
1. Enter in the container environment with `docker exec -it iam-proxy-italia bash`. Note that to perform the `docker exec` command, the container MUST be running.
2. Execute the following commands to install you own dependencies; replace `new_package_name` with the new dependency

source /.venv/bin/activate
pip3 install new_package_name

3. Exit from the container area with Docker escape control sequence, that is, `Ctrl+P` followed by `Ctrl+Q`.
4. Freeze the changes with the command `docker container commit satosa-saml2spid`.
4. Freeze the changes with the command `docker container commit iam-proxy-italia`.
5. Stop and then restart the container.

At the end of the procedure, you will find the required dependency as part of your container.
Expand All @@ -54,23 +54,23 @@ At the end of the procedure, you will find the required dependency as part of yo

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.

1. Stop the container `satosa-saml2spid` with the command `docker stop satosa-saml2spid`.
1. Stop the container `iam-proxy-italia` with the command `docker stop iam-proxy-italia`.
2. Create a new folder.
3. Inside the new folder, create a Dockerfile with the following content, replacing `new_package_name` with the target package:

FROM ghcr.io/italia/satosa-saml2spid:latest
FROM ghcr.io/italia/iam-proxy-italia:latest
RUN source /.venv/bin/activate && pip3 install new_package_name

4. Build the new image: `docker build . -t satosa-saml2spid`.
5. Modify docker-compose.yml to replace the old image reference with `satosa-saml2spid`.
4. Build the new image: `docker build . -t iam-proxy-italia`.
5. Modify docker-compose.yml to replace the old image reference with `iam-proxy-italia`.
6. Re-run `docker compose up`.

**NOTE:** if the image is already built locally, you can simply update the existing Dockerfile instead of creating a new one from scratch.

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

1. Stop the container `docker stop satosa-saml2spid`.
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 satosa-saml2spid`.
3. Start the container `docker start iam-proxy-italia`.

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 statosa-saml2spid` 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.
8 changes: 4 additions & 4 deletions README-Setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setup

In this section there are all the required information to install, configure and run Satosa-Saml2SPID.
In this section there are all the required information to install, configure and run iam-proxy-italia.

### NGINX setup

Expand All @@ -24,7 +24,7 @@ sudo yum install -y python3-wheel python3-devel

###### Prepare environment

Within the directory `/{your path}/Satosa-Saml2Spid` execute the following commands:
Within the directory `/{your path}/iam-proxy-italia` execute the following commands:

```
pip install --upgrade pip
Expand All @@ -34,7 +34,7 @@ mkdir satosa_proxy && cd satosa_proxy
virtualenv -ppython3 satosa.env
source satosa.env/bin/activate
git clone https://github.com/italia/Satosa-Saml2Spid.git repository
git clone https://github.com/italia/iam-proxy-italia.git repository
cd repository
pip install -r requirements.txt
```
Expand Down Expand Up @@ -64,7 +64,7 @@ Remember to:
This project uses [SATOSA_oidcop](https://github.com/UniversitaDellaCalabria/SATOSA-oidcop) as OAuth2/OIDC frontend module.
Comment/uncomment the following statement in the proxy_configuration to enable it.

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

### Configuration by environment variables

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ Here something that you should know before start.
## External references


### Satosa-Saml2Spid tutorials
### IAM-Proxy-Italia tutorials

- [Corso-OIDC-in-IDEM-via-Proxy](https://github.com/IDEM-GARR-AAI/Corso-OIDC-in-IDEM-via-Proxy/)
- [Satosa-Saml2Spid installation tutorial](https://github.com/aslbat/Satosa-SPID-Proxy).
- [Setup Tutorial](https://github.com/aslbat/Satosa-SPID-Proxy).

### SATOSA Official Documentation

Expand Down Expand Up @@ -179,7 +179,7 @@ Here something that you should know before start.
- Fulvio Scorza and his Team @ Università del Piemonte Orientale
- Paolo Smiraglia (SPID certs)
- Stefano Colagreco @ CNR
- Elisa @ Trentino Digitale
- Elisa Nicolussi Paolaz @ Trentino Digitale
- Thomas Chiozzi @ Trentino Digitale
- Identity Python Community (pySAML2 and SATOSA)
- GARR IDEM Community
2 changes: 1 addition & 1 deletion README.mongo.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ db.client.insertOne(

### Using Docker

When using docker-compose in [compose-Satosa-Saml2Spid](./compose-Satosa-Saml2Spid) all operations described in section [Install and configure](#install-and-configure) are executed by the init script [init-mongo.sh](./compose-Satosa-Saml2Spid/init-mongo.sh) at the first start o the container.
When using docker-compose in [Docker-compose](./Docker-compose) all operations described in section [Install and configure](#install-and-configure) are executed by the init script [init-mongo.sh](./compose-Satosa-Saml2Spid/init-mongo.sh) at the first start o the container.

#### set environment in .env

Expand Down
20 changes: 10 additions & 10 deletions docs/docker_compose_profiles.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Docker Compose profiles in Satosa-saml2spid
## Docker Compose profiles in iam-proxy-italia
Profiles are a good way to optimize and extend a single Docker Compose file.
The [official docker manual](https://docs.docker.com/compose/profiles/) says about profiles:
> Profiles help you adjust your Compose application for different environments or use cases by selectively activating services. Services can be assigned to one or more profiles; unassigned services start by default, while assigned ones only start when their profile is active. This setup means specific services, like those for debugging or development, to be included in a single compose.yml file and activated only as needed.
In this [Docker Compose project](https://github.com/italia/Satosa-Saml2Spid/blob/master/Docker-compose/docker-compose.yml), profiles are used to limit startup to strictly necessary services.
The services `satota-saml2spid` and `satosa-nginx` do not have a profile and are started every time, every other service can be started with one of the existing profiles:
In this [Docker Compose project](https://github.com/italia/iam-proxy-italia/blob/master/Docker-compose/docker-compose.yml), profiles are used to limit startup to strictly necessary services.
The services `iam-proxy-italia` and `satosa-nginx` do not have a profile and are started every time, every other service can be started with one of the existing profiles:

* **mongo** - start MongoDB service
* **mongoexpress** - start MongoDB and a MongoExpress service
Expand Down Expand Up @@ -37,18 +37,18 @@ The [run-docker-compose.sh](./run-docker-compose.sh.md) script can be start all
| satosa-mongo | demo, mongo, mongoexpress
| satosa-mongo-express | demo, mongoexpress
| satosa-nginx |
| satosa-saml2spid |
| iam-proxy-italia |
| spid-samlcheck | demo dev

#### Services by profile

| Profile | services
| ----------- | --------
| no profiles | nginx, satosa
| demo | django_sp, satosa-mongo, satosa-mongo-express, satosa-nginx, satosa-saml2spid, spid-samlcheck
| dev | django_sp, satosa-nginx, satosa-saml2spid, spid-samlcheck
| mongo | satosa-mongo, satosa-nginx, satosa-saml2spid
| mongexpress | satosa-mongo, satosa-mongo-express, satosa-nginx, satosa-saml2spid
| demo | django_sp, satosa-mongo, satosa-mongo-express, satosa-nginx, iam-proxy-italia, spid-samlcheck
| dev | django_sp, satosa-nginx, iam-proxy-italia, spid-samlcheck
| mongo | satosa-mongo, satosa-nginx, iam-proxy-italia
| mongexpress | satosa-mongo, satosa-mongo-express, satosa-nginx, iam-proxy-italia

#### Profile by option in [run-docker-compose.sh](./run-docker-compose.sh)

Expand All @@ -61,5 +61,5 @@ The [run-docker-compose.sh](./run-docker-compose.sh.md) script can be start all
| | demo

### Insights
* For more details on Satosa-saml2spid docker compose read [docker-compose readme page](./docker-compose.md)
* For more details on Satosa-saml2spid docker run-docker-compose.sh read [run-docker-compose.sh page](./run-docker-compose.sh.md)
* For more details on iam-proxy-italia docker compose read [docker-compose readme page](./docker-compose.md)
* For more details on iam-proxy-italia docker run-docker-compose.sh read [run-docker-compose.sh page](./run-docker-compose.sh.md)
Loading

0 comments on commit 99ef10e

Please sign in to comment.