Skip to content

Commit

Permalink
Merged PR 1706: Pulling in JSS from GitHub
Browse files Browse the repository at this point in the history
- added: XM JSS and XP JSS
  • Loading branch information
jeanfrancoislarente committed Oct 31, 2019
2 parents 9d19935 + 8350583 commit 4da633d
Show file tree
Hide file tree
Showing 21 changed files with 536 additions and 37 deletions.
Binary file modified IMAGES.md
Binary file not shown.
Binary file modified README.md
Binary file not shown.
File renamed without changes.
18 changes: 17 additions & 1 deletion sitecore-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"Sitecore Experience Accelerator XM 1.8.1 rev. 190319 for 9.1.1.scwdp.zip": {
"description": "Sitecore Experience Accelerator 1.8 Update-1",
"url": "https://dev.sitecore.net/~/media/F8CFFFD23CD54178B5749B0ECACB5813.ashx"
},
},
"Sitecore Experience Accelerator XM 1.8.1 rev. 190319 for 9.1.1 CD.scwdp.zip": {
"description": "Sitecore Experience Accelerator 1.8 Update-1",
"url": "https://dev.sitecore.net/~/media/768039F8BCB24FB5A78AA99AD4391A20.ashx"
Expand Down Expand Up @@ -294,5 +294,21 @@
"Web Forms for Marketers 9.0 rev. 180503.zip": {
"description": "Web Forms for Marketers 9.0 Update-2",
"url": "https://dev.sitecore.net/~/media/3BFEB7C427D040178E619522EA272ECC.ashx"
},
"Sitecore JavaScript Services Server for Sitecore 9.2 XM 12.0.0 rev. 190522 CD.scwdp.zip": {
"description": "Sitecore JavaScript Services Server CD WDP for Sitecore 9.2 XM",
"url": "https://dev.sitecore.net/~/media/AEB49B787A534166A6C7D6B377367776.ashx"
},
"Sitecore JavaScript Services Server for Sitecore 9.2 XP 12.0.0 rev. 190522 CD.scwdp.zip": {
"description": "Sitecore JavaScript Services Server CD WDP for Sitecore 9.2 XP",
"url": "https://dev.sitecore.net/~/media/187F48001A174051A7B085377838295F.ashx"
},
"Sitecore JavaScript Services Server for Sitecore 9.2 XM 12.0.0 rev. 190522.scwdp.zip": {
"description": "Sitecore JavaScript Services Server WDP for Sitecore 9.2 XM",
"url": "https://dev.sitecore.net/~/media/305523FA736948C9855A8B0539FF1680.ashx"
},
"Sitecore JavaScript Services Server for Sitecore 9.2 XP 12.0.0 rev. 190522.scwdp.zip": {
"description": "Sitecore JavaScript Services Server WDP for Sitecore 9.2 XP",
"url": "https://dev.sitecore.net/~/media/1D5D53DE1F4B43E8B3D70E0D0EE40A5D.ashx"
}
}
21 changes: 21 additions & 0 deletions windows/9.2.x/sitecore-xm-jss-sqldev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# escape=`
ARG BASE_IMAGE
ARG ASSETS_IMAGE

FROM $ASSETS_IMAGE as assets
FROM $BASE_IMAGE as build

ARG ASSETS_USE_WDP

ENV INSTALL_PATH='C:\\install\\' `
INSTALL_MODULE_PATH='C:\\install-module\\' `
DATA_PATH='C:\\data\\' `
TEMP_PATH='c:\\temp'

COPY --from=assets ["${ASSETS_USE_WDP}", "${INSTALL_MODULE_PATH}"]
COPY . ${INSTALL_MODULE_PATH}

RUN & (Join-Path $env:INSTALL_MODULE_PATH "\\Extract-Databases.ps1") -Path $env:INSTALL_MODULE_PATH; `
& (Join-Path $env:INSTALL_MODULE_PATH "\\Install-Databases.ps1") -InstallPath $env:INSTALL_PATH -DataPath $env:DATA_PATH -ModulePath $env:INSTALL_MODULE_PATH -DatabasePrefix Sitecore; `
Get-ChildItem -Path $env:INSTALL_PATH -Exclude "*.mdf", "*.ldf" | Remove-Item -Force; `
Get-ChildItem -Path $env:INSTALL_MODULE_PATH | Remove-Item -Force;
35 changes: 35 additions & 0 deletions windows/9.2.x/sitecore-xm-jss-sqldev/Extract-Databases.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$Path
)

Add-Type -Assembly "System.IO.Compression"
Add-Type -Assembly "System.IO.Compression.FileSystem"

Get-ChildItem -Path $Path -Filter "*.zip" | ForEach-Object {
$zipPath = $_.FullName

try
{
$stream = New-Object IO.FileStream($zipPath, [IO.FileMode]::Open)
$zip = New-Object IO.Compression.ZipArchive($stream, [IO.Compression.ZipArchiveMode]::Read)

($zip.Entries | Where-Object { $_.FullName -like "*.dacpac" }) | Foreach-Object {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, (Join-Path $Path $_.Name), $true)
}
}
finally
{
if ($zip -ne $null)
{
$zip.Dispose()
}

if ($stream -ne $null)
{
$stream.Dispose()
}
}
}
61 changes: 61 additions & 0 deletions windows/9.2.x/sitecore-xm-jss-sqldev/Install-Databases.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$InstallPath,
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$DataPath,
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$ModulePath,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$DatabasePrefix
)

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null

$server = New-Object Microsoft.SqlServer.Management.Smo.Server($env:COMPUTERNAME)
$server.Properties["DefaultFile"].Value = $InstallPath
$server.Properties["DefaultLog"].Value = $InstallPath
$server.Alter()

$sqlPackageExePath = Get-Item "C:\Program Files\Microsoft SQL Server\*\DAC\bin\SqlPackage.exe" | Select-Object -Last 1 -Property FullName -ExpandProperty FullName

# attach
Get-ChildItem -Path $InstallPath -Filter "*.mdf" | ForEach-Object {
$databaseName = $_.BaseName.Replace("_Primary", "")
$mdfPath = $_.FullName
$ldfPath = $mdfPath.Replace(".mdf", ".ldf")
$sqlcmd = "IF EXISTS (SELECT 1 FROM SYS.DATABASES WHERE NAME = '$databaseName') BEGIN EXEC sp_detach_db [$databaseName] END;CREATE DATABASE [$databaseName] ON (FILENAME = N'$mdfPath'), (FILENAME = N'$ldfPath') FOR ATTACH;"

Write-Host "### Attaching '$databaseName'..."

Invoke-Sqlcmd -Query $sqlcmd
}

# do modules
$TextInfo = (Get-Culture).TextInfo
Get-ChildItem -Path $ModulePath -Include "core.dacpac", "master.dacpac" -Recurse | ForEach-Object {

$dacpacPath = $_.FullName
$databaseName = "$DatabasePrefix`." + $TextInfo.ToTitleCase($_.BaseName)

# Install
& $sqlPackageExePath /a:Publish /sf:$dacpacPath /tdn:$databaseName /tsn:$env:COMPUTERNAME /q
}

# detach DB
Get-ChildItem -Path $InstallPath -Filter "*.mdf" | ForEach-Object {
$databaseName = $_.BaseName.Replace("_Primary", "")

Write-Host "### Detach: $databaseName"

Invoke-Sqlcmd -Query "EXEC MASTER.dbo.sp_detach_db @dbname = N'$databaseName', @keepfulltextindexfile = N'false'"
}

$server = New-Object Microsoft.SqlServer.Management.Smo.Server($env:COMPUTERNAME)
$server.Properties["DefaultFile"].Value = $DataPath
$server.Properties["DefaultLog"].Value = $DataPath
$server.Alter()
14 changes: 14 additions & 0 deletions windows/9.2.x/sitecore-xm-jss-sqldev/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"tags": [
{
"tag": "sitecore-xm-jss-sqldev:9.2.0-windowsservercore-${windowsservercore_version}",
"build-options": [
"--memory 4GB",
"--build-arg BASE_IMAGE=sitecore-xm-sqldev:9.2.0-windowsservercore-${windowsservercore_version}",
"--build-arg ASSETS_IMAGE=sitecore-assets:9.2.0-nanoserver-${nanoserver_version}",
"--build-arg ASSETS_USE_WDP='C:\\packages\\Sitecore JavaScript Services Server for Sitecore 9.2 XM 12.0.0 rev. 190522.scwdp.zip'"
]
}
],
"sources": []
}
29 changes: 29 additions & 0 deletions windows/9.2.x/sitecore-xm-jss/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# escape=`
ARG BASE_IMAGE
ARG ASSETS_IMAGE

FROM $ASSETS_IMAGE as assets
FROM $BASE_IMAGE as build

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ARG ASSETS_USE_WDP

COPY --from=assets ["${ASSETS_USE_WDP}", "C:\\temp\\packages\\"]

# expand selected wdp into installation directory
RUN Expand-Archive -Path 'C:\\temp\\packages\\*.zip' -DestinationPath 'C:\\temp'; `
Copy-Item -Path 'C:\\temp\\Content\\Website\\*' -Destination 'C:\\inetpub\\wwwroot' -Recurse -Force;

# copy tools and transforms
COPY --from=assets ["C:\\install\\tools\\", "C:\\install\\tools\\"]

# find transform files and do transformation
RUN (Get-ChildItem -Path 'C:\\inetpub\\wwwroot\\*.xdt' -Recurse ) | ForEach-Object { & 'C:\\install\\tools\\scripts\\Invoke-XdtTransform.ps1' -Path 'C:\\inetpub\\wwwroot\\web.config' -XdtPath $_.FullName -XdtDllPath 'C:\\install\\tools\\bin\\Microsoft.Web.XmlTransform.dll'; };

FROM $BASE_IMAGE

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY --from=build ["C:\\inetpub\\wwwroot\\", "C:\\inetpub\\wwwroot\\"]

25 changes: 25 additions & 0 deletions windows/9.2.x/sitecore-xm-jss/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"tags": [
{
"tag": "sitecore-xm-jss-cm:9.2.0-windowsservercore-${windowsservercore_version}",
"build-options": [
"--build-arg BASE_IMAGE=sitecore-xm-cm:9.2.0-windowsservercore-${windowsservercore_version}",
"--build-arg ASSETS_IMAGE=sitecore-assets:9.2.0-nanoserver-${nanoserver_version}",
"--build-arg ASSETS_USE_WDP='C:\\packages\\Sitecore JavaScript Services Server for Sitecore 9.2 XM 12.0.0 rev. 190522.scwdp.zip'",
"--build-arg SC_ROLE_CONFIG_DIRECTORY=\\config\\cm",
"--build-arg SC_ROLE_DEFINE='ContentManagement, Indexing'"
]
},
{
"tag": "sitecore-xm-jss-cd:9.2.0-windowsservercore-${windowsservercore_version}",
"build-options": [
"--build-arg BASE_IMAGE=sitecore-xm-cd:9.2.0-windowsservercore-${windowsservercore_version}",
"--build-arg ASSETS_IMAGE=sitecore-assets:9.2.0-nanoserver-${nanoserver_version}",
"--build-arg ASSETS_USE_WDP='C:\\packages\\Sitecore JavaScript Services Server for Sitecore 9.2 XM 12.0.0 rev. 190522 CD.scwdp.zip'",
"--build-arg SC_ROLE_CONFIG_DIRECTORY=.\\config\\cd",
"--build-arg SC_ROLE_DEFINE='ContentDelivery'"
]
}
],
"sources": []
}
22 changes: 22 additions & 0 deletions windows/9.2.x/sitecore-xp-jss-sqldev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# escape=`
ARG BASE_IMAGE
ARG ASSETS_IMAGE

FROM $ASSETS_IMAGE as assets
FROM $BASE_IMAGE as build

ARG ASSETS_USE_WDP

ENV INSTALL_PATH='C:\\install\\' `
INSTALL_MODULE_PATH='C:\\install-module\\' `
DATA_PATH='C:\\data\\' `
TEMP_PATH='c:\\temp'

COPY --from=assets ["${ASSETS_USE_WDP}", "${INSTALL_MODULE_PATH}"]

COPY . ${INSTALL_MODULE_PATH}

RUN & (Join-Path $env:INSTALL_MODULE_PATH "\\Extract-Databases.ps1") -Path $env:INSTALL_MODULE_PATH; `
& (Join-Path $env:INSTALL_MODULE_PATH "\\Install-Databases.ps1") -InstallPath $env:INSTALL_PATH -DataPath $env:DATA_PATH -ModulePath $env:INSTALL_MODULE_PATH -DatabasePrefix Sitecore; `
Get-ChildItem -Path $env:INSTALL_PATH -Exclude "*.mdf", "*.ldf" | Remove-Item -Force; `
Get-ChildItem -Path $env:INSTALL_MODULE_PATH | Remove-Item -Force;
35 changes: 35 additions & 0 deletions windows/9.2.x/sitecore-xp-jss-sqldev/Extract-Databases.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$Path
)

Add-Type -Assembly "System.IO.Compression"
Add-Type -Assembly "System.IO.Compression.FileSystem"

Get-ChildItem -Path $Path -Filter "*.zip" | ForEach-Object {
$zipPath = $_.FullName

try
{
$stream = New-Object IO.FileStream($zipPath, [IO.FileMode]::Open)
$zip = New-Object IO.Compression.ZipArchive($stream, [IO.Compression.ZipArchiveMode]::Read)

($zip.Entries | Where-Object { $_.FullName -like "*.dacpac" }) | Foreach-Object {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, (Join-Path $Path $_.Name), $true)
}
}
finally
{
if ($zip -ne $null)
{
$zip.Dispose()
}

if ($stream -ne $null)
{
$stream.Dispose()
}
}
}
61 changes: 61 additions & 0 deletions windows/9.2.x/sitecore-xp-jss-sqldev/Install-Databases.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$InstallPath,
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$DataPath,
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ -PathType 'Container' })]
[string]$ModulePath,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$DatabasePrefix
)

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null

$server = New-Object Microsoft.SqlServer.Management.Smo.Server($env:COMPUTERNAME)
$server.Properties["DefaultFile"].Value = $InstallPath
$server.Properties["DefaultLog"].Value = $InstallPath
$server.Alter()

$sqlPackageExePath = Get-Item "C:\Program Files\Microsoft SQL Server\*\DAC\bin\SqlPackage.exe" | Select-Object -Last 1 -Property FullName -ExpandProperty FullName

# attach
Get-ChildItem -Path $InstallPath -Filter "*.mdf" | ForEach-Object {
$databaseName = $_.BaseName.Replace("_Primary", "")
$mdfPath = $_.FullName
$ldfPath = $mdfPath.Replace(".mdf", ".ldf")
$sqlcmd = "IF EXISTS (SELECT 1 FROM SYS.DATABASES WHERE NAME = '$databaseName') BEGIN EXEC sp_detach_db [$databaseName] END;CREATE DATABASE [$databaseName] ON (FILENAME = N'$mdfPath'), (FILENAME = N'$ldfPath') FOR ATTACH;"

Write-Host "### Attaching '$databaseName'..."

Invoke-Sqlcmd -Query $sqlcmd
}

# do modules
$TextInfo = (Get-Culture).TextInfo
Get-ChildItem -Path $ModulePath -Include "core.dacpac", "master.dacpac" -Recurse | ForEach-Object {

$dacpacPath = $_.FullName
$databaseName = "$DatabasePrefix`." + $TextInfo.ToTitleCase($_.BaseName)

# Install
& $sqlPackageExePath /a:Publish /sf:$dacpacPath /tdn:$databaseName /tsn:$env:COMPUTERNAME /q
}

# detach DB
Get-ChildItem -Path $InstallPath -Filter "*.mdf" | ForEach-Object {
$databaseName = $_.BaseName.Replace("_Primary", "")

Write-Host "### Detach: $databaseName"

Invoke-Sqlcmd -Query "EXEC MASTER.dbo.sp_detach_db @dbname = N'$databaseName', @keepfulltextindexfile = N'false'"
}

$server = New-Object Microsoft.SqlServer.Management.Smo.Server($env:COMPUTERNAME)
$server.Properties["DefaultFile"].Value = $DataPath
$server.Properties["DefaultLog"].Value = $DataPath
$server.Alter()
14 changes: 14 additions & 0 deletions windows/9.2.x/sitecore-xp-jss-sqldev/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"tags": [
{
"tag": "sitecore-xp-jss-sqldev:9.2.0-windowsservercore-${windowsservercore_version}",
"build-options": [
"--memory 4GB",
"--build-arg BASE_IMAGE=sitecore-xp-sqldev:9.2.0-windowsservercore-${windowsservercore_version}",
"--build-arg ASSETS_IMAGE=sitecore-assets:9.2.0-nanoserver-${nanoserver_version}",
"--build-arg ASSETS_USE_WDP='C:\\packages\\Sitecore JavaScript Services Server for Sitecore 9.2 XP 12.0.0 rev. 190522.scwdp.zip'"
]
}
],
"sources": []
}
22 changes: 22 additions & 0 deletions windows/9.2.x/sitecore-xp-jss/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# escape=`
ARG BASE_IMAGE
ARG ASSETS_IMAGE

FROM $ASSETS_IMAGE as assets
FROM $BASE_IMAGE as build

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ARG ASSETS_USE_WDP

COPY --from=assets ["${ASSETS_USE_WDP}", "C:\\temp\\packages\\"]

# expand selected wdp into installation directory
RUN Expand-Archive -Path 'C:\\temp\\packages\\*.zip' -DestinationPath 'C:\\temp'; `
Copy-Item -Path 'C:\\temp\\Content\\Website\\*' -Destination 'C:\\inetpub\\wwwroot' -Recurse -Force;

FROM $BASE_IMAGE

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY --from=build ["C:\\inetpub\\wwwroot\\", "C:\\inetpub\\wwwroot\\"]
Loading

0 comments on commit 4da633d

Please sign in to comment.