Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Updated log location for all services (#113)

Leendert de Borstd8cfdc2123b1
diff --git a/.github/workflows/docker-compose-build.yml b/.github/workflows/docker-compose-build.yml
index 2ccc5c233..24814a2f1 100644
--- a/.github/workflows/docker-compose-build.yml
+++ b/.github/workflows/docker-compose-build.yml
@@ -33,7 +33,7 @@ jobs:
# Test if the service on localhost:80 responds
http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80)
if [ "$http_code" -ne 200 ]; then
- echo "Service did not respond with 200 OK"
+ echo "Service did not respond with 200 OK. Check if client app is configured correctly."
exit 1
else
echo "Service responded with 200 OK"
@@ -43,7 +43,7 @@ jobs:
# Test if the service on localhost:81 responds
http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:81)
if [ "$http_code" -ne 200 ]; then
- echo "Service did not respond with expected 200 OK. Check if all DB migrations are applied."
+ echo "Service did not respond with expected 200 OK. Check if WebApi is configured correctly."
exit 1
else
echo "Service responded with $http_code"
@@ -57,3 +57,13 @@ jobs:
else
echo "SmtpService responded on port 2525"
fi
+ - name: Test if localhost:8080 (Admin) responds
+ run: |
+ # Test if the service on localhost:8080 responds
+ http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080)
+ if [ "$http_code" -ne 200 ]; then
+ echo "Service did not respond with expected 200 OK. Check if admin app is configured correctly."
+ exit 1
+ else
+ echo "Service responded with $http_code"
+ fi
diff --git a/docker-compose.yml b/docker-compose.yml
index 20963e201..fe43c0106 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -8,6 +8,7 @@ services:
- "8080:8082"
volumes:
- ./database:/database
+ - ./logs:/logs
restart: always
env_file:
- .env
@@ -31,6 +32,7 @@ services:
- "81:8081"
volumes:
- ./database:/database
+ - ./logs:/logs
env_file:
- .env
restart: always
@@ -45,6 +47,7 @@ services:
- "587:587"
volumes:
- ./database:/database
+ - ./logs:/logs
env_file:
- .env
restart: always
diff --git a/src/AliasVault.Admin/Program.cs b/src/AliasVault.Admin/Program.cs
index ea991e1fc..749d880f5 100644
--- a/src/AliasVault.Admin/Program.cs
+++ b/src/AliasVault.Admin/Program.cs
@@ -22,7 +22,7 @@ using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
builder.Configuration.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true);
-builder.Services.ConfigureLogging(builder.Configuration, Assembly.GetExecutingAssembly().GetName().Name!);
+builder.Services.ConfigureLogging(builder.Configuration, Assembly.GetExecutingAssembly().GetName().Name!, "../../logs");
// Create global config object, get values from environment variables.
Config config = new Config();
diff --git a/src/AliasVault.Api/Program.cs b/src/AliasVault.Api/Program.cs
index 73c88d179..d6d87f8c2 100644
--- a/src/AliasVault.Api/Program.cs
+++ b/src/AliasVault.Api/Program.cs
@@ -23,7 +23,7 @@ using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
builder.Configuration.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true);
-builder.Services.ConfigureLogging(builder.Configuration, Assembly.GetExecutingAssembly().GetName().Name!);
+builder.Services.ConfigureLogging(builder.Configuration, Assembly.GetExecutingAssembly().GetName().Name!, "../../logs");
builder.Services.AddSingleton<ITimeProvider, SystemTimeProvider>();
builder.Services.AddScoped<TimeValidationJwtBearerEvents>();
diff --git a/src/Services/AliasVault.SmtpService/Program.cs b/src/Services/AliasVault.SmtpService/Program.cs
index eb12bd6a5..c9e63546c 100644
--- a/src/Services/AliasVault.SmtpService/Program.cs
+++ b/src/Services/AliasVault.SmtpService/Program.cs
@@ -22,7 +22,7 @@ using AliasVault.WorkerStatus.ServiceExtensions;
var builder = Host.CreateApplicationBuilder(args);
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
builder.Configuration.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true);
-builder.Services.ConfigureLogging(builder.Configuration, Assembly.GetExecutingAssembly().GetName().Name!);
+builder.Services.ConfigureLogging(builder.Configuration, Assembly.GetExecutingAssembly().GetName().Name!, "../../../logs");
// Create global config object, get values from environment variables.
Config config = new Config();
diff --git a/src/Utilities/AliasVault.Logging/LoggingConfiguration.cs b/src/Utilities/AliasVault.Logging/LoggingConfiguration.cs
index 47ddefaa4..61979dc63 100644
--- a/src/Utilities/AliasVault.Logging/LoggingConfiguration.cs
+++ b/src/Utilities/AliasVault.Logging/LoggingConfiguration.cs
@@ -27,8 +27,9 @@ public static class LoggingConfiguration
/// <param name="services">IServiceCollection.</param>
/// <param name="configuration">IConfiguration.</param>
/// <param name="applicationName">The application name to include in the log.</param>
+ /// <param name="logFolder">The folder to log to.</param>
/// <returns>IServiceCollection instance.</returns>
- public static IServiceCollection ConfigureLogging(this IServiceCollection services, IConfiguration configuration, string applicationName)
+ public static IServiceCollection ConfigureLogging(this IServiceCollection services, IConfiguration configuration, string applicationName, string logFolder = "logs/")
{
services.AddSerilog(new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
@@ -42,12 +43,12 @@ public static class LoggingConfiguration
// Log everything to a file.
.WriteTo.Logger(lc => lc
- .WriteTo.File($"logs/{applicationName}-log-.txt", rollingInterval: RollingInterval.Day))
+ .WriteTo.File($"{logFolder}/{applicationName}-log-.txt", rollingInterval: RollingInterval.Day))
// Log all errors and above to a separate file.
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(evt => evt.Level >= LogEventLevel.Error)
- .WriteTo.File($"logs/{applicationName}-error-.txt", rollingInterval: RollingInterval.Day))
+ .WriteTo.File($"{logFolder}/{applicationName}-error-.txt", rollingInterval: RollingInterval.Day))
// Log all warning and above to database via EF core except for Microsoft.EntityFrameworkCore logs
// as this would create a loop.