Commit 6caf361e authored by Adriana Fernández-Fernández's avatar Adriana Fernández-Fernández
Browse files

Seed code for Federation Manager

parent 36212df7
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+11 −0
Original line number Diff line number Diff line
# Folders
.idea
venv
src/__pycache__/
src/models/__pycache__/
src/controllers/__pycache__/
src/clients/__pycache__/
src/test/__pycache__/

# Files
src/conf/config.cfg

CONTRIBUTING.md

0 → 100644
+36 −0
Original line number Diff line number Diff line
# Contributing to Federation Manager

Thank you for considering contributing to the Federation Manager project!  
We welcome contributions from the community to help improve and evolve this open-source implementation.

## How to Contribute

1. **Fork the repository** and create your branch from `main`.
2. **Write clear, concise code** that follows Python best practices.
3. **Include tests** if you add new functionality or fix a bug.
4. **Update documentation** as needed to reflect your changes.
5. **Submit a pull request** with a clear description of your changes.

## Code Guidelines

- Follow [PEP8](https://peps.python.org/pep-0008/) coding style.
- Write meaningful commit messages.
- Keep pull requests focused and small when possible.
- Document public methods and classes using docstrings.

## Reporting Issues

If you find a bug or have a feature request, please open an issue using the [Issue Tracker](../../issues).

When reporting a bug, please include:
- A clear description of the problem
- Steps to reproduce the issue
- Any relevant logs, error messages, or screenshots

## Community Standards

We are committed to providing a welcoming and respectful environment for all contributors.

---

Thank you for helping to build Federation Manager!

Dockerfile

0 → 100644
+53 −0
Original line number Diff line number Diff line
# -------------------------------------------------------------------------- #
# Copyright 2025-present, Federation Manager, by Software Networks, i2CAT    #
#                                                                            #
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
# not use this file except in compliance with the License. You may obtain    #
# a copy of the License at                                                   #
#                                                                            #
# http://www.apache.org/licenses/LICENSE-2.0                                 #
#                                                                            #
# Unless required by applicable law or agreed to in writing, software        #
# distributed under the License is distributed on an "AS IS" BASIS,          #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
# See the License for the specific language governing permissions and        #
# limitations under the License.                                             #
# -------------------------------------------------------------------------- #

#########################################################
#                                                       #
#   Dockerfile for creating a container image for the   #
#   federation-manager                                  #
#                                                       #
#########################################################

FROM python:3.9

# Set working directory
WORKDIR /usr/app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    bash \
    build-essential \
    git \
    wget \
    iptables \
    libcurl4-openssl-dev \
    libssl-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy application code
COPY . .

# Install Python dependencies
RUN python -m pip install --no-cache-dir -r requirements.txt

# Set working directory for application execution
WORKDIR /usr/app/src/

# Expose application port
EXPOSE 8989

# Set Gunicorn as the entrypoint
ENTRYPOINT ["gunicorn", "wsgi:app", "--bind", "0.0.0.0:8989", "--workers", "4", "--log-level", "debug", "--timeout", "1000"]

docker-compose.yaml

0 → 100644
+44 −0
Original line number Diff line number Diff line
version: '3.8'

services:
  federation-manager:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: federation-manager
    restart: unless-stopped
    ports:
      - "8990:8989"
    volumes:
      - ./src/conf/config.cfg:/usr/app/src/conf/config.cfg
    depends_on:
      - mongodb
      - keycloak
  mongodb:
    image: mongo
    container_name: mongodb
    restart: unless-stopped
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_DATABASE: federation-manager
      MONGODB_DATA_DIR: /data/db
      MONDODB_LOG_DIR: /dev/null
    volumes:
      - smdbdata:/data/db
  keycloak:
    image: quay.io/keycloak/keycloak:26.1.4
    container_name: keycloak
    environment:
      - KC_BOOTSTRAP_ADMIN_USERNAME=admin
      - KC_BOOTSTRAP_ADMIN_PASSWORD=admin
      - KC_IMPORT=/opt/keycloak/data/import/realm-import.json
    ports:
      - "8080:8080"
    command:
      [ "start-dev", "--import-realm" ]
    volumes:
      - ./keycloak/realm-import.json:/opt/keycloak/data/import/realm-import.json
volumes:
  smdbdata:
    driver: local
+26 −0
Original line number Diff line number Diff line
{
  "realm": "federation",
  "enabled": true,
  "clientScopes" : [
    {
      "id" : "439d9c71-8a8a-469c-9280-058016000cc2",
      "name" : "fed-mgmt",
      "protocol": "openid-connect",
      "description" : "fed-mgmt"
    }
  ],
  "clients": [
    {
      "clientId": "originating-op-1",
      "enabled": true,
      "clientAuthenticatorType": "client-secret",
      "secret": "dd7vNwFqjNpYwaghlEwMbw10g0klWDHb",
      "redirectUris": ["http://localhost:8080/*"],
      "publicClient": false,
      "directAccessGrantsEnabled": true,
      "serviceAccountsEnabled": true,
      "defaultClientScopes": ["fed-mgmt"],
      "webOrigins": ["*"]
    }
  ]
}
Loading