Skip to content

Commit

Permalink
Merged PR 4905: Merge 'develop' to 'main'
Browse files Browse the repository at this point in the history
Related work items: #8632, #8700, #8722, #8723, #8732, #8738, #8798
  • Loading branch information
Alexander Doroshenko committed Nov 6, 2023
2 parents deabc74 + 8fe8e9f commit ea58583
Show file tree
Hide file tree
Showing 25 changed files with 89 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DAM_URL=
CD_CONTAINERS_COUNT=1
SMTP_CONTAINERS_COUNT=1
SKIP_WARMUP_CD=false
HOST_LICENSE_FOLDER=
HOST_LICENSE_FOLDER=C:\license
RENDERING_HOST=www.lighthouse.localhost
SITECORE_IDSECRET=
SITECORE_ID_CERTIFICATE=
Expand Down
39 changes: 18 additions & 21 deletions build-images.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ Param (
[ValidateSet("xp0", "xp1")]
[string]$Topology = "xp0"
,
[Parameter(HelpMessage = "Set memory limit for the build container. Passed to the docker-compose build command as --memory <Value>")]
[string]$Memory
,
[Parameter(HelpMessage = "Set Docker Compose services to build. Passed to the docker-compose build command.")]
[Parameter(HelpMessage = "Set Docker Compose services to build. Passed to the docker compose build command.")]
[string[]]$Services
,
[Parameter(HelpMessage = "Set whether to build images in parallel ")]
Expand All @@ -17,18 +14,22 @@ Param (
,
[Parameter(HelpMessage = "Skips building the solution image.")]
[switch]$SkipSolution
,
[Parameter(HelpMessage = "Runs in the context of a CI pipeline.")]
[switch]$CI
)

$dockerComposeBaseCommand = "docker compose"
if ($CI) {
$dockerComposeBaseCommand = "docker-compose"
}

function Invoke-BuildSolutionAssets {
# Build the solution images

$dockerComposeCommand = "docker-compose"
$dockerComposeCommand = $dockerComposeBaseCommand
$dockerComposeCommand += " -f docker-compose.build.solution.yml build"

if (-not [string]::IsNullOrEmpty($Memory)) {
$dockerComposeCommand += " --memory $Memory"
}

if ($Parallel) {
$dockerComposeCommand += " --parallel"
}
Expand All @@ -38,14 +39,10 @@ function Invoke-BuildSolutionAssets {

$LASTEXITCODE -ne 0 | Where-Object { $_ } | ForEach-Object { throw "Failed." }

$dockerComposeCommand = "docker-compose"
$dockerComposeCommand = $dockerComposeBaseCommand
$dockerComposeCommand += " --env-file .env"
$dockerComposeCommand += " -f docker/docker-compose.copy.solution.yml build"

if (-not [string]::IsNullOrEmpty($Memory)) {
$dockerComposeCommand += " --memory $Memory"
}

if ($Parallel) {
$dockerComposeCommand += " --parallel"
}
Expand All @@ -57,8 +54,12 @@ function Invoke-BuildSolutionAssets {
}

if (-not $SkipPull) {
# Pulling the base images as a separate step because "docker-compose build --pull" fails with the "lighthouse-solution" image which is never pushed to the Docker registry.
.\pull-build-images.ps1 -Topology $Topology
# Pulling the base images as a separate step because "docker compose build --pull" fails with the "lighthouse-solution" image which is never pushed to the Docker registry.
if ($CI) {
.\pull-build-images.ps1 -Topology $Topology -CI
} else {
.\pull-build-images.ps1 -Topology $Topology
}
}

if ($null -eq $Services) {
Expand All @@ -71,13 +72,9 @@ if (-not $SkipSolution) {
$fileSuffix = $(if ("$Topology" -eq "xp0") { "" } else { "-xp1" })

# Build the service images
$dockerComposeCommand = "docker-compose"
$dockerComposeCommand = $dockerComposeBaseCommand
$dockerComposeCommand += " -f docker-compose$($fileSuffix).yml -f docker-compose$fileSuffix.build.yml build"

if (-not [string]::IsNullOrEmpty($Memory)) {
$dockerComposeCommand += " --memory $Memory"
}

if ($Parallel) {
$dockerComposeCommand += " --parallel"
}
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-xp1.build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.4"

services:
solution:
image: ${REGISTRY}build/lighthouse-solution:${SITECORE_VERSION}-${NANOSERVER_VERSION}-${SOLUTION_VERSION}
Expand Down Expand Up @@ -37,6 +35,7 @@ services:
HEADLESS_ASSETS: ${SITECORE_DOCKER_REGISTRY}sxp/modules/sitecore-headless-services-xp1-assets:21.0-${SITECORE_ASSET_NANOSERVER_VERSION}
CMP_ASSETS: ${SITECORE_DOCKER_REGISTRY}sxp/modules/sitecore-chub-assets:5.0.0-${SITECORE_ASSET_NANOSERVER_VERSION}
TOOLS_ASSETS: ${SITECORE_DOCKER_REGISTRY}tools/sitecore-docker-tools-assets:${TOOLS_VERSION}-${SITECORE_ASSET_NANOSERVER_VERSION}
DELTA_ASSET_IMAGE: ${SITECORE_DOCKER_REGISTRY}sxp-pre/sitecore-xp1-assets:10.3.1.009332.420-10.0.17763.4377-1809
depends_on:
- solution
cm:
Expand All @@ -53,6 +52,7 @@ services:
XGEN_ASSETS: adoprog/custom-xgenerator-assets:10.1-${NANOSERVER_VERSION}
SOLUTION_IMAGE: ${REGISTRY}build/lighthouse-solution:${SITECORE_VERSION}-${NANOSERVER_VERSION}-${SOLUTION_VERSION}
MANAGEMENT_SERVICES_IMAGE: ${SITECORE_DOCKER_REGISTRY}sxp/modules/sitecore-management-services-xm1-assets:5.1-${SITECORE_ASSET_NANOSERVER_VERSION}
DELTA_ASSET_IMAGE: ${SITECORE_DOCKER_REGISTRY}sxp-pre/sitecore-xp1-assets:10.3.1.009332.420-10.0.17763.4377-1809
depends_on:
- solution

Expand Down
5 changes: 2 additions & 3 deletions docker-compose-xp1.override.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.4"
services:
traefik:
ports:
Expand Down Expand Up @@ -184,5 +183,5 @@ services:

networks:
demo:
external:
name: nat
external: true
name: nat
5 changes: 2 additions & 3 deletions docker-compose-xp1.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.4"
services:
traefik:
isolation: ${TRAEFIK_ISOLATION}
Expand All @@ -16,8 +15,8 @@ services:
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
volumes:
- source: \\.\pipe\docker_engine
target: \\.\pipe\docker_engine
- source: \\.\pipe\docker_engine\
target: \\.\pipe\docker_engine\
type: npipe
- ./traefik:C:/etc/traefik
depends_on:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.build.solution.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.4"

services:
solution-content:
image: ${REGISTRY}build/lighthouse-solution-content:${SITECORE_VERSION}-${LTSC_NANOSERVER_VERSION}-${SOLUTION_VERSION}
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.4"

services:

solution:
Expand Down Expand Up @@ -61,6 +59,7 @@ services:
XGEN_ASSETS: adoprog/custom-xgenerator-assets:10.1-${NANOSERVER_VERSION}
SOLUTION_IMAGE: ${REGISTRY}build/lighthouse-solution:${SITECORE_VERSION}-${NANOSERVER_VERSION}-${SOLUTION_VERSION}
MANAGEMENT_SERVICES_IMAGE: ${SITECORE_DOCKER_REGISTRY}sxp/modules/sitecore-management-services-xm1-assets:5.1-${SITECORE_ASSET_NANOSERVER_VERSION}
DELTA_ASSET_IMAGE: ${SITECORE_DOCKER_REGISTRY}sxp-pre/sitecore-xp1-assets:10.3.1.009332.420-10.0.17763.4377-1809
depends_on:
- solution

Expand All @@ -77,6 +76,7 @@ services:
HEADLESS_ASSETS: ${SITECORE_DOCKER_REGISTRY}sxp/modules/sitecore-headless-services-xp1-assets:21.0-${SITECORE_ASSET_NANOSERVER_VERSION}
CMP_ASSETS: ${SITECORE_DOCKER_REGISTRY}sxp/modules/sitecore-chub-assets:5.0.0-${SITECORE_ASSET_NANOSERVER_VERSION}
TOOLS_ASSETS: ${SITECORE_DOCKER_REGISTRY}tools/sitecore-docker-tools-assets:${TOOLS_VERSION}-${SITECORE_ASSET_NANOSERVER_VERSION}
DELTA_ASSET_IMAGE: ${SITECORE_DOCKER_REGISTRY}sxp-pre/sitecore-xp1-assets:10.3.1.009332.420-10.0.17763.4377-1809
depends_on:
- solution

Expand Down
13 changes: 3 additions & 10 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.7"

services:
traefik:
volumes:
Expand All @@ -10,17 +8,13 @@ services:
networks:
- demo

# Mount our SQL data folder and use our custom image with the Headless Services (JSS)
# module data added. See Dockerfile for details.
# Mount our SQL data folder
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
healthcheck:
test: ["CMD", "dir"]
mem_limit: 2GB
volumes:
- type: bind
source: .\data\mssql-data
target: /var/opt/mssql/data
target: c:\data
networks:
- demo

Expand Down Expand Up @@ -201,8 +195,7 @@ services:
- "${CD_HOST}"

smtp:
image: maildev/maildev
command: ["--smtp", "25", "--web", "80"]
image: rnwood/smtp4dev
isolation: ${SMTP_ISOLATION}
ports:
- "44025:25"
Expand Down
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.4"
services:
traefik:
isolation: ${TRAEFIK_ISOLATION}
Expand All @@ -17,8 +16,8 @@ services:
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
volumes:
- source: \\.\pipe\docker_engine
target: \\.\pipe\docker_engine
- source: \\.\pipe\docker_engine\
target: \\.\pipe\docker_engine\
type: npipe
- ./traefik:C:/etc/traefik
depends_on:
Expand All @@ -28,7 +27,7 @@ services:
condition: service_healthy
mssql:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sxp/nonproduction/mssql-developer:2017-${SITECORE_VERSION}-${WINDOWSSERVERCORE_VERSION}
image: ${SITECORE_DOCKER_REGISTRY}sxp/nonproduction/mssql-developer:2017-${WINDOWSSERVERCORE_VERSION}
environment:
SA_PASSWORD: ${SQL_SA_PASSWORD}
ACCEPT_EULA: "Y"
Expand Down
2 changes: 1 addition & 1 deletion docker/build-and-push-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ stages:
az login -u $(sitecore.container.registry.username) -p $(sitecore.container.registry.password)
az acr login -n $(container.registry.short)
./pull-build-images.ps1
./pull-build-images.ps1 -CI
docker-compose -f docker-compose.build.solution.yml pull
Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '2.4'

services:
init:
healthcheck:
Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose.copy.solution.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.4"

services:
solution:
image: ${REGISTRY}build/lighthouse-solution:${SITECORE_VERSION}-${NANOSERVER_VERSION}-${SOLUTION_VERSION}
Expand Down
5 changes: 5 additions & 0 deletions docker/images/windows/demo-cd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARG TOOLS_ASSETS
ARG SPE_ASSETS
ARG SXA_ASSETS
ARG HEADLESS_ASSETS
ARG DELTA_ASSET_IMAGE

ARG CMP_ASSETS
ARG SOLUTION_IMAGE
Expand All @@ -13,6 +14,7 @@ FROM ${TOOLS_ASSETS} as tools
FROM ${SPE_ASSETS} as spe_assets
FROM ${SXA_ASSETS} as sxa_assets
FROM ${HEADLESS_ASSETS} as headless_assets
FROM ${DELTA_ASSET_IMAGE} as deltaAssetImage

FROM ${CMP_ASSETS} as cmp_assets

Expand Down Expand Up @@ -50,6 +52,9 @@ RUN icacls 'C:\inetpub\wwwroot' /grant 'IIS_IUSRS:(OI)(CI)F' /t | Out-Null

FROM modules as production

# Copy Product Hotfixes
COPY --from=deltaAssetImage /platform/cd/inetpub/wwwroot/ /inetpub/wwwroot/

COPY ./hotfix/ /inetpub/wwwroot/
COPY --from=solution /solution/cd/ /inetpub/wwwroot/
COPY ./data/transforms/ /inetpub/wwwroot/transforms/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ $UserNameParamAdmin = ("UserName='" + $SitecoreAdminUsername + "'")
$EMailParamAdmin = ("EMail='[email protected]'")
$paramsAdmin = $passwordParamAdmin, $saltParamAdmin, $UserNameParamAdmin, $EMailParamAdmin

Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -InputFile "C:\sql\CreateSitecoreAdminUser.sql" -Variable $paramsAdmin
Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -InputFile "C:\sql\CreateSitecoreAdminUser.sql" -TrustServerCertificate -Variable $paramsAdmin
Write-Host "$(Get-Date -Format $timeFormat): Invoke CreateSitecoreAdminUser.sql for $SitecoreAdminUsername"
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ $passwordParam = ("EncodedPassword='" + $userinfo.Password + "'")
$saltParam = ("EncodedSalt='" + $userinfo.Salt + "'")
$paramsUser = $passwordParam, $saltParam

Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -InputFile "C:\sql\ResetDemoUsers.sql" -Variable $paramsUser
Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -InputFile "C:\sql\ResetDemoUsers.sql" -TrustServerCertificate -Variable $paramsUser
Write-Host "$(Get-Date -Format $timeFormat): Invoke ResetDemoUsers.sql"
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ $fieldParamExmRoot = ("FieldId='1B963507-6176-4336-A14D-D5070C3B0286'")
$valueParamExmRoot = ("Value='" + $env:EXM_BASE_URL + "'")
$paramsExmRoot = $itemParamExmRoot, $fieldParamExmRoot, $valueParamExmRoot

Invoke-Sqlcmd -InputFile "C:\sql\SetSharedFieldValue.sql" -Variable $paramsExmRoot -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Verbose
Invoke-Sqlcmd -InputFile "C:\sql\SetSharedFieldValue.sql" -Variable $paramsExmRoot -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -TrustServerCertificate -Verbose
Write-Host "$(Get-Date -Format $timeFormat): Invoke SetSharedFieldValue.sql"

# /sitecore/content/Demo SXA Sites/LighthouseFinancial/LighthouseFinancial Emails
$itemParamExmRootFinancial = ("ItemId='422A7377-107D-43BC-99DE-C6F14C3FBF0E'")
$paramsExmRootFinancial = $itemParamExmRootFinancial, $fieldParamExmRoot, $valueParamExmRoot

Invoke-Sqlcmd -InputFile "C:\sql\SetSharedFieldValue.sql" -Variable $paramsExmRootFinancial -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Verbose
Invoke-Sqlcmd -InputFile "C:\sql\SetSharedFieldValue.sql" -Variable $paramsExmRootFinancial -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -TrustServerCertificate -Verbose
Write-Host "$(Get-Date -Format $timeFormat): Invoke SetSharedFieldValue.sql"

# /sitecore/content/Demo SXA Sites/LighthouseHealthcare/LighthouseHealthcare Emails
$itemParamExmRootHealthcare = ("ItemId='F8BA8B00-F363-43FC-B902-D532DD385042'")
$paramsExmRootHealthcare = $itemParamExmRootHealthcare, $fieldParamExmRoot, $valueParamExmRoot

Invoke-Sqlcmd -InputFile "C:\sql\SetSharedFieldValue.sql" -Variable $paramsExmRootHealthcare -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Verbose
Invoke-Sqlcmd -InputFile "C:\sql\SetSharedFieldValue.sql" -Variable $paramsExmRootHealthcare -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -TrustServerCertificate -Verbose
Write-Host "$(Get-Date -Format $timeFormat): Invoke SetSharedFieldValue.sql"
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ if ($deployDatabases) {
.\DeployDatabases.ps1 -ResourcesDirectory C:\solution_data\security -SqlServer:$SqlServer -SqlAdminUser:$SqlAdminUser -SqlAdminPassword:$SqlAdminPassword -EnableContainedDatabaseAuth -SkipStartingServer -SqlElasticPoolName $SqlElasticPoolName -DatabasesToDeploy $DatabasesToDeploy -SqlDatabasePrefix:$SqlDatabasePrefix -SqlCustomDatabasePrefixUpdateFrom:$SqlCustomDatabasePrefixUpdateFrom
}

$ready = Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Query "select name from sys.databases where name = 'platform_init_ready'"
$ready = Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Query "select name from sys.databases where name = 'platform_init_ready'" -TrustServerCertificate
if (-not $ready) {

# Disable sitecore\admin
Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -InputFile "C:\sql\DisableSitecoreAdminUser.sql" -Verbose
Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -InputFile "C:\sql\DisableSitecoreAdminUser.sql" -TrustServerCertificate -Verbose

# Create custom admin user
.\CreateSitecoreAdminUser.ps1 -SqlServer $SqlServer -SqlAdminUser $SqlAdminUser -SqlAdminPassword $SqlAdminPassword -SitecoreAdminUsername $SitecoreAdminUsername -SitecoreAdminPassword $SitecoreAdminPassword
Expand All @@ -89,7 +89,7 @@ if (-not $ready) {
.\SetExmBaseUrl.ps1 -SqlServer $SqlServer -SqlAdminUser $SqlAdminUser -SqlAdminPassword $SqlAdminPassword

# Create platform_init_ready database to indicate that init script is complete
Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Query "create database platform_init_ready" -Verbose
Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdminUser -Password $SqlAdminPassword -Query "create database platform_init_ready" -TrustServerCertificate -Verbose
}

[System.Environment]::SetEnvironmentVariable("DatabasesDeploymentStatus", "Complete", "Machine")
Expand Down
2 changes: 1 addition & 1 deletion docker/images/windows/demo-solution/Dockerfile.content
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN Copy-Item ./build/* .

RUN nuget restore Sitecore.Demo.Platform.sln

RUN msbuild Sitecore.Demo.Platform.sln /p:DeployOnBuild=true /p:PublishProfile=DockerBuild
RUN msbuild Sitecore.Demo.Platform.sln /p:DeployOnBuild=true /p:PublishProfile=DockerBuild /p:Configuration=Release

RUN (Get-Content "C:\src\Project\Global\code\App_Config\Include\Project\z.DevSettings.config").replace('C:\Projects\Sitecore.Demo.Platform\items', 'C:\items') | Set-Content "C:\src\Project\Global\code\App_Config\Include\Project\z.DevSettings.config"

Expand Down
5 changes: 5 additions & 0 deletions docker/images/windows/demo-standalone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ ARG CMP_ASSETS
ARG XGEN_ASSETS

ARG MANAGEMENT_SERVICES_IMAGE
ARG DELTA_ASSET_IMAGE

FROM ${TOOLS_ASSETS} as tools

FROM ${SPE_ASSETS} as spe_assets
FROM ${SXA_ASSETS} as sxa_assets
FROM ${HEADLESS_ASSETS} as headless_assets
FROM ${MANAGEMENT_SERVICES_IMAGE} AS management_services
FROM ${DELTA_ASSET_IMAGE} as deltaAssetImage

FROM ${CMP_ASSETS} as cmp_assets
FROM ${XGEN_ASSETS} as xgen_assets
Expand Down Expand Up @@ -57,6 +59,9 @@ RUN icacls 'C:\inetpub\wwwroot' /grant 'IIS_IUSRS:(OI)(CI)F' /t | Out-Null

FROM modules as production

# Copy Product Hotfixes
COPY --from=deltaAssetImage /platform/cm/inetpub/wwwroot/ /inetpub/wwwroot/

COPY --from=solution /solution/cm/ /inetpub/wwwroot/

COPY ./hotfix/ /inetpub/wwwroot/
Expand Down
Loading

0 comments on commit ea58583

Please sign in to comment.