public async Task InstallAsync() { InstalledApps = new List <Installable>(); string tenant = TenantConvention.GetTenant(this.Url); InstallerLog.Verbose($"Creating database {tenant}."); var db = new DbInstaller(tenant); await db.InstallAsync().ConfigureAwait(false); InstallerLog.Verbose("Getting installables."); var installables = GetInstallables(tenant); foreach (var installable in installables) { try { InstallerLog.Verbose($"Installing module {installable.ApplicationName}."); await new AppInstaller(tenant, tenant, installable).InstallAsync().ConfigureAwait(false); } catch (Exception ex) { InstallerLog.Error(ex.Message); InstallerLog.Error($"Could not install module {installable.ApplicationName}."); } } }
private void Do(ApprovedDomain site) { string url = site.DomainName; InstallerLog.Verbose($"Installing frapid on domain {url}."); try { var installer = new Installer.Tenant.Installer(url, false); installer.Notification += delegate(object sender, string message) { if (message.StartsWith("Error")) { this.OnError(sender, message); } else { this.OnNotification(sender, message); } }; installer.InstallAsync().GetAwaiter().GetResult(); DbInstalledDomains.AddAsync(site).GetAwaiter().GetResult(); new InstalledDomainSerializer().Add(site); } catch (Exception ex) { InstallerLog.Error("Could not install frapid on {url} due to errors. Exception: {Exception}", url, ex); throw; } }
private void Notify(object sender, string message) { if (message.StartsWith("Error")) { InstallerLog.Error(message); } else { InstallerLog.Verbose(message); } var notificationReceived = this.Notification; notificationReceived?.Invoke(sender, message); }
public void Execute(IJobExecutionContext context) { string url = context.JobDetail.Key.Name; InstallerLog.Verbose($"Installing frapid on domain {url}."); try { var installer = new Tenant.Installer(url); installer.InstallAsync().Wait(); var site = new ApprovedDomainSerializer().Get().FirstOrDefault(x => x.DomainName.Equals(url)); DbInstalledDomains.AddAsync(site).Wait(); new InstalledDomainSerializer().Add(site); } catch (Exception ex) { InstallerLog.Error("Could not install frapid on {url} due to errors. Exception: {Exception}", url, ex); throw; } }
private static IStore GetDbServer(string tenant) { var site = TenantConvention.GetSite(tenant); string providerName = site.DbProvider; try { var iType = typeof(IStore); var members = iType.GetTypeMembers <IStore>(); foreach (var member in members.Where(member => member.ProviderName.Equals(providerName))) { return(member); } } catch (Exception ex) { InstallerLog.Error("{Exception}", ex); throw; } return(new PostgreSQL()); }