Skip to content

Commit

Permalink
fix: CI and small docker readme improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed Nov 14, 2024
1 parent 7a052d2 commit bf5a384
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
cd Docker-compose/satosa-project
spid_sp_test --idp-metadata > metadata/idp/spid-sp-test.xml
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
IDP_ENTITYID=https://localhost:8443/samlsso 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
- name: spid-sp-test CIE id metadata
run: |
cd Docker-compose/satosa-project
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ Docker-compose/satosa-project/*
Docker-compose/djangosaml2_sp/*
Docker-compose/mongo/db/*
Docker-compose/nginx/html/static/*
Docker-compose/.env
28 changes: 15 additions & 13 deletions Docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ sudo apt install docker-compose

For docker-compose you can also [see here](https://docs.docker.com/compose/install/other/).

## Run the composition MAGIC WAY
## Run the Composition for Demo Purposes

Enter in `Docker-compose` directory and run `run-docker-compose.sh`:
```bash
cd Docker-compose
./run-docker-compose.sh
```
The script make the directories for local mounts, copy all required files in right directory and start a full demo with test and Service providers
The script creates the directories for local mounts and copies all required files to start a full demo with test and SAML2 Service Providers.

> Warning: The script deletes any previous created directory if found.
The result is represented by the following services:

* Satosa-saml2spid is published with nginx frontend on https://localhost
* Mongo Espress is published on http://localhost:8081
Expand All @@ -38,7 +42,7 @@ The script make the directories for local mounts, copy all required files in rig

More details ad start option are avable on [run-docker-compose.sh](../docs/run-docker-compose.sh.md) page

### Run the composition LONG WAY
### Run the Composition for Production Use

Enter in `Docker-compose` directory and make required direcotries for local mounts:
```bash
Expand All @@ -61,6 +65,14 @@ Clean static data from Satosa project
rm -R ./satosa-project/static
```

Copy the example env file and edit according to your configuration,
therefore **all the default passwords MUST be changed**.

```bash
cp env.example .env
```
You can still edit all files in detail from their local volumes.

Run the compose for a minimal system (nginx and satosa)
```
docker compose up
Expand All @@ -73,16 +85,6 @@ docker compose --profile demo up

Read the [profiles guide](../docs/docker_compose_profiles.md) for more informations


### Configure your system
Copy the example env file:
```bash
cp env.example .env
```

Edit and personalize the system from `.env` files. You can still edit all files in detail from their local volumes.
**IMPORTANT all the default password must be changed!**

### Insights

* More details on prodiles read the [Docker Compose Profiles](../docs/docker_compose_profiles.md) page
Expand Down
3 changes: 3 additions & 0 deletions Docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
services:

satosa-mongo:
profiles:
- demo
Expand Down Expand Up @@ -39,6 +40,7 @@ services:
TZ: "${TZ:-Europe/Rome}"
networks:
- satosa-saml2spid

django_sp:
profiles:
- demo
Expand All @@ -57,6 +59,7 @@ services:
- "8000:8000"
networks:
- satosa-saml2spid

satosa-saml2spid:
image: ghcr.io/italia/satosa-saml2spid:latest
#image: satosa-saml2spid:latest
Expand Down
8 changes: 4 additions & 4 deletions Docker-compose/env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SATOSA_HOSTNAME=localhost
# SATOSA_BASE=https://${SATOSA_HOSTNAME:-localhost}
# SATOSA_BASE_STATIC=${SATOSA_BASE}/static
# SATOSA_DISCO_SRV=${SATOSA_BASE_STATIC}/disco.html
# SATOSA_UNKNOW_ERROR_REDIRECT_PAGE=${SATOSA_BASE_STATIC}/error_page.html
SATOSA_BASE=https://${SATOSA_HOSTNAME:-localhost}
SATOSA_BASE_STATIC=${SATOSA_BASE}/static
SATOSA_DISCO_SRV=${SATOSA_BASE_STATIC}/disco.html
SATOSA_UNKNOW_ERROR_REDIRECT_PAGE=${SATOSA_BASE_STATIC}/error_page.html

# Set Time Zone
TZ="Europe/Rome"
Expand Down
3 changes: 3 additions & 0 deletions Docker-compose/run-docker-compose.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
export COMPOSE_PROFILES=demo
export SKIP_UPDATE=

function clean_data {
rm -Rf ./mongo/db/*
rm -Rf ./satosa-project/*
Expand All @@ -9,6 +10,8 @@ function clean_data {
}

function initialize_satosa {
cp env.example .env

mkdir -p ./satosa-project
mkdir -p ./djangosaml2_sp
mkdir -p ./mongo/db
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ LABEL org.opencontainers.image.authors=$AUTHORS \
org.opencontainers.image.source=$VCS_URL \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.description="Docker Image di Satosa-Saml2Spid."


COPY requirements.txt /

Expand All @@ -27,7 +26,7 @@ ENV BASEDIR="/satosa_proxy"
# "mailcap" package is required to add mimetype support
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

RUN python3 -m venv .venv && . .venv/bin/activate && pip3 install --upgrade pip setuptools \
RUN python3 -m venv .venv && . .venv/bin/activate && pip3 install --upgrade pip setuptools \
&& pip3 install -r requirements.txt --ignore-installed --root-user-action=ignore && mkdir $BASEDIR \
&& addgroup -S satosa && adduser -S satosa -G satosa \
&& chown satosa:satosa $BASEDIR
Expand Down
2 changes: 1 addition & 1 deletion example_sp/djangosaml2_sp/djangosaml2_sp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
path(f'{SAML2_URL_PREFIX}/ls/', views.LogoutView.as_view(), name='saml2_ls'),
path(f'{SAML2_URL_PREFIX}/ls/post/', views.LogoutView.as_view(), name='saml2_ls_post'),
path(f'{SAML2_URL_PREFIX}/metadata/', views.MetadataView.as_view(), name='saml2_metadata'),
# path(f'{SAML2_URL_PREFIX}/echo_attributes', views.EchoAttributesView.as_view(), name='saml2_echo_attributes'),
path(f'{SAML2_URL_PREFIX}/echo_attributes', views.EchoAttributesView.as_view(), name='saml2_echo_attributes'),
path('logout/', LogoutView.as_view(), {'next_page': settings.LOGOUT_REDIRECT_URL}, name='logout')
])

Expand Down

0 comments on commit bf5a384

Please sign in to comment.