diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9093b6..9567aee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,22 @@ name: CI on: push: branches: [develop] + paths-ignore: + - '**.md' + - 'docs/**' + - 'tutorials/**' + - 'examples/**/README.md' + - 'LICENSE' + - '.gitignore' pull_request: branches: [develop, main] + paths-ignore: + - '**.md' + - 'docs/**' + - 'tutorials/**' + - 'examples/**/README.md' + - 'LICENSE' + - '.gitignore' workflow_dispatch: inputs: triggered-by: @@ -13,10 +27,5 @@ on: jobs: build: uses: fireflyframework/.github/.github/workflows/java-ci.yml@main - permissions: - packages: read - contents: read - actions: write with: java-version: '25' - secrets: inherit diff --git a/README.md b/README.md index 592e425..1bb0f5a 100644 --- a/README.md +++ b/README.md @@ -1,256 +1,103 @@ -# fireflyframework-config-server - -[![CI](https://github.com/fireflyframework/fireflyframework-config-server/actions/workflows/ci.yml/badge.svg)](https://github.com/fireflyframework/fireflyframework-config-server/actions/workflows/ci.yml) - -Firefly Framework Config Server - Centralized configuration management for Firefly Framework microservices. - - -## Project Description - -This project implements a **Spring Cloud Config Server** that centralizes configuration management for distributed applications. It uses the `native` profile to serve configuration files stored locally in an organized hierarchical structure. - -## Architecture and Structure - -### Directory Structure - -``` -src/main/resources/config/ -├── common/ # All applications of the common layer -│ ├── application.yaml # Common base configuration -│ ├── application-dev.yaml # Common configuration for development -│ ├── application-pre.yaml # Common configuration for pre-production -│ └── application-pro.yaml # Common configuration for production -├── core/ # Applications of the core layer -│ ├── application.yaml # Core base configuration -│ ├── application-dev.yaml # Core configuration for development -│ ├── application-pre.yaml # Core configuration for pre-production -│ └── application-pro.yaml # Core configuration for production -└── domain/ # Applications of the domain layer - ├── distributor-domain-branding/ - │ ├── distributor-domain-branding.yaml - │ ├── distributor-domain-branding-dev.yaml - │ ├── distributor-domain-branding-pre.yaml - │ └── distributor-domain-branding-pro.yaml - ├── domain-endpoints-dev.yaml - ├── domain-endpoints-pre.yaml - └── domain-endpoints-pro.yaml -``` - -### Configuration Hierarchy - -The server is configured to search for configurations in the following priority order: - -1. **Common**: All applications of the common layer -2. **Core**: Applications of the core layer -3. **Domain**: Applications of the domain layer -4. **Application-specific**: Specific configurations using the `{application}` pattern - -## Server Configuration - -### `application.yml` File - -```yaml -server: - port: 8888 # Config Server port - -spring: - profiles: - active: native # Native profile for local files - cloud: - config: - server: - native: - search-locations: > # Hierarchical search locations - classpath:/config/common, - classpath:/config/core, - classpath:/config/domain, - classpath:/config/common/{application}, - classpath:/config/core/{application}, - classpath:/config/domain/{application} -``` - -### Environment Profiles - -The system supports three main environments: -- **dev**: Development -- **pre**: Pre-production -- **pro**: Production - -## How It Works - -### 1. Configuration Resolution +# Firefly Framework - Config Server -When a client application requests its configuration, the Config Server: - -1. Searches for files that match the application name -2. Applies the location hierarchy (common → core → domain) -3. Combines configurations according to the active profile -4. Returns the consolidated configuration - -### 2. File Naming Patterns - -- `application.yaml`: Base configuration -- `application-{profile}.yaml`: Profile-specific configuration -- `{application-name}.yaml`: Application-specific configuration -- `{application-name}-{profile}.yaml`: Application and profile-specific configuration - -### 3. Configuration Examples - -#### Common Layer -```yaml -# common/application.yaml -endpoints: - distributor-mgmt: http://localhost:8082 -``` +[![CI](https://github.com/fireflyframework/fireflyframework-config-server/actions/workflows/ci.yml/badge.svg)](https://github.com/fireflyframework/fireflyframework-config-server/actions/workflows/ci.yml) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) +[![Java](https://img.shields.io/badge/Java-21%2B-orange.svg)](https://openjdk.org) +[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.x-green.svg)](https://spring.io/projects/spring-boot) -#### Domain Layer -```yaml -# domain/distributor-domain-branding/distributor-domain-branding.yaml -spring: - application: - version: 1.0.0 - description: Distributor Domain Branding Layer Application +> Spring Cloud Config Server for centralized configuration management across Firefly Framework microservices. -firefly: - cqrs: - enabled: true - eda: - enabled: true - default-publisher-type: KAFKA +--- -server: - port: ${SERVER_PORT:8080} -``` - -## How to Run the Server +## Table of Contents -### Prerequisites -- Java 21 or higher -- Maven 3.6+ +- [Overview](#overview) +- [Features](#features) +- [Requirements](#requirements) +- [Installation](#installation) +- [Quick Start](#quick-start) +- [Configuration](#configuration) +- [Documentation](#documentation) +- [Contributing](#contributing) +- [License](#license) -### Execution +## Overview -1. **Compile the project:** - ```bash - mvn clean compile - ``` +Firefly Framework Config Server provides centralized configuration management for Firefly-based microservices using Spring Cloud Config Server. It serves externalized configuration from a Git repository (or other backends) to all connected microservices, enabling environment-specific configuration, runtime configuration updates, and consistent property management. -2. **Run the server:** - ```bash - mvn spring-boot:run - ``` +The config server is a standalone Spring Boot application that can be deployed as a dedicated microservice. All other Firefly Framework modules can connect to it via the Spring Cloud Config client auto-configuration provided by `fireflyframework-core`. -3. **Run with specific profile:** - ```bash - mvn spring-boot:run -Dspring-boot.run.profiles=dev - ``` +This module simplifies configuration management in distributed environments by providing a single source of truth for application properties across all environments (development, staging, production). -### Verification +## Features -The server will be available at: `http://localhost:8888` +- Spring Cloud Config Server for centralized configuration +- Git-backed configuration repository support +- Environment-specific configuration profiles +- Runtime configuration refresh without restart +- Encryption and decryption of sensitive properties +- Integration with Firefly Core's cloud config client +- Standalone Spring Boot application deployment -## How to Access Configurations +## Requirements -### Configuration Endpoints +- Java 21+ +- Spring Boot 3.x +- Maven 3.9+ +- Git repository for configuration storage -The Config Server exposes the following URLs to access configurations: +## Installation -#### URL Format -``` -http://localhost:8888/{application}/{profile} -http://localhost:8888/{application}/{profile}/{label} -http://localhost:8888/{application}-{profile}.json -http://localhost:8888/{application}-{profile}.yaml -http://localhost:8888/{application}-{profile}.properties +```xml + + org.fireflyframework + fireflyframework-config-server + 26.01.01 + ``` -#### Access Examples +## Quick Start -1. **Specific application configuration:** - ``` - GET http://localhost:8888/distributor-domain-branding/dev - ``` +```java +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; -2. **Configuration in YAML format:** - ``` - GET http://localhost:8888/distributor-domain-branding-dev.yaml - ``` - -3. **Common configuration for development:** - ``` - GET http://localhost:8888/application/dev - ``` - -### Server Response - -The server returns a JSON response with the following structure: -```json -{ - "name": "distributor-domain-branding", - "profiles": ["dev"], - "label": null, - "version": null, - "state": null, - "propertySources": [ - { - "name": "classpath:/config/domain/distributor-domain-branding/distributor-domain-branding-dev.yaml", - "source": { - "endpoints.distributor-mgmt": "dev.portal.aws", - "spring.application.version": "1.0.0" - } +@SpringBootApplication +@EnableConfigServer +public class FireflyConfigServerApplication { + public static void main(String[] args) { + SpringApplication.run(FireflyConfigServerApplication.class, args); } - ] } ``` -## Client Configuration +## Configuration -### Configuration in client's `bootstrap.yml`: ```yaml +server: + port: 8888 + spring: - application: - name: distributor-domain-branding cloud: config: - uri: http://localhost:8888 - profile: dev -``` - -### Configuration in client's `application.yml`: -```yaml -spring: - config: - import: "configserver:http://localhost:8888" + server: + git: + uri: https://github.com/your-org/config-repo + default-label: main + search-paths: '{application}' ``` -## Advantages of this Structure +## Documentation -1. **Separation of Responsibilities**: Configurations organized by layers (common, core, domain) -2. **Reusability**: Common configurations shared between applications -3. **Flexibility**: Support for multiple environments and profiles -4. **Maintainability**: Clear and predictable structure -5. **Scalability**: Easy addition of new applications and configurations +No additional documentation available for this project. -## Additional Notes +## Contributing -- The server uses the `native` profile to serve files from the classpath -- Configurations can be overridden following the established hierarchy -- It's possible to add new search locations by modifying `search-locations` -- The server supports automatic refresh when configuration changes are detected +Contributions are welcome. Please read the [CONTRIBUTING.md](CONTRIBUTING.md) guide for details on our code of conduct, development process, and how to submit pull requests. -## Troubleshooting +## License -### Common Issues +Copyright 2024-2026 Firefly Software Solutions Inc. -1. **Port 8888 already in use**: Change the port in `application.yml` -2. **Configuration not found**: Verify directory structure and file names -3. **Profiles not applied**: Ensure the profile name matches exactly - -### Debug Logging - -Enable debug logging by adding to `application.yml`: -```yaml -logging: - level: - org.springframework.cloud.config: DEBUG -``` \ No newline at end of file +Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.