Create a dev Environment.

Create a dev Environment.


1. clone the project.AzureDevOpsIntegration to a visual studio and eg: CPT_Integration.
use Master Branch for SCC  

dont use master branch  use 9.5x branch     V5.0_sana9x
set false if project is 9.x

https://sanacommerce.visualstudio.com/Sana%20Projects%20Internal%20Tools/_git/AzureDevOpsIntegration?path=%2F&version=GBv5.0_Sana9x&_a=contents

https://sanacommerce.visualstudio.com/Sana%20Projects%20Internal%20Tools/_git/AzureDevOpsIntegration
  

2 Open the project and open the app.config file in the cloned repo

3 Find the section “

MUST: do a backup for beta and live on RDP. on > ProjectfolderBetaLive\@Backup"


3.1 to Fill Following need to Get Live /Beta Data Decrypt values
log to RDP and open CMD as admin 

  1. Run Command Prompt as Administrator
  2. Go to C:\Windows\Microsoft.NET\Framework\v4.0.30319 
  3. cdC:\Windows\Microsoft.NET\Framework\v4.0.30319
  4. Enter this,

ASPNET_REGIIS -pdf "connectionStrings" "E:\backup\live\Frontend"
ASPNET_REGIIS -pdf "securityKeys" "E:\backup\live\Frontend"
ASPNET_REGIIS -pdf "machineKey" "E:\backup\live\Frontend"

check Beta/live and RQS versions are same. 


<add key="Dev_IsSCC" value="false"/>
<appSettings>
    <!--CHANGE THE BELOW SETTINGS=================================================================-->
    <!--Development environment settings-->
    <add key="ProjectName" value="CPT"/><!--CPT GmbH -->
    <add key="Dev_ProjectLocalPath" value="D:\Development"/>
    <add key="Dev_UserEmail" value="s.kodagoda@sana-commerce.com"/>
    <add key="Dev_DbExchangeFolder" value="\\CORP-FS08\fileshare$\ISM-APAC\Fileshare\Sanateam2_GeneralDoc\Exchange"/>
    <add key="Dev_SqlServer" value="CORP-SRL-SQL01\SQL2017_E"/>
    <!--Optional - If these are blank Windows authentication will be used-->
    <add key="Dev_SqlUsername" value=""/>
    <add key="Dev_SqlPassword" value=""/>
    <!--Development environment switches-->
    <add key="Dev_CreateGitRepository" value="true"/>
    <add key="Dev_DeleteGitRepositoryIfExisting" value="true"/>
    <!--This flag has no impact when Dev_CreateGitRepository = false -->
    <add key="Dev_CreateDatabase" value="true"/>
    <add key="Dev_CreateSiteOnIIS" value="false"/>
    <add key="Dev_ConfigureErp" value="false"/>
    <add key="Dev_EnableERPLogging" value="false"/>
    <add key="Dev_EnableMocking" value="false"/>
    <!--ERP settings-->
    <!--AX/AX7/Nas/Nav2009/Nav2013/Soap/SapBusinessOne/Dynamics365ForFinancials/SAP ECC/GP2015-->
    <add key="Dev_ERPConnectionType" value="Nav2013"/>
    <add key="Dev_ERPUrl" value="https://navweb.cpt-werkzeuge.de:7157/DynamicsNAV100_TST_WS1/WS/CPT%20GmbH/Codeunit/SC_NAV_WebService"/>
    <add key="Dev_ERPUserDomain" value=""/>
    <add key="Dev_ERPUsername" value="Sana_TST"/>
    <add key="Dev_ERPPassword" value="Af4398hj58ivj423da!"/>
    <!--Azure DevOps switches-->
    <add key="AzureDevOps_CreateDeploymentPipelines" value="true"/>
    <!--Set this flag to false if the site is hosted in a Virtual Machine-->
    <add key="AzureDevOps_IsWebApp" value="false"/>
    <add key="AzureDevOps_CreateBlobConnection" value="false"/>
    <!--Azure DevOps settings-->
    <!--If you want to get the latest Sana version this should be empty - go and check the starter site repo to know the latest version no-->
    <add key="AzureDevOps_StarterSiteGitRepoBranch" value="9.3.3"/>
    <!--Deployment pipeline specific settings-->
    <!--SL NET 1/SL NET 2/SL NET 3/UA NET 1/UA NET 2-->
    <add key="AzureDevOps_DestinationTeamId" value="SL NET 4"/>
    <!--Id of deployment group which should be intalled on target server before pipeline creation. This value can be updated in pipeline later manually.-->
    <add key="AzureDevOps_DeploymentGroupId" value="0"/>
    <add key="AzureDevOps_BetaSqlServer" value="sharedsanacger.database.cloudapi.de"/>
    <add key="AzureDevOps_BetaSqlDatabaseName" value="CPTBeta"/>
    <add key="AzureDevOps_BetaSqlUsername" value="CPTBeta"/>
    <add key="AzureDevOps_BetaSqlPassword" value="Ils2wbzjmtua0"/>
    <add key="AzureDevOps_LiveSqlServer" value="sharedsanacger.database.cloudapi.de"/>
    <add key="AzureDevOps_LiveSqlDatabaseName" value="CPTLive"/>
    <add key="AzureDevOps_LiveSqlUsername" value="CPTLive"/>
    <add key="AzureDevOps_LiveSqlPassword" value="J8nteh16j9xaq"/>
    <!--These values can also be updated later at the web.config transformations files directly once the development environment is created-->
    <add key="AzureDevOps_MachineValidationKeyBeta" value="ED6205203036A6583187F9F515381F6F3A1B5B1B9543FF876AD5129C6401708A01970ADA785E25661FD329AD171388E5D0C02E41BC8F83C7B327DB8632971E48"/> 
    <add key="AzureDevOps_MachineDecryptionKeyBeta" value="6F5B51BE73F4F55A1B1DF8489DB363E5F76D3667825C7F301E60DF9B9E3930E2"/> 
    <add key="AzureDevOps_MachineValidationKeyLive" value="D7BBFED163764EFDE468F93B1EF617BBB35D2CD88F5D08EABD93998D4B09CE8A38359B0912BAF5B7C038E26ACD71560088C1EF41E769C8D7BD51CBEF3BF22A1D"/>
    <add key="AzureDevOps_MachineDecryptionKeyLive" value="AD09A8AF3011B64DDAA5E2B8AF03C97F0D838726D01BDD6A9C171FE8594897D6"/>
    <add key="AzureDevOps_AESKeyBeta" value="2CBF977BF19E03E7B200C7F8B1522F7F9B1A2ED0D81FD6CF4E5B9548E812F87E"/>
    <add key="AzureDevOps_AESVectorBeta" value="7B680BC4AB275F6092312E228348CD7D"/>
    <add key="AzureDevOps_AESKeyLive" value="82DAE6638E8314FE9254E13C231FB53B6F0A44FE240BAA787DA1813F35379004"/>
    <add key="AzureDevOps_AESVectorLive" value="EF4FC266E64EA0271FE4C1EEFE1FC3E3"/>
    <!--Web App names or Website names of beta and live -->
    <add key="AzureDevOps_BetaWebAppName" value="CPTBeta"/>
    <add key="AzureDevOps_LiveWebAppName" value="CPTLive"/>
    <add key="AzureDevOps_BetaSMTPServer" value="127.0.0.1"/>
    <add key="AzureDevOps_BetaSMTPPort" value="25"/>
    <add key="AzureDevOps_BetaSMTPUsername" value=""/>
    <add key="AzureDevOps_BetaSMTPPassword" value=""/>
    <add key="AzureDevOps_LiveSMTPServer" value="127.0.0.1"/>
    <add key="AzureDevOps_LiveSMTPPort" value="25"/>
    <add key="AzureDevOps_LiveSMTPUsername" value=""/>
    <add key="AzureDevOps_LiveSMTPPassword" value=""/>
    <!--Azure WebApp specific settings - NOT relevant if a Virtual Machine is used for hosting-->
    <add key="AzureDevOps_BetaBlobAccountName" value=""/>
    <add key="AzureDevOps_BetaBlobUserKey" value=""/>
    <add key="AzureDevOps_LiveBlobAccountName" value=""/>
    <add key="AzureDevOps_LiveBlobUserKey" value=""/>



another example
ØChange the project name. <add key="ProjectName" value="SFSIntec" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_ProjectLocalPath" value="D:\Development" />
ØChange this to your email or an email of a team member. This will be the report address as well. <add key="Dev_UserEmail" value="s.samarasinghe@sana-commerce.com" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_DbExchangeFolder" value="\\CORP-FS08\fileshare$\ISM-APAC\Fileshare\Sanateam1_GeneralDoc\Exchange" />
ØChange this to the development DB server <add key="Dev_SqlServer" value="10.4.8.5" />
Ø 
ØThis doesn’t need to me changed. Keep the default <add key="Dev_CreateGitRepository" value="true" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_CreateDatabase" value="true" />
ØChange this if it is required to publish on local IIS. <add key="Dev_CreateSiteOnIIS" value="false" />
ØThis doesn’t need to me changed. Keep the default. We can change this once we have created the DEV environment. <add key="Dev_ConfigureErp" value="false" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_EnableERPLogging" value="true" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_ERPConnectionType" value="Nav2013" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_ERPUrl" value="https://webservice.mchc.ie:7077/WAREHOUSE/WS/Warehouse%20Test/Codeunit/SC_NAV_WebService" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_ERPUserDomain" value="" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_ERPUsername" value="SC_USER" />
ØThis doesn’t need to me changed. Keep the default <add key="Dev_ERPPassword" value="Sazwsx19!rfb" />
  • Azure DevOps switches. Keep the default. <add key="AzureDevOps_CreateDeploymentPipelines" value="true" />
  • Keep this default if you host the site in VM <add key="AzureDevOps_IsWebApp" value="false" />
  • Keep this default if you don’t use blob connections. <add key="AzureDevOps_CreateBlobConnection" value="false" />
  • Change this to the required version. If it latest SANA version keep it as default (empty). <add key="AzureDevOps_StarterSiteGitRepoBranch" value="" />https://sanacommerce.visualstudio.com/Sana%20Projects%20Internal%20Tools/_git/Ism.SanaCommerce.Startersite.9.x?_a=history
  • Change this to SL NET 2. <add key="AzureDevOps_DestinationTeamId" value="SL NET 2" />
  • Following are the settings for SQL Beta server configuration. Should be changed accordingly.
Ø<add key="AzureDevOps_BetaSqlServer" value="sharedsanaukw.database.windows.net" />
Ø<add key="AzureDevOps_BetaSqlDatabaseName" value="SFSBeta" />
Ø<add key="AzureDevOps_BetaSqlUsername" value="SFSBeta" />
Ø<add key="AzureDevOps_BetaSqlPassword" value="5g*GZ?8k" />


  1. Following are the settings for the SQL Live server configuration. Should be changed accordingly.
Ø<add key="AzureDevOps_LiveSqlServer" value="sharedsananeu.database.windows.net" />
Ø<add key="AzureDevOps_LiveSqlDatabaseName" value="SFSLive" />
Ø<add key="AzureDevOps_LiveSqlUsername" value="SFSLive" />
Ø<add key="AzureDevOps_LiveSqlPassword" value="xJ}69=rE-" />
  1. Configure the Vector keys for Beta. These should be decrypted from the server. Following are the commands. Please change accordingly. Recommend to get a copy of web.config file to a separate location do the decryption and delete after.
ØOpen the command prompt in administrator mode.
ØAnd run it from there. Path can be changed according to the .NET version.C:\windows\Microsoft.NET\Framework64\v2.0.50727
ØRun the command aspnet_regiis.exe -pdf "connectionStrings" D:\Decrypt (copied web.config file location)
ØCut and phaste the SecurityKeys section in the same level where “ConnectionString” section is existed.
ØRun the command aspnet_regiis.exe -pdf "securityKeys" D:\Decrypt (copied web.config file location)
ØFind the AES and AESVector from the decrypted file.
ØRepeat the mentioned steps to Live web.config as well.
ØChange this with your findings <add key="AzureDevOps_AESKeyBeta" value="4FAA96ACD291C888C0A751367A2FD9EBE481C4DB4EF30615EC7E558DEAA8350D" />
ØChange this with your findings <add key="AzureDevOps_AESVectorBeta" value="9CBCD0DBB59346A8993B8BCA9BF10145" />
ØChange this with your findings <add key="AzureDevOps_AESKeyLive" value="15ACBACB12E9F9270527D9DAF5A742353AF2B367341AEAEF5FCB1EED730B95C9" />
ØChange this with your findings <add key="AzureDevOps_AESVectorLive" value="2D99B68FEED5FD64BDE384CD66300A64" />
  1. Change these accordingly. You can find them from the server.
ØBeta web app name <add key="AzureDevOps_BetaWebAppName" value="SFSBeta" />
ØLive web app name <add key="AzureDevOps_LiveWebAppName" value="SFSLive" /
  1. Change the SMTP settings on Beta. You can find them in web.config
Ø<add key="AzureDevOps_BetaSMTPServer" value="127.0.0.1" />
Ø<add key="AzureDevOps_BetaSMTPPort" value="25" />
Ø<add key="AzureDevOps_BetaSMTPUsername" value="" />
Ø<add key="AzureDevOps_BetaSMTPPassword" value="" />
  1. Change the SMTP settings on Beta. You can find them in web.config
Ø<add key="AzureDevOps_LiveSMTPServer" value="127.0.0.1" />
Ø<add key="AzureDevOps_LiveSMTPPort" value="25" />
Ø<add key="AzureDevOps_LiveSMTPUsername" value="" />

Ø<add key="AzureDevOps_LiveSMTPPassword" value="" />


Then Verify from Senior Person and Run the project.


Then Go to AzureDovOps >Pipelines,  Search your Project Pipeline eg : CPT
 Then click  CPT > Edit
and set Agent Specification to  > "windows-2019"






Then Go to Releases >search  All Pipelines > Search Your Project eg: CPT


follow the steps.
Configure the deployment pipelines created by Azure DevOps Inte
https://sanacommerce.visualstudio.com/Sana%20Projects/_wiki/wikis/Sana-Projects.wiki/544/Configure-the-deployment-pipelines-created-by-Azure-DevOps-Integration-Tool

install the deployment agent

https://sanacommerce.visualstudio.com/Sana%20Projects/_wiki/wikis/Sana-Projects.wiki/353/Install-a-deployment-agent-manually


when Creating 

when creating development group add tock to us personal tocken






https://sanacommerce.visualstudio.com/Sana%20Projects/_wiki/wikis/Sana-Projects.wiki/353/Install-a-deployment-agent-manually


  • Click on IIS Deployment main task -> Set the Deployment group as follows


2. Set the newly installed deployment agent in the release pipelines for all the stages available.

  • Azure DevOps -> Releases -> Select the release pipeline -> Click Edit

 Click
 click
for comment






add Deployment group for 
1 Beta 
2 Beta Task service (if have )
3 Live 
4 Live task service (if have )



Then Go to newly created project  and open DeploymentScripts folder
update the Paths Live and Beta



<add key="FrontendFolder" value="D:\Projects\Applications\AptcoInveBeta\Frontend" />
<add key="BackupFolder" value="D:\Projects\Applications\AptcoInveBeta\@Backup" />
<add key="TaskServiceFolder" value="D:\Projects\Applications\AptcoInveBeta\TaskService" />
<add key="TaskServiceName" value="SC Task Service AptcoInveBeta" />
<add key="IgnoreDirectories" value="(content\\files)|(logs)|(temp)|(index)|(Documents)" />

if have Task Service update Task service folder and name also

<add key="TaskServiceFolder" value="D:\Projects\Applications\CaribooOutLive\TaskService" />
<add key="TaskServiceName" value="SC Task Service CaribooOutLive" />

TaskServiceName have to get from RDP > Services > 





<configuration>
    <appSettings>
        <add key="FrontendFolder" value="
        <add key="BackupFolder" value="
        <add key="IgnoreDirectories" value="(content\\files)" />
    </appSettings>
</configuration>


MUST: do a backup for beta and live on RDP.


if deployments done by Startersite team, Then Always update Pre-deployment tp Manual Only

Pipline > Releases > Click Action icon > Set to Manual Only. 




open the Project : CPT

change we.config
add some dummy data to on app Setting section for check committed files correctly move to Beta
eg :  select above line and CTR +D
<add key="Test" value="40" />

Update the Build Action and Output Directory properties for web config

  • Set Build Action = Content and Copy To Output Directory = Always for web.config in the solution



Then Commit Changes. as

Go to Devops > 
Pipeline  check 

if build success > go to Releses

Azure DevOps -> Pipelines -> Releases -> 


Then Click latest Release done by you , >

on Next page select Beta box   > click Deployee button under the Beta Box  



give comment: initial deployment.> Click Deploy


if deployments done by Startersite team, Then Always update Pre-deployment tp Manual Only

Pipline > Releases > Click Action icon > Set to Manual Only. 






Ask from Senior ,Do we need to disable Addon, if so 
Release > Copy Addon > Right Side control option > untick Enable

do it for BETA and LIVE both




if all success
Then select Develop branch

add as following,

  • Add Constants.cs class
 
namespace Sana.Commerce
{
    public static class Constants
    {
    }
}


  • add Addon.cs,   no need to add addon 
  • Update IndexDirectory path in Web.config  connectionStrings > 
  • <add name="IndexDirectory" connectionString="\\corp-fs08\Shares\ISM-APAC\Fileshare\SanaIndexing\ST2\Diversey_9321" />
    
  • \\corp-fs08\Shares\ISM-APAC\Fileshare\SanaIndexing\ST4\CarloCasagrande_935
  • Update  OfflineModeSupport base on beta/RQS (Maintenance mode )
  •  <add key="OfflineModeSupport" value="ViewOnly" />
    
        
        * Web.Beta.config and Web.Live.config with customErrors mode="RemoteOnly". 
 <customErrors mode="RemoteOnly" redirectMode="

  • Fill ERP connection details on the admin section.
  • Run indexes (General, Product, Customer) check "IndexDirectory" is correctly updated on web.config
  • (Update index's configrstions as beta > eg : product import set batch size as beta's)
  • Update Checkout mode as Beta/RQS
  • Sana > admin section > Setup > Ordering & checkout  
always Check RQS for this because Beta may setup long time back 

  • Install Theme as Beta/RQS
  • Install Language​ as Beta/RQS
  • Install addon as Beta/RQS

Web.Beta.config file will be override the Web.config when we do the deploying to beta environment. So we have to update following features by compare with current beta.

  • DebugErpRequest
  • ManageAddons
  • UploadAddons
  • ManageDesignPacks True / False 
  • UploadDesignPacks
 <features>
        <feature name="DebugErpRequest" enabled="true" xdt:Transform="Replace" xdt:Locator="Match(name)" />
        <feature name="ManageAddons" enabled="true" xdt:Transform="Replace" xdt:Locator="Match(name)" />
        <feature name="UploadAddons" enabled="false" xdt:Transform="Replace" xdt:Locator="Match(name)" />
        <feature name="ManageDesignPacks" enabled="true" xdt:Transform="Replace" xdt:Locator="Match(name)" />
        <feature name="UploadDesignPacks" enabled="false" xdt:Transform="Replace" xdt:Locator="Match(name)" />
      </features>


MUST: Authentication Need to update if it's not updated by default. 


Add following part to beta web confog transformation file at your Git repo
 <system.webServer>
		<security>
			<authentication xdt:Transform="InsertAfter(/configuration/system.webServer/security/requestFiltering)">
				<basicAuthentication enabled="true" />
			</authentication>
		</security>
	</system.webServer>
correct location to past the code 
   <feature name="ManageDesignPacks" enabled="true" xdt:Transform="Replace" xdt:Locator="Match(name)" />
        <feature name="UploadDesignPacks" enabled="false" xdt:Transform="Replace" xdt:Locator="Match(name)" />
      </features>
    </sanaCommerce>
  </location>
  -------***********************************
  <system.webServer>
    <security>
      <authentication xdt:Transform="InsertAfter(/configuration/system.webServer/security/requestFiltering)">
        <basicAuthentication enabled="true" />
      </authentication>
    </security>
  </system.webServer>
  ------**********************************
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
  </system.web>
  <location path="." inheritInChildApplications="false">


if Project has a task service you need to follow these steps also 

Make sure to add the key TaskServer to appSettings. to Web.Live.config and Web.Beta.config 

<add key="TaskServer" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)" />

 </connectionStrings>
  <appSettings>
    <add key="AutoTaskServerSelection" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)" />
    <add key="AutoCleanupServers" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)" />
    <add key="DevelopmentPackagesDirectoryPath" xdt:Transform="Remove" xdt:Locator="Match(key)" />
    <add key="TaskServer" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)" />
    
  </appSettings>
  <location path="." inheritInChildApplications="false">
    <sanaCommerce>

.

for Live set task server value to True .
(when tries to run import on admin section if task server not found , then do it.)
<add key="TaskServer" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)" />



Then update Permissions  as follow

with new tool this will update automatically, else update manually

https://sanacommerce.visualstudio.com/Sana%20Projects/_wiki/wikis/Sana-Projects.wiki/683/Git-Repo-Permissions


Double-check with Check List created by Malinda 


https://sanacommerce.visualstudio.com/Sana%20Projects/_wiki/wikis/Sana-Projects.wiki/913/-SL-Deployment-Check-List

update Aji Excel sheet 





Errors found by me 

1 .
if got this error 
Folder to backup 'D:\Projects\Applications\SeroogysCBeta\Frontend' not found

Then check  Deployment group  not set properly or
deployment scripts paths not updated correctly.




2.1 When Copy addon issue occurred merging to dev to master > disable Project's Piplene > Copy addon 



2.2 When Copy addon issue occurred on Beta deployement > 
Relese > Edit button on project name  > 





2.3 Task service error


can not stop sc service on the computer. 



2.3.1 this may happen: - application bin folder dll and Task service dll are not matched,

2.3.2 Task service will not be stopped if application bin folder dll and Task service dll are not matched, 
then we unable to stop the Task service. 

2.3.3. if can not copy the dll to Task service folder  then we need to stop the service

follow article :How to Stop task Service if can not stop by right click and stop
https://learnnewabc.blogspot.com/2020/11/hot-to-stop-service-if-can-not-stop-by.html

after stoped services copy dll to task servise. and start servise again .
double-check by the start/stop the  servise again and od another deployement and test task is working fine.