Skip to content

Commit

Permalink
Merge pull request #621 from Sitecore/rc/1.11.0
Browse files Browse the repository at this point in the history
Rc/1.11.0
  • Loading branch information
AndreyFilchenkov authored Sep 28, 2021
2 parents 0dcd9f2 + 20932df commit 0c96e42
Show file tree
Hide file tree
Showing 22 changed files with 441 additions and 50 deletions.
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@
4. [Developer Center](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/API)
5. [Contact Us](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Support)

Note, we are in progress of migrating from bitbucket to github so don't be confused by some of the links pointing back to bitbucket.

### Features

#### Global Features

1. **List** Sitecore websites installed locally and their modules
2. **Install** new Sitecore standalone product
3. **Install** Sitecore modules and packages
4. **Download** Sitecore products from SDN and DEV
5. **Back up** Sitecore websites, and **Restore** them
6. **Export** Sitecore website and **Import** it on remote computer
3. [**Install** Sitecore modules and packages](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Install-packages)
4. **Download** Sitecore products from https://dev.sitecore.net
5. **Back up** Sitecore websites, and **Restore** them *(available only for Sitecore 8.2 and earlier)*
6. **Export** Sitecore website and **Import** it on remote computer *(available only for Sitecore 8.2 and earlier)*
7. **Delete** Sitecore websites
8. **Reinstall** Sitecore website
8. **Reinstall** Sitecore websites
9. **Install** Solr
10. **Deploy** Sitecore to Docker

#### Open in Browser

* Open website
* Open Sitecore Client
* Open Sitecore Client ([bypassing security, logging in as admin](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Log-in-admin))
* Open [Support Toolbox](https://bitbucket.org/sitecoresupport/sitecore-support-toolbox)
* Open [administrative tools](https://doc.sitecore.com/en/developers/101/platform-administration-and-architecture/enable-and-disable-an-administrative-tool.html)

#### Open applications

* Open Website folder
* Open Visual Studio 2012 project (create project if missing)
* Open Visual Studio project (create project if missing)
* Open web.config and other *.config files
* Open `showconfig.xml` configuration
* Open current log file in Dynamic Log Viewer
* Open entire log files in [Sitecore Log Analyzer](http://marketplace.sitecore.net/Modules/Sitecore_Log_Analyzer.aspx)
* Open entire log files in [Sitecore Log Analyzer](http://dl.sitecore.net/updater/scla)

#### Change website

Expand Down Expand Up @@ -80,16 +80,16 @@ Note, we are in progress of migrating from bitbucket to github so don't be confu
* Predefined configurations (Enable MVC, Scaling ...)
* Delete All Instances - wizard for deleting all installed Sitecore instances
* Update Licenses - Updating Sitecore license file in all installed Sitecore instances
* [SSPG](https://marketplace.sitecore.net/en/Modules/Sitecore_Support_Package_Generator.aspx) - Sitecore Support Package Generator for collecting detailed information about an instance
* Publish Dialog - executing Sitecore publishing in application
* [SSPG](https://dl.sitecore.net/updater/sspg) - Sitecore Support Package Generator for collecting detailed information about an instance
* Publish Dialog - executing Sitecore publishing in application *(available only for Sitecore 8.2 and earlier)*

### Prerequisites

SIM will only work:

* on **Windows 7+**, or **Windows Server 2008 R2+**
* with `Administrator` permissions
* with direct internet access (no proxy)
* with direct Internet access (no proxy)
* when **IIS is pre-configured** with all necessary features (check Sitecore installation guide for details)

For `Sitecore 9.0`:
Expand All @@ -102,8 +102,12 @@ For `Sitecore 7.5, 8.0, 8.1 and 8.2`:

### Known Issues

* [SQL Server integrated security is not supported](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/KnownIssue-IntegratedSecurity)
* [IIS ip bindings are not supported](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/KnownIssue-IpBindings)
* [Outdated download link to Microsoft Web Platform Installer](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Outdated-Download-Link-to-Microsoft-Web-Platform-Installer)
* [SQL Server integrated security is not supported](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Integrated-Security)
* [HTTPS or IP-based Bindings are not supported](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-IP-Bindings)
* [Sitecore environment can use only the default HTTPS port 443](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Sitecore-Uses-Only-Default-HTTPS-port)
* [SQL Server 2012 or 2014 default user account is not supported](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Sql-Server-Default-Account)
* [Automatic upgrade to SIM 1.6 is not supported](https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Upgrade-to-SIM-1.6)

### Supported Products

Expand Down
24 changes: 21 additions & 3 deletions src/SIM.Instances/Instance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,17 @@ protected virtual string GetDataFolderPath()
}
catch (Exception ex)
{
var rootData = Path.Combine(Path.GetDirectoryName(WebRootPath), "Data");
if (FileSystem.FileSystem.Local.Directory.Exists(rootData))
string rootData = Path.Combine(Path.GetDirectoryName(WebRootPath), "Data");
if (this.IsValidDataFolderPath(rootData, ex))
{
Log.Error(ex, $"Cannot get data folder of {WebRootPath}");
return rootData;
}

// InvalidOperationException occurs when the RuntimeSettingsAccessor.GetWebConfigResult method fails due to missing <sitecore> node (e.g. in xConnect, Identity Server, etc.)
// In this case, the log file folder can be resolved manually
rootData = FileSystem.FileSystem.Local.Directory.MapPath("App_data", WebRootPath);
if (this.IsValidDataFolderPath(rootData, ex))
{
return rootData;
}

Expand All @@ -662,6 +668,18 @@ protected virtual string GetDataFolderPath()
}
}

private bool IsValidDataFolderPath(string rootData, Exception ex)
{
if (FileSystem.FileSystem.Local.Directory.Exists(rootData))
{
Log.Error(ex, $"Cannot get data folder of {WebRootPath}");

return true;
}

return false;
}

protected virtual bool GetIsHidden()
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<Compile Include="Validation\Validators\LicenseFileValidatorTests.cs" />
<Compile Include="Validation\Validators\NugetToolPresenceValidatorTests.cs" />
<Compile Include="Validation\Validators\PathExistsValidatorTests.cs" />
<Compile Include="Validation\Validators\PrerequisitesDownloadLinksValidatorTests.cs" />
<Compile Include="Validation\Validators\SolrServiceValidatorTests.cs" />
<Compile Include="Validation\Validators\SqlPefixValidatorTests.cs" />
<Compile Include="Validation\Validators\SqlVersionValidatorTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System.Collections.Generic;
using System.Linq;
using AutoFixture;
using NSubstitute;
using SIM.Sitecore9Installer.Tasks;
using SIM.Sitecore9Installer.Validation;
using SIM.Sitecore9Installer.Validation.Validators;
using Xunit;

namespace SIM.Sitecore9Installer.Tests.Validation.Validators
{
public class PrerequisitesDownloadLinksValidatorTests
{
private const string KnownIssueMessage = "{0}: the '{1}' parameter contains the following link that is not accessible:\n\n{2}\n\nThis behavior looks to be related to the following known issue:\n\n{3}\n\nPlease try to apply the solution mentioned there.";

private const string InvalidLinkMessage = "{0}: the '{1}' parameter contains the following link that is not accessible:\n\n{2}\n\nPlease check the Internet connection and the link accessibility in a browser.\n\nThis behavior may also occur due to similar symptoms described in the following known issue:\n\n{3}";

private const string InvalidValueMessage = "{0}: the '{1}' parameter contains the following invalid value:\n\n{2}\n\nIt should contain download link that starts with '{3}'.";

[Theory]
[InlineData("Prerequisites", "WebPlatformDownload", "https://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi", 1, KnownIssueMessage)]
[InlineData("Global", "WebPlatformDownload", "https://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi", 0, "")]
[InlineData("Prerequisites", "SQLODBCDriversx64", "https://download.microsoft.com/download/D/5/E/D5EEF288-A277-45C8-855B-8E2CB7E25B96/x64/msodbcsql.msi", 0, "")]
[InlineData("Prerequisites", "SQLODBCDriversx64", "https://download.microsoft.com/download/test", 1, InvalidLinkMessage)]
[InlineData("Prerequisites", "SQLODBCDriversx64", "test", 0, "")]
[InlineData("Prerequisites", "DotNetHostingDownload", "https://download.microsoft.com/download/6/E/B/6EBD972D-2E2F-41EB-9668-F73F5FDDC09C/dotnet-hosting-2.1.3-win.exe", 0, "")]
[InlineData("Prerequisites", "DotNetHostingDownload", "test", 1, InvalidValueMessage)]
public void EvaluateTests(string taskName, string paramName, string paramValue, int warningsCount, string message)
{
// Arrange
var fixture = new Fixture();
GlobalParameters globals = new GlobalParameters();
Task prerequisitesTask = Substitute.For<Task>(taskName, fixture.Create<int>(), null, null, new Dictionary<string, string>());
InstallParam downloadLinkParam = new InstallParam(paramName, paramValue, false, InstallParamType.String);
List<InstallParam> paramList = new List<InstallParam>
{
downloadLinkParam
};
LocalParameters locals = new LocalParameters(paramList, globals);
prerequisitesTask.LocalParams.Returns(locals);

PrerequisitesDownloadLinksValidator validator = Substitute.ForPartsOf<PrerequisitesDownloadLinksValidator>();
validator.Data["ParamNamePostfix"] = "Download";
validator.Data["ParamValuePrefixes"] = "http://|https://";
List<string> paramValuePrefixes = validator.Data["ParamValuePrefixes"].Split('|').ToList();

// Act
IEnumerable<ValidationResult> result = validator.Evaluate(new Task[] {prerequisitesTask});
IEnumerable<ValidationResult> warnings = result.Where(r => r.State == ValidatorState.Warning);

// Assert
Assert.Equal(warnings.Count(), warningsCount);
if (message == KnownIssueMessage || message == InvalidLinkMessage)
{
this.ValidateMessage(warnings, message, taskName, paramName, paramValue, validator.KnownIssueLink);
}
else
{
this.ValidateMessage(warnings, message, taskName, paramName, paramValue, string.Join("' or '", paramValuePrefixes));
}
}

private void ValidateMessage(IEnumerable<ValidationResult> warnings, string message, string taskName, string paramName, string paramValue, string paramChangeable)
{
if (!string.IsNullOrEmpty(message))
{
message = string.Format(message, taskName, paramName, paramValue, paramChangeable);
Assert.Contains(warnings, warning => warning.Message.Equals(message));
}
}
}
}
1 change: 1 addition & 0 deletions src/SIM.Sitecore9Installer/SIM.Sitecore9Installer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<Compile Include="Validation\Validators\AppPoolSiteValidator.cs" />
<Compile Include="Validation\Validators\CmDdsPatchSiteNameValidator.cs" />
<Compile Include="Validation\Validators\PathExistsValidator.cs" />
<Compile Include="Validation\Validators\PrerequisitesDownloadLinksValidator.cs" />
<Compile Include="Validation\Validators\SolrVersionValidator.cs" />
<Compile Include="Validation\Validators\SolrServiceValidator.cs" />
<Compile Include="Validation\Validators\SqlPefixValidator.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using SIM.Sitecore9Installer.Tasks;

namespace SIM.Sitecore9Installer.Validation.Validators
{
public class PrerequisitesDownloadLinksValidator : BaseValidator
{
public override string SuccessMessage => "Prerequisites download links are valid.";

protected virtual string TaskName => "Prerequisites";

// parameter to validate the following known issue: https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Outdated-Download-Link-to-Microsoft-Web-Platform-Installer
public virtual string WebPlatformDownload => "WebPlatformDownload";

public virtual string KnownIssueLink => "https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Known-Issue-Outdated-Download-Link-to-Microsoft-Web-Platform-Installer";

protected override IEnumerable<ValidationResult> GetErrorsForTask(Task task, IEnumerable<InstallParam> paramsToValidate)
{
string paramNamePostfix = string.Empty;
if (this.Data.ContainsKey("ParamNamePostfix"))
{
paramNamePostfix = this.Data["ParamNamePostfix"];
}

List<string> paramValuePrefixes = new List<string>();
if (this.Data.ContainsKey("ParamValuePrefixes"))
{
paramValuePrefixes = this.Data["ParamValuePrefixes"].Split('|').ToList();
}

if (!string.IsNullOrEmpty(paramNamePostfix) && paramValuePrefixes.Count > 0)
{
if (task.Name.Equals(TaskName, StringComparison.InvariantCultureIgnoreCase))
{
foreach (InstallParam installParam in paramsToValidate)
{
if (paramValuePrefixes.Any(paramValuePrefix => installParam.Value.StartsWith(paramValuePrefix, StringComparison.InvariantCultureIgnoreCase)))
{
if (!this.IsDownloadLinkValid(installParam.Value))
{
if (installParam.Name == this.WebPlatformDownload)
{
yield return new ValidationResult(ValidatorState.Warning,
$"{TaskName}: the '{installParam.Name}' parameter contains the following link that is not accessible:\n\n{installParam.Value}\n\nThis behavior looks to be related to the following known issue:\n\n{KnownIssueLink}\n\nPlease try to apply the solution mentioned there.",
null);
}
else
{
yield return new ValidationResult(ValidatorState.Warning,
$"{TaskName}: the '{installParam.Name}' parameter contains the following link that is not accessible:\n\n{installParam.Value}\n\nPlease check the Internet connection and the link accessibility in a browser.\n\nThis behavior may also occur due to similar symptoms described in the following known issue:\n\n{KnownIssueLink}",
null);
}
}
}
else if (installParam.Name.EndsWith(paramNamePostfix, StringComparison.InvariantCultureIgnoreCase))
{
yield return new ValidationResult(ValidatorState.Warning,
$"{TaskName}: the '{installParam.Name}' parameter contains the following invalid value:\n\n{installParam.Value}\n\nIt should contain download link that starts with '{string.Join("' or '", paramValuePrefixes)}'.",
null);
}
}
}
}
}

private bool IsDownloadLinkValid(string link)
{
using (HttpClient authClient = new HttpClient())
{
try
{
var response = authClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, new Uri(link))).Result;
if (response.IsSuccessStatusCode)
{
return true;
}
}
catch
{
return false;
}
}

return false;
}
}
}
3 changes: 2 additions & 1 deletion src/SIM.Tool.Base/Pipelines/ReinstallWizardArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public ReinstallWizardArgs(Instance instance, SqlConnectionStringBuilder connect

public override ProcessorArgs ToProcessorArgs()
{
if (int.Parse(this.Instance.Product.ShortVersion) >= 90)
Instance.InstanceType instanceType = this.Instance.Type;
if (instanceType == Instance.InstanceType.Sitecore9AndLater || instanceType == Instance.InstanceType.SitecoreMember)
{
return new Reinstall9Args(this.Tasker);
}
Expand Down
22 changes: 22 additions & 0 deletions src/SIM.Tool.Windows/LogFileFolder/LogFileFolderFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using SIM.Instances;

namespace SIM.Tool.Windows.LogFileFolder
{
public static class LogFileFolderFactory
{
public static LogFileFolderResolver GetResolver(Instance instance)
{
if (instance.Type == Instance.InstanceType.SitecoreMember)
{
return new SitecoreMembersLogFileFolderResolver(instance);
}

return new SitecoreDefaultLogFileFolderResolver(instance);
}

public static LogFileFolderResolver GetDefaultResolver(Instance instance)
{
return new SitecoreDefaultLogFileFolderResolver(instance);
}
}
}
7 changes: 7 additions & 0 deletions src/SIM.Tool.Windows/LogFileFolder/LogFileFolderResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SIM.Tool.Windows.LogFileFolder
{
public abstract class LogFileFolderResolver
{
public abstract string GetLogFolder();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.IO;
using SIM.Extensions;
using SIM.Instances;

namespace SIM.Tool.Windows.LogFileFolder
{
public class SitecoreDefaultLogFileFolderResolver : LogFileFolderResolver
{
private readonly Instance _instance;

public SitecoreDefaultLogFileFolderResolver(Instance instance)
{
this._instance = instance;
}

public override string GetLogFolder()
{
var dataFolderPath = _instance.DataFolderPath;

FileSystem.FileSystem.Local.Directory.AssertExists(dataFolderPath, "The data folder ({0}) of the {1} instance doesn't exist".FormatWith(dataFolderPath, _instance.Name));

return Path.Combine(dataFolderPath, "logs");
}
}
}
Loading

0 comments on commit 0c96e42

Please sign in to comment.