Skip to content

Conversation

@aviv86
Copy link

@aviv86 aviv86 commented Dec 18, 2025

Closes #1022, #1024, #1025, #1026

Overview

This PR refines the RavenDB hosting integration and addresses several related issues.

Note: this PR addresses several closely related issues (#1022, #1024, #1025, #1026) in the RavenDB hosting integration.
The fixes all share the same underlying changes in RavenDBServerSettings, RavenDBServerResource, endpoint configuration and environment variables. Splitting them into separate PRs would result in overlapping or conflicting changes to the same code paths, so they are being proposed together as a single coherent update.

This PR:

Details

Ports and TCP data port (#1022, #1026)

  • RavenDBServerSettings now exposes optional Port (HTTP) and TcpPort (TCP/data) properties.
  • AddRavenDB uses these when configuring the HTTP and TCP endpoints.
  • The provider also uses the configured TCP port when generating TCP-related environment variables (such as RAVEN_PublicServerUrl_Tcp), while still defaulting to 38888 when no TCP port is specified.

Log bind-mount / volume helpers (#1025)

  • New helpers on IResourceBuilder<RavenDBServerResource>:
    • WithLogBindMount(source, isReadOnly = false)
    • WithLogVolume(name = null, isReadOnly = false)
  • These mirror the existing data-folder helpers but target the RavenDB logs directory.

Optional database creation at startup (#1024)

  • AddDatabase(..., bool ensureCreated = false) now supports creating the database at startup.
  • When ensureCreated is true, the builder uses OnResourceReady to:
    • Resolve the connection string for the database resource.
    • Create a DocumentStore (using a client certificate when configured).
    • Fetch the database record via GetDatabaseRecordOperation and create it with CreateDatabaseOperation if it does not exist.

Secured setups & health checks

  • RavenDBSecuredServerSettings and RavenDBServerResource now carry optional client certificate information.
  • The RavenDB health check uses this certificate when talking to a secured server.
  • The same certificate is reused by the ensureCreated path to talk to the server in secured mode.
  • Connection string and TCP-related environment variables in secured setups are aligned with the configured ports and public URL.

Testing

  • Ran the existing test suite plus new/updated tests covering:
    • Port / TCP port configuration.
    • Log volume helpers.
    • ensureCreated behaviour

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

aviv added 5 commits December 18, 2025 17:00
…w to specify Port via RavenDBServerSetting (issues/1026)
…le that is generated in secured setup - we need to use the PublicServerUrl when we're running in secured setup
…artup (issues/1024) and add ClientCertificate to RavenDBServerSettings and RavenDBServerResource, which will be used by hosting code (health checks, database creation) when connecting to a RavenDB server in secured setups.
@aviv86 aviv86 requested a review from shiranshalom as a code owner December 18, 2025 17:08
Copilot AI review requested due to automatic review settings December 18, 2025 17:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the RavenDB hosting integration by adding configurable port settings, log volume management helpers, and optional database creation at startup. It also improves secured-mode handling by properly threading client certificates through health checks and database operations.

Key changes:

  • Added configurable HTTP and TCP port support via RavenDBServerSettings
  • Added log volume/bind-mount helper methods for RavenDB logs directory
  • Added ensureCreated parameter to AddDatabase for automatic database creation at startup

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
RavenDBServerSettings.cs Added Port and TcpPort properties; fixed typo in comment; added ClientCertificate parameter to secured factory methods
RavenDBServerResource.cs Added PublicServerUrl and ClientCertificate internal properties; updated ConnectionStringExpression to use public URL in secured mode
RavenDBBuilderExtensions.cs Refactored to support configurable ports; added ensureCreated logic with OnResourceReady; added WithLogBindMount and WithLogVolume helpers; improved TCP endpoint configuration
HealthChecksExtensions.cs Added certificate parameter to health check registration methods
AddRavenDBTests.cs Added tests for custom port configuration and log volume/bind-mount helpers
AppHostTests.cs Removed CreateDatabase setting from client configuration
Program.cs (example) Updated to use ensureCreated: true instead of client-side database creation

internal string TcpEndpointName = "tcp";

/// <summary>
/// The public server URL (domain) configured for this resource./>.
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The XML doc comment has a malformed closing tag. The closing summary tag should be </summary> instead of />.

Suggested change
/// The public server URL (domain) configured for this resource./>.
/// The public server URL (domain) configured for this resource.

Copilot uses AI. Check for mistakes.
@aviv86
Copy link
Author

aviv86 commented Dec 18, 2025

@aviv86 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree company="RavenDB"

@github-actions github-actions bot added the Stale label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RavenDb: Add the ability to specify the DataPort

2 participants