Ejemplo n.º 1
0
        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}.");
                }
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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());
        }