Beispiel #1
0
        public static async Task DeployLinuxTemplateToSite(BaseTemplate template, Site site)
        {
            if (template?.MSDeployPackageUrl != null)
            {
                try
                {
                    var  credentials        = new NetworkCredential(site.PublishingUserName, site.PublishingPassword);
                    var  zipManager         = new RemoteZipManager(site.ScmUrl + "zip/", credentials, retryCount: 3);
                    Task zipUpload          = zipManager.PutZipFileAsync("site/wwwroot", template.MSDeployPackageUrl);
                    var  vfsManager         = new RemoteVfsManager(site.ScmUrl + "vfs/", credentials, retryCount: 3);
                    Task deleteHostingStart = vfsManager.Delete("site/wwwroot/hostingstart.html");

                    await Task.WhenAll(zipUpload);

                    if (template.Name.Equals(Constants.PHPWebAppLinuxTemplateName, StringComparison.OrdinalIgnoreCase))
                    {
                        await site.UpdateConfig(
                            new
                        {
                            properties = new
                            {
                                linuxFxVersion     = "PHP|7.2",
                                appCommandLine     = "process.json",
                                alwaysOn           = true,
                                httpLoggingEnabled = true
                            }
                        });
                    }
                    else
                    {
                        await site.UpdateConfig(
                            new
                        {
                            properties = new
                            {
                                linuxFxVersion     = "NODE|9.4",
                                appCommandLine     = "process.json",
                                alwaysOn           = true,
                                httpLoggingEnabled = true
                            }
                        });
                    }
                }
                catch (Exception ex)
                {
                    SimpleTrace.TraceError(ex.Message + ex.StackTrace);
                }
            }
        }
Beispiel #2
0
        public static async Task UpdateVSCodeLinuxAppSettings(Site site)
        {
            SimpleTrace.TraceInformation($"Site AppSettings Update started: for {site.SiteName}->{site.ResourceGroupName}->{site.SubscriptionId}");

            site.AppSettings["SITE_GIT_URL"]      = site.GitUrlWithCreds;
            site.AppSettings["SITE_BASH_GIT_URL"] = site.BashGitUrlWithCreds;
            await Task.WhenAll(site.UpdateConfig(
                                   new
            {
                properties = new
                {
                    appCommandLine     = "process.json",
                    linuxFxVersion     = "NODE|9.4",
                    alwaysOn           = true,
                    httpLoggingEnabled = true
                }
            }), site.UpdateAppSettings());
        }