Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/levende arbeidsforhold ansettelse #3655

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from

Conversation

krharum
Copy link
Contributor

@krharum krharum commented Oct 18, 2024

No description provided.

…e-arbeidsforhold-ansettelse

Removed the explicit use of Threads and handling interruptions. Streamlined the service execution and added error logging for better maintainability and debugging.
#deploy-levende-arbeidsforhold-ansettelse

Extended the pending acquire timeout from 300 seconds to 3000 seconds for AaregConsumer connections. This change aims to reduce connection acquisition failures during high latency periods.
Extended the `nginx.ingress.kubernetes.io/proxy-read-timeout` and `proxy-send-timeout` annotations from 600 to 2400 seconds. This change aims to accommodate longer processing times required by the application.
#deploy-levende-arbeidsforhold-ansettelse

Added a delay of one minute between processing each element within the 'opprettAnsettelse' method to prevent overwhelming external services. This change aims to enhance system stability and prevent any rate-limiting issues.
…cation from a traditional Spring MVC architecture to a reactive Spring WebFlux architecture. This change is evident in the following modifications:

**1. Reactive Dependencies:**

- Removal of `spring-boot-starter-data-jpa` and addition of `spring-boot-starter-data-r2dbc` indicate a shift from blocking JPA to reactive R2DBC for database interactions.
- Inclusion of `org.postgresql:r2dbc-postgresql` and `io.r2dbc:r2dbc-h2` provides drivers for reactive database connections.

**2. Reactive Repositories:**

- Repositories like `ParameterRepository`, `AnsettelseLoggRepository`, and `LoggRepository` now extend reactive interfaces like `ReactiveCrudRepository` and `ReactiveSortingRepository`.
- Methods in these repositories now return reactive types like `Flux` and `Mono` instead of `List` and `Optional`.

**3. Reactive Services:**

- Service methods in `LoggService`, `ArbeidsforholdService`, `KodeverkService`, `AnsettelseLoggService`, and `ParameterService` are updated to return reactive types (`Flux`, `Mono`).
- Usage of reactive operators like `flatMap`, `map`, and `collectList` is introduced for asynchronous data processing.

**4. Reactive Controllers:**

- Controllers like `ParameterController` and `LoggController` now return reactive types (`Flux`, `Mono`) from their endpoint methods.

**5. Security Configuration:**

- The `SecurityConfig` class is updated to use `EnableWebFluxSecurity` and `EnableReactiveMethodSecurity` annotations, indicating a shift to reactive security configurations.
- The `springSecurityFilterChain` method now configures a `SecurityWebFilterChain` for reactive web requests.

**6. Other Changes:**

- Introduction of `NavHeaders` class for managing custom headers.
- Update to OpenApiConfig to support reactive endpoints.
- Removal of unused dependencies and code related to the previous Spring MVC architecture.

**Impact:**

This migration to a reactive architecture brings several benefits:

- **Improved Performance and Scalability:** Reactive applications can handle more requests with fewer resources compared to traditional blocking applications.
- **Non-Blocking Operations:** Asynchronous operations prevent threads from being blocked, leading to better resource utilization.
- **Enhanced Responsiveness:** Reactive applications can respond to user requests faster, even under heavy load.

**Considerations:**

- Developers need to be familiar with reactive programming concepts and libraries like Reactor to work with this updated codebase.
- Testing strategies need to be adapted for reactive components.
- Existing code that interacts with the application might need adjustments to handle reactive types.

This migration represents a significant architectural shift that can lead to a more performant and scalable application.
Included a new JsonNode for errors in PdlPersonDTO and added Jackson codecs in PdlConsumer. Enhanced logging in SokPersonCommand for debugging purposes.
#deploy-levende-arbeidsfoehold-ansettelse

Refactor LoggRepository to use Mono for count and remove unnecessary vault dependencies. Added delay in ArbeidsforholdService to manage requests better and set restart policy in docker-compose. Introduced PageableHandlerMethodArgumentResolver for custom pageable handling and adjusted entity timestamp types.
#deploy-levende-arbeidsforhold-ansettelse
#deploy-testnav-levende-arbeidsforhold-ansettelse

Updated the datasource configuration to use the R2DBC URL instead of the JDBC URL for PostgreSQL. Also, included username and password properties to align with the new configuration requirements. This change aims to improve non-blocking database interaction.
#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-ansettelse

Changed the encoder class in the prod profile from `no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder` to `no.nav.testnav.libs.reactivecore.logging.TestnavLogbackEncoder`. This ensures logs are managed by the appropriate logging framework for reactive applications.
#deploy-levende-arbeidsforhold-ansettelse

This change includes the addition of `r2dbc` configuration parameters for URL, username, and password in the `application-prod.yml` file. This ensures that the application has the necessary parameters to connect to the database using R2DBC.
#deploy-levende-arbeidsforhold-ansettelse

Updated the datasource URL in the production configuration file to use JDBC instead of R2DBC. This change ensures compatibility and proper connectivity for database operations in the production environment.
#deploy-levende-arbeidsforhold-ansettelse

Updated the `application-prod.yml` to include necessary credentials for the R2DBC connection. This change ensures proper authentication and secure access to the PostgreSQL database.
#deploy-levende-arbeidsforhold-ansettelse

This commit updates the config.yml file to include environment variables sourced from the specified secret. This change is necessary for managing sensitive information securely in the application. It ensures that the application can access necessary credentials without hardcoding them into the configuration file.
#deploy-levende-arbeidsforhold-ansettelse

Replaced "datasource" with "r2dbc" for consistency and updated Flyway configurations to separate DB and R2DBC settings. These changes improve clarity and maintenance of configuration files.
#deploy-levende-arbeidsforhold-ansettelse

Updated the application.yaml to replace the spring datasource configuration with a flyway configuration for the test environment. This change is intended to streamline database migrations during testing.
#deploy-levende-arbeidsforhold-ansettelse

Updated the database URLs in the production configuration file to include the SSL certificate parameter. This change ensures secure communication with the database using SSL certificates.
#deploy-levende-arbeidsforhold-ansettelse

Simplified the database URLs in `application-prod.yml` by using a single environment variable for each URL. This change reduces redundancy and simplifies the configuration management.
#deploy-levende-arbeidsforhold-ansettelse

The Flyway URL configuration in the production YAML file now references the correct JDBC URL environment variable. This aligns the configuration with the expected environment setup and fixes potential issues with database migrations.
#deploy-levende-arbeidsforhold-ansettelse

Modified the R2DBC URL to include host, port, and database name, and added username and password fields. This ensures all necessary connection details are properly configured for production.
…sforhold-ansettelse

Enabled R2DBC repositories in the Spring data configuration. Adjusted the R2DBC URL by removing the database name from the URL and added a separate 'name' field for the database. This improves clarity and consistency in database configuration settings.
…loy-levende-arbeidsforhold-ansettelse

Enabled WebFlux in the application configuration for reactive web support. Removed redundant R2DBC repository settings and obsolete environment variables, streamlining the configuration files.
…e-arbeidsforhold-ansettelse

Removed unused 'database' and 'HikariCP' dependencies. Added 'spring-boot-starter-security' to enhance security features. These changes streamline the project dependencies and improve maintenance.
…rhold-ansettelse

This change replaces the OAuth2 client dependency with the OAuth2 resource server dependency in build.gradle. This adjustment is necessary to align with the security requirements for handling resource server functionalities in the application.
…nde-arbeidsforhold-ansettelse

Introduced a new bean to configure a PostgreSQL connection factory when the 'prod' profile is active. This setup utilizes environment variables for connection details.
#deploy-levende-arbeidsforhold-ansettelse

Moved the @Profile("dev") annotation to the class level to streamline configuration. Updated liveness and readiness probe paths and delays in config.yml for better alignment with the new health endpoints.
#deploy-levende-arbeidsforhold-ansettelse

Eliminated hardcoded production database connection settings. Enabled auto-configuration for R2DBC auditing and repositories. Adjusted application-dev.yml for cleaner configuration.
#deploy-levende-arbeidsforhold-ansettelse

Added a validation query to the database connection pool configuration in the application-prod.yml file. This ensures the connection's health is checked by running a simple query, enhancing reliability.
krharum and others added 30 commits October 21, 2024 14:07
#deploy-levende-arbeidsforhold-ansettelse

Updated R2DBC settings in YAML files to support dynamic database configuration. Introduced ConnectionFactory bean in ApplicationConfig to dynamically configure connection-related parameters. Added new configuration settings for both production and development environments.
#deploy-levende-arbeidsforhold-ansettelse

Introduced protocol field in R2DBC configuration to enhance flexibility. Adjusted configurations to conditionally include host and protocol options if they are present. Updated application configuration files to use the new protocol setting.
Add protocol support for R2DBC configuration
#deploy-levende-arbeidsforhold-ansettelse

Replaced custom R2DBC configurations with Spring's built-in settings in application YAML files and annotated out manual configuration in Java. This streamlines database connectivity and simplifies future maintenance.
#deploy-levende-arbeidsforhold-ansettelse

Changed the R2DBC URL to include specific PostgreSQL connection parameters. This ensures the database connection is properly configured with the required host, port, database name, and SSL settings.
#deploy-levende-arbeidsforhold-ansettelse

Replaced hardcoded SSL path values in the database URL with corresponding environment variable placeholders. This change enhances security and flexibility by centralizing the configuration.
#deploy-levende-arbeidsforhold-ansettelse

This change modifies the root logging level from INFO to DEBUG in the `logback-spring.xml` file. This adjustment enables more detailed logging output for better debugging during development or troubleshooting.
Updated the root logging level from DEBUG to INFO in logback-spring.xml to reduce log verbosity in production. This will help in focusing on important informational messages and errors.
#deploy-levende-arbeidsforhold-ansettelse

Refactored the R2DBC URL structure, separating credentials and SSL properties for clarity. This change improves maintainability and aligns with best practices for secure database connections.
#deploy-levende-arbeidsforhold-ansettelse

Changed database URL to a fixed IP address and commented out the SSL properties. This modification may impact secure connections and should be reviewed prior to production deployment.
#deploy-levende-arbeidsforhold-ansettelse

This change removes the connection pooling from the R2DBC URL in the production application configuration file. It ensures a direct connection to the PostgreSQL database without using a pool.
Remove connection pool configuration
#deploy-levende-arbeidsforhold-ansettelse

Changed the R2DBC URL to include connection pooling and enabled SSL properties with environment-specific variables. This enhances security and connection management for the production database.
#deploy-levende-arbeidsforhold-ansettelse

Added SSL debugging options to JAVA_OPTS for better diagnostics. Changed the SSL mode to VERIFY_FULL in the production configuration to enforce stricter SSL verification.
#deploy-levende-arbeidsforhold-ansettelse

Replaced hard-coded SSL values with environment variables for better configuration flexibility. Adjusted `sslmode` and `sslkey` properties to use respective environment variables.
#deploy-levende-arbeidsforhold-ansettelse

Commented out Flyway URL, username, and password configuration in application-prod.yml. Added a new property to disable Flyway migrations in the production environment.
#deploy-levende-arbeidsforhold-ansettelse
… config (handled by Spring).

#deploy-levende-arbeidsforhold-ansettelse
…PostgreSQL.

- Added full URL with params for R2DBC.
- Removed pool config.
- Commented out ShortenedThrowableConverter (for now).

#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-ansettelse
- Removed pool and repository config (no effect).
- Stack trace no longer cut at 480 chars (for now).
- Enabled debug mode to check bean resolution.

#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-ansettelse
- Attempting to name bean.

#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-service
- Fjerner com.google.cloud.sql:cloud-sql-connector-r2dbc-postgres.

#deploy-levende-arbeidsforhold-ansettelse
… URL i spring.r2dbc.url.

- Flytter @EnableR2dbc* til @SpringBootApplication, for oversikt.
- Retter config for test (annet format URL for R2dbc mot H2).
- Context-testen dobbeltsjekker at vi får en R2dbcEntityTemplate bean (fra AbstractR2dbcConfiguration).
- Lagt til io.r2dbc:r2dbc-h2 som test dependency.
- Erstattet org.postgresql:r2dbc-postgresql med io.r2dbc:r2dbc-postgresql som runtime dependency.

#deploy-levende-arbeidsforhold-ansettelse
#deploy-levende-arbeidsforhold-ansettelse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants