feat(docker): Gracefully reload Caddy configuration
All checks were successful
Caddy Manager CI build / docker (push) Successful in 11m33s
All checks were successful
Caddy Manager CI build / docker (push) Successful in 11m33s
This commit is contained in:
@@ -16,6 +16,12 @@ public class DockerServiceConfiguration
|
||||
/// Uri to the Docker host
|
||||
/// </summary>
|
||||
public string DockerHost { get; set; } = "unix:///var/run/docker.sock";
|
||||
|
||||
/// <summary>
|
||||
/// Path to the Caddyfile as seen from inside the Caddy container, used by `caddy reload`. Must match the
|
||||
/// container side of the Caddy container's config volume mount.
|
||||
/// </summary>
|
||||
public string CaddyConfigPathInContainer { get; set; } = "/etc/caddy/Caddyfile";
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Docker host with environment check. If the environment variable DOCKER_HOST is set, it will return
|
||||
|
||||
17
CaddyManager.Contracts/Docker/CaddyReloadResponse.cs
Normal file
17
CaddyManager.Contracts/Docker/CaddyReloadResponse.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace CaddyManager.Contracts.Docker;
|
||||
|
||||
/// <summary>
|
||||
/// Result of a graceful Caddy configuration reload
|
||||
/// </summary>
|
||||
public class CaddyReloadResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether Caddy accepted and applied the configuration
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Output from Caddy when the reload failed, typically the configuration validation error
|
||||
/// </summary>
|
||||
public string Message { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -10,4 +10,11 @@ public interface IDockerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task RestartCaddyContainerAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Method to gracefully reload the Caddy configuration without restarting the container. Caddy validates the
|
||||
/// configuration before applying it, so a broken configuration leaves the running one untouched.
|
||||
/// </summary>
|
||||
/// <returns>Whether the reload succeeded, along with Caddy's output when it did not</returns>
|
||||
Task<CaddyReloadResponse> ReloadCaddyContainerAsync();
|
||||
}
|
||||
Reference in New Issue
Block a user