diff --git a/.vscode/launch.json b/.vscode/launch.json index 81598112..3f88bf8e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -38,28 +38,28 @@ // "command": "xdg-open" // } // }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development", - "AYANOVA_JWT_SECRET": "UNLICENSED5G*QQJ8#bQ7$Xr_@sXfHq4", - //"AYANOVA_SET_SUPERUSER_PW": "l3tm3in", - "AYANOVA_LOG_LEVEL": "Info", - //"AYANOVA_LOG_LEVEL": "Debug", - // "AYANOVA_LOG_LEVEL": "Trace", - "AYANOVA_DEFAULT_TRANSLATION": "en", - //"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", - "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;CommandTimeout=120;", - //"AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=abraxis;Database=AyaNova;CommandTimeout=120;", - "AYANOVA_USE_URLS": "http://*:7575;", - //"AYANOVA_REPORT_RENDERING_TIMEOUT": "20000", - //"AYANOVA_REPORT_RENDERING_MAX_INSTANCES": "3", - "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", - "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", - "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", - "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", - "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8", - "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\" - }, + "env": { + // "ASPNETCORE_ENVIRONMENT": "Development", + // "AYANOVA_JWT_SECRET": "UNLICENSED5G*QQJ8#bQ7$Xr_@sXfHq4", + // //"AYANOVA_SET_SUPERUSER_PW": "l3tm3in", + // "AYANOVA_LOG_LEVEL": "Info", + // //"AYANOVA_LOG_LEVEL": "Debug", + // // "AYANOVA_LOG_LEVEL": "Trace", + // "AYANOVA_DEFAULT_TRANSLATION": "en", + // //"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", + "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;CommandTimeout=120;", + // //"AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=abraxis;Database=AyaNova;CommandTimeout=120;", + // "AYANOVA_USE_URLS": "http://*:7575;", + // //"AYANOVA_REPORT_RENDERING_TIMEOUT": "20000", + // //"AYANOVA_REPORT_RENDERING_MAX_INSTANCES": "3", + // "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", + // "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", + // "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", + // "AYANOVA_SERVER_TEST_MODE": "false", + // "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", + // "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8", + // "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\" + }, "sourceFileMap": { "/Views": "${workspaceFolder}/Views" } diff --git a/buildWinX64SelfContainedRelease.bat b/buildWinX64SelfContainedRelease.bat index 911fbc37..30ec7ec3 100644 --- a/buildWinX64SelfContainedRelease.bat +++ b/buildWinX64SelfContainedRelease.bat @@ -14,7 +14,7 @@ dotnet publish -c Release -o C:\data\code\raven\dist\win-x64\ayanova\ -r win-x6 rmdir C:\data\code\raven\dist\win-x64\launcher /s/q mkdir C:\data\code\raven\dist\win-x64\launcher cd C:\data\code\raven-launcher\ -dotnet publish -c Release -o C:\data\code\raven\dist\win-x64\launcher\ -r win-x64 --no-self-contained +dotnet publish -c Release -o C:\data\code\raven\dist\win-x64\launcher\ -r win-x64 --self-contained diff --git a/dist/install/windows-pg-standalone/ayanovaserver.iss b/dist/install/windows-pg-standalone/ayanovaserver.iss index f024d10b..b37785de 100644 --- a/dist/install/windows-pg-standalone/ayanovaserver.iss +++ b/dist/install/windows-pg-standalone/ayanovaserver.iss @@ -2,7 +2,7 @@ ; single user or lan only, built in postgres ; external to lan requires different config -#define MyAppName "AyaNova (single user)" +#define MyAppName "AyaNova" #define MyAppVersion "8.0" #define MyAppPublisher "Ground Zero Tech-Works, Inc." #define MyAppURL "https://ayanova.com/" @@ -47,16 +47,16 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ [Files] Source: "C:\data\code\raven\dist\win-x64\ayanova\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\data\code\raven\dist\win-x64\ayanova\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "C:\data\code\raven\dist\win-x64\launcher\appsettings.json"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\data\code\raven\dist\win-x64\launcher\ayanova-launcher.deps.json"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\data\code\raven\dist\win-x64\launcher\ayanova-launcher.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\data\code\raven\dist\win-x64\launcher\{#MyAppLauncherExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\data\code\raven\dist\win-x64\launcher\appsettings.json"; DestDir: "{app}"; Flags: ignoreversion confirmoverwrite +Source: "C:\data\code\raven\dist\win-x64\launcher\*"; DestDir: "{app}\launcher"; Flags: ignoreversion recursesubdirs createallsubdirs +;Source: "C:\data\code\raven\dist\win-x64\launcher\{#MyAppLauncherExeName}"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] -Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppLauncherExeName}";IconFilename: "{app}\logo.ico" -Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppLauncherExeName}"; Tasks: desktopicon +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\launcher\{#MyAppLauncherExeName}"; +;IconFilename: "{app}\logo.ico" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\launcher\{#MyAppLauncherExeName}"; Tasks: desktopicon [Run] -Filename: "{app}\{#MyAppLauncherExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent +Filename: "{app}\launcher\{#MyAppLauncherExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent diff --git a/server/AyaNova/Program.cs b/server/AyaNova/Program.cs index a9e0d042..9c94df36 100644 --- a/server/AyaNova/Program.cs +++ b/server/AyaNova/Program.cs @@ -20,16 +20,70 @@ namespace AyaNova public static void Main(string[] args) { - //https://github.com/npgsql/efcore.pg/issues/2045 - //https://www.npgsql.org/efcore/release-notes/6.0.html#breaking-changes + //https://github.com/npgsql/efcore.pg/issues/2045 + //https://www.npgsql.org/efcore/release-notes/6.0.html#breaking-changes //AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); + //first output + Console.WriteLine($"AYANOVA SERVER {AyaNovaVersion.VersionString} BOOTING ..."); + //Boot lock for generator ServerGlobalOpsSettingsCache.BOOTING = true; //Get config - var config = new ConfigurationBuilder().AddEnvironmentVariables().AddCommandLine(args).Build(); + var config = new ConfigurationBuilder().AddJsonFile("config.json", true).AddEnvironmentVariables().AddCommandLine(args).Build(); + + //Ensure we have critical config values set, if not need to bail with clear message + bool HaveAllCrticalConfigValues = true; ServerBootConfig.SetConfiguration(config); + if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_DB_CONNECTION)) + { + Console.WriteLine($"FAIL: AYANOVA_DB_CONNECTION configuration setting missing and required"); + HaveAllCrticalConfigValues = false; + } + + if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES)) + { + Console.WriteLine($"FAIL: AYANOVA_FOLDER_BACKUP_FILES configuration setting missing and required"); + HaveAllCrticalConfigValues = false; + } + + if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_USER_FILES)) + { + Console.WriteLine($"FAIL: AYANOVA_FOLDER_USER_FILES configuration setting missing and required"); + HaveAllCrticalConfigValues = false; + } + + if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES)) + { + Console.WriteLine($"FAIL: AYANOVA_FOLDER_TEMPORARY_SERVER_FILES configuration setting missing and required"); + HaveAllCrticalConfigValues = false; + } + + if (!HaveAllCrticalConfigValues) + { + Console.WriteLine($"Required configuration settings missing; server can not be started"); + return; + } + + + + + // "AYANOVA_FOLDER_USER_FILES":"%programdata\\ayanova\\userfiles", + // "":"%programdata\\ayanova\\backupfiles", + // "AYANOVA_LOG_LEVEL": "Info", + // "AYANOVA_LOG_PATH":"%programdata\\ayanova\\" + + //Human readable config output to console for diagnosis in case server wont' start + + var AyaNovaConfig = config.AsEnumerable().Where(z => z.Key.StartsWith("AYANOVA") && z.Key != "AYANOVA_JWT_SECRET" && z.Key != "AYANOVA_SET_SUPERUSER_PW").Select(z => z.Key + "=" + z.Value).ToList(); + var DiagConfig = string.Join(",", AyaNovaConfig); + DiagConfig = DbUtil.PasswordRedactedConnectionString(DiagConfig); + Console.WriteLine($"Config {DiagConfig}"); + + + + @@ -163,20 +217,10 @@ namespace AyaNova //This is the first log entry logger.Info($"AYANOVA SERVER {AyaNovaVersion.VersionString} BOOTING"); - Console.WriteLine($"AYANOVA SERVER {AyaNovaVersion.VersionString} BOOTING ..."); + //log configuration - try - { - var AyaNovaConfig = config.AsEnumerable().Where(z => z.Key.StartsWith("AYANOVA") && z.Key != "AYANOVA_JWT_SECRET" && z.Key != "AYANOVA_SET_SUPERUSER_PW").Select(z => z.Key + "=" + z.Value).ToList(); - var DiagConfig = string.Join(",", AyaNovaConfig); - DiagConfig = DbUtil.PasswordRedactedConnectionString(DiagConfig); - logger.Info($"Config {DiagConfig}"); - } - catch (Exception ex) - { - logger.Error(ex, "Error fetching configuration"); - } + logger.Info($"Config {DiagConfig}"); logger.Debug($"Full configuration is {config.GetDebugView()}"); if (ServerBootConfig.AYANOVA_LOG_ENABLE_LOGGER_DIAGNOSTIC_LOG) diff --git a/server/AyaNova/util/ServerBootConfig.cs b/server/AyaNova/util/ServerBootConfig.cs index 076c54f1..79866b17 100644 --- a/server/AyaNova/util/ServerBootConfig.cs +++ b/server/AyaNova/util/ServerBootConfig.cs @@ -183,6 +183,7 @@ namespace AyaNova.Util //Log folder AYANOVA_LOG_PATH = config.GetValue("AYANOVA_LOG_PATH"); + if (AYANOVA_LOG_PATH == null) { //DEFAULT LOG PATH