case 4203

This commit is contained in:
2022-09-30 23:57:14 +00:00
parent d07e1367c8
commit 163dada504
4 changed files with 40 additions and 15 deletions

2
.vscode/launch.json vendored
View File

@@ -64,7 +64,7 @@
"AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
//"AYANOVA_REMOVE_LICENSE_FROM_DB":"true",
//"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",

View File

@@ -6,7 +6,7 @@ The Backup [form](ay-start-form-overview.md) is used to view and control automat
## Authorization Roles required
Many roles can *select* this object on other records where approriate. Editing or viewing this object in detail is only available to Users with the following [roles](ay-biz-admin-roles.md):
Many roles can _select_ this object on other records where approriate. Editing or viewing this object in detail is only available to Users with the following [roles](ay-biz-admin-roles.md):
Full access
@@ -56,11 +56,23 @@ The only **certain** way to know if a backup is good is to test restore it from
## Best practices for disaster recovery
You should consider potential disaster scenarios appropriate to your region or the region where your AyaNova server is located. Ideally you want your backups to be stored in a location far enough away from your server to not be affected by the scope of a disaster that happens in your region but close enough at hand that you can access the backup in a timely manner to get back up and running again.
AyaNova backs up to it's own server's **local** drive only. This is **not a full backup solution** only a partial one; you also need to store copies of the backups **off site** from the AyaNova server in case of hardware failure, natural disaster, theft etc.
A backup only stored on the same server (or even in the same building) as the live data is no backup at all if hardware fails or a server is stolen or burns down in a fire.
A backup only stored on the same server (or even in the same building) as the live data is no backup at all if hardware fails or a server is stolen or destroyed in a disaster.
You should regularly download the backups for storage to a secure off-site location from the AyaNova server. Also keep in mind recovery time, if the data is stored in a location that is hard to access it will add to the time taken to recover the server and be back in business should there be a loss of data.
You should regularly download the backups for storage to a secure off-site location from the AyaNova server. Also keep in mind recovery time, if the data is stored in a location that is hard to access in a disaster it will add to the time taken to recover the server and be back in business should there be a loss of data.
### Subscription AyaNova service for disaster relief
AyaNova backups made on a self hosted Perpetually licensed AyaNova are compatible with our Subscription hosted AyaNova service and vice-versa.
If you are running AyaNova locally and lose your hardware in a disaster and have a backup available we can have you up and running quickly by restoring your data to our AyaNova subscription service platform which can is available on a low cost monthly basis.
Your service business can be back up and running quickly from anywhere on the internet even if your office and server are still inaccessible due to disaster.
The data can be moved back to your own server at a later date when your office and hardware are accessible again.
### Backup the configuration
@@ -90,11 +102,11 @@ To restore from backup see the [restore guide](ops-restore.md).
### Backup time
Choose a time for the automatic backup when the server will be least busy. Usually this will be set to a value just before midnight for most sites.
Choose a time for the automatic backup when the server will not be in use by Users.
**Windows server IIS Warning** if you are hosting AyaNova via IIS on Windows be aware that there is a setting in IIS that will regularly restart AyaNova automatically and it must be adjusted to not conflict with the backup time and general usage.
If you're not sure then double check the IIS installation instructions [Application Pool settings](ops-install-windows-iis.md#edit-application-pool).
If you're not sure then double check the IIS installation instructions [Application Pool settings](ops-install-windows-iis.md#74-edit-application-pool).
### Backup attachment files
@@ -104,7 +116,11 @@ Checking this box will cause AyaNova to also back up the attached files in addit
### Number of backups to keep
The backup system will automatically remove old backups depending upon this setting. If it is set to 3 then the most recent three days worth of backups are kept.
`Perpetually licensed AyaNova only`
_AyaNova Subscription service keeps one backup by default and this option is not available_
The backup system will automatically remove old backups depending upon this setting. If it is set to 3 then the most recent three backups are kept.
If you are following a policy of 10 backup rotation as suggested above then you would really only need to keep 1 or 2 current backups.
@@ -129,3 +145,5 @@ Attachment backups are `.zip` files and database backups are Postgress standard
### Menu option: Backup now
The Backup now menu option does exactly that: an on demand instant backup. This is useful for testing purposes or after large changes are made that you would like to ensure have been backed up. This will generate a manual backup that is not part of the normal automated backup process.
Note that this backup will cause older backups to be pruned (deleted) as per the [number of backups to keep](#number-of-backups-to-keep) setting.

View File

@@ -19,7 +19,7 @@ namespace AyaNova.Biz
{
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("CoreJobBackup");
private static bool BackupIsRunning = false;
private const int MAXIMUM_MS_ALLOWED_FOR_PROCESSING = 5 * 60 * 1000;//wild assed guess 5 minutes maximum to run backup command, ever
private const int MAXIMUM_MS_ALLOWED_FOR_PROCESSING = 10 * 60 * 1000;//wild assed guess 10 minutes maximum to run backup command, ever
////////////////////////////////////////////////////////////////////////////////////////////////
// BACK-THE-FUCK-UP
@@ -51,7 +51,7 @@ namespace AyaNova.Biz
//LOCK DOWN SERVER
apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
apiServerState.SetClosed("BACKUP RUNNING");
var jobstartmessage = $"LT:Backup LT:StartJob {(OnDemand ? "manual / on demand" : "scheduled") } ";
var jobstartmessage = $"LT:Backup LT:StartJob {(OnDemand ? "manual / on demand" : "scheduled")} ";
await JobsBiz.LogJobAsync(Guid.Empty, jobstartmessage);
DateTime dtStartBackup = DateTime.Now;
@@ -114,7 +114,14 @@ namespace AyaNova.Biz
//PRUNE DATA BACKUP SETS NOT KEPT
await JobsBiz.LogJobAsync(Guid.Empty, $"LT:BackupDeleteOld");
//case 4203
#if (SUBSCRIPTION_BUILD)
FileUtil.DatabaseBackupCleanUp(1);
#else
FileUtil.DatabaseBackupCleanUp(ServerGlobalOpsSettingsCache.Backup.BackupSetsToKeep);
#endif
//v.next - COPY TO ONLINE STORAGE
//***************

View File

@@ -16,7 +16,7 @@ namespace AyaNova.Models
DateTime utcNow = DateTime.UtcNow;
Id = 1;
BackupTime = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 23, 59, 0, DateTimeKind.Local).ToUniversalTime();
BackupSetsToKeep = 3;
BackupSetsToKeep = 1;
Active = true;
}
}