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

[Backport 1.26.x] Support loading the xml configuration from a read-only filesystem #1377

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

geoserver-bot
Copy link
Collaborator

Backport #1375
Authored by: @groldan

…irectories

Enhance `XMLFileResourceProvider` to allow GeoWebCache to start with a
read-only configuration directory and `geowebcache.xml` file. Previously, the provider
assumed that the configuration directory was always writable, which caused startup
failures when running in environments with restricted file permissions.

- **Support read-only configuration directories**:
  - `hasInput()` now correctly returns `true` if the configuration file
     exists or if a template is available and the directory is writable.
  - `hasOutput()` ensures that the configuration file can be written before
     allowing output operations.
  - Improved error handling when checking directory and file writability.

- **Refactored file existence checks**:
  - Consolidated logic for checking configuration file existence and writability
    into `findConfigFile()`.
  - Moved the directory writability check from `findConfigFile()` to
    `findOrCreateConfFile()` to prevent premature failures.

- **Improved logging and exception handling**:
  - `hasInput()` and `hasOutput()` now log warnings when encountering errors
     instead of failing silently.
  - `findOrCreateConfFile()` now explicitly throws an exception when it cannot
     create a new configuration file due to permission issues.

- GeoWebCache can now start successfully with a pre-existing, read-only configuration directory.
- Configurations stored in a read-only filesystem (e.g., mounted from a
  read-only volume) can still be used without requiring write access.
- The provider only attempts to create a configuration file when explicitly
  required, eliminating side effects from query methods `hasInput()` and
  `hasOutput()`.

This change improves the resilience of GeoWebCache in constrained environments
while maintaining backward compatibility for writable configurations.
@groldan groldan merged commit f0c7f32 into 1.26.x Feb 24, 2025
10 checks passed
@groldan groldan deleted the backport-1375-to-1.26.x branch February 24, 2025 16:39
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