Skip to content

Commit

Permalink
Merge branch 'feature/OIDF-57' into feature/OIDF-7
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati committed Aug 16, 2024
2 parents b12e7bc + 4620267 commit fe60ba8
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 8 deletions.
19 changes: 19 additions & 0 deletions .docker/admin-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM openjdk:21-jdk as builder
RUN microdnf install findutils

WORKDIR /app

COPY . /app

RUN chmod +x ./gradlew

RUN ./gradlew :modules:admin-server:jar -x test -x allTests -x jsBrowserTest

FROM openjdk:21-jdk as runner

WORKDIR /app

COPY .env .env
COPY --from=builder /app/modules/admin-server/build/libs/admin-server-0.0.1.jar ./admin-server-0.0.1.jar

ENTRYPOINT ["java", "-jar", "admin-server-0.0.1.jar"]
19 changes: 19 additions & 0 deletions .docker/federation-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM openjdk:21-jdk as builder
RUN microdnf install findutils

WORKDIR /app

COPY . /app

RUN chmod +x ./gradlew

RUN ./gradlew :modules:federation-server:jar -x test -x allTests -x jsBrowserTest

FROM openjdk:21-jdk as runner

WORKDIR /app

COPY .env .env
COPY --from=builder /app/modules/federation-server/build/libs/federation-server-0.0.1.jar ./federation-server-0.0.1.jar

ENTRYPOINT ["java", "-jar", "federation-server-0.0.1.jar"]
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DATASOURCE_URL=jdbc:postgresql://localhost:5432/openid-federation-db
DATASOURCE_URL=jdbc:postgresql://db:5432/openid-federation-db
DATASOURCE_USER=openid-federation-db-user
DATASOURCE_PASSWORD=openid-federation-db-password
DATASOURCE_DB=openid-federation-db
APP_KEY=Nit5tWts42QeCynT1Q476LyStDeSd4xb
APP_KEY=Nit5tWts42QeCynT1Q476LyStDeSd4xb
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
java-version: 17

- name: Build the stack
run: docker compose -f docker-compose.yaml up -d
run: docker compose -f docker-compose.yaml up db -d
env:
DATASOURCE_USER: ${{ secrets.DATASOURCE_USER }}
DATASOURCE_PASSWORD: ${{ secrets.DATASOURCE_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ captures
/.temp/
/docker/.env
/.run/*
kotlin-js-store/
kotlin-js-store/
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In the context of OpenID Federation, Entity Statements play a crucial role. Thes
about the entity, such as its public keys and metadata. This framework allows entities to assert their identity and
capabilities in a standardized manner, enabling seamless integration and interoperability within federations.

## Key Concepts
# Key Concepts

- **Federation**: A group of organizations that agree to interoperate under a set of common rules defined in a
federation policy.
Expand Down Expand Up @@ -92,3 +92,38 @@ purposes. **It is not intended for use in production environments** due to signi

- Entity Statements can include additional claims as required by applications and protocols.
- Metadata in Subordinate Statements overrides that in the Entity’s own configuration.

# Servers Deployment Instructions

## Docker Setup

For seamless deployment of the OpenID Federation servers, Docker and Docker Compose offer the most efficient and
straightforward approach.

## Essential Commands

### Build Docker Images

- `docker compose build` - Compile the Docker images for the services.
- `docker compose build --no-cache` - Compile the Docker images without utilizing the build cache, ensuring a clean
build.

### Manage Services:

- `docker compose up` - Initiate the services.
- `docker compose up -d` - Launch the services in detached mode, allowing them to run in the background.
- `docker compose down` - Terminate the services.
- `docker compose down -v` - Terminate the services and remove associated volumes.
- `docker compose up db -d` - Start only the database container in detached mode for isolated database operations.
- `docker compose up federation-server -d` - Start only the Federation Server in detached mode.

## API Endpoints via Docker

* Federation API: Accessible at http://localhost:8080
* Admin Server API: Accessible at http://localhost:8081

## Local Key Management System - Important Notice

Local Key Management Service is designed primarily for testing, development, and local experimentation
purposes. **It is not intended for use in production environments** due to significant security and compliance risks.

44 changes: 43 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,55 @@ services:
environment:
POSTGRES_USER: ${DATASOURCE_USER}
POSTGRES_PASSWORD: ${DATASOURCE_PASSWORD}
POSTGRES_DB: openid-federation-db
POSTGRES_DB: ${DATASOURCE_DB}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- openid_network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${DATASOURCE_DB}" ]
interval: 3s
timeout: 5s
retries: 20

federation-server:
build:
context: .
dockerfile: ./.docker/federation-server/Dockerfile
ports:
- "8080:8080"
container_name: openid-federation-server
environment:
DATASOURCE_URL: ${DATASOURCE_URL}
DATASOURCE_USER: ${DATASOURCE_USER}
DATASOURCE_PASSWORD: ${DATASOURCE_PASSWORD}
depends_on:
admin-server:
condition: service_started
db:
condition: service_healthy
networks:
- openid_network

admin-server:
build:
context: .
dockerfile: ./.docker/admin-server/Dockerfile
ports:
- "8081:8080"
container_name: openid-federation-server-admin
environment:
DATASOURCE_URL: ${DATASOURCE_URL}
DATASOURCE_USER: ${DATASOURCE_USER}
DATASOURCE_PASSWORD: ${DATASOURCE_PASSWORD}
APP_KEY: ${APP_KEY}
depends_on:
db:
condition: service_healthy
networks:
- openid_network

networks:
openid_network:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spring.config.import=optional:file:../../.env[.properties]
spring.application.name=OpenID Federation
spring.application.name=OpenID Federation Admin Server
spring.datasource.url=${DATASOURCE_URL}
spring.datasource.username=${DATASOURCE_USER}
spring.datasource.password=${DATASOURCE_PASSWORD}
Expand Down
1 change: 0 additions & 1 deletion modules/openid-federation-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ kotlin {
}

val jsTest by getting {
dependsOn(commonTest)
dependencies {
implementation(kotlin("test-js"))
implementation(kotlin("test-annotations-common"))
Expand Down

0 comments on commit fe60ba8

Please sign in to comment.