From c524ecee8cb813d714a143164f4fd0554b289b03 Mon Sep 17 00:00:00 2001 From: Bart Plasmeijer Date: Wed, 8 Jul 2020 16:06:56 +0200 Subject: [PATCH 1/2] Linux SXA + publishing service (#335) * Linux SXA + publishing service * Update CHANGELOG * Update README and IMAGES --- CHANGELOG.md | 1 + IMAGES.md | 2 + README.md | 2 +- linux/9.3.x/sitecore-sxa-ps-sql/Dockerfile | 32 +++++++++++++++ .../sitecore-sxa-ps-sql/attach-databases.sh | 41 +++++++++++++++++++ linux/9.3.x/sitecore-sxa-ps-sql/build.json | 13 ++++++ .../sitecore-sxa-ps-sql/install-databases.sh | 35 ++++++++++++++++ 7 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 linux/9.3.x/sitecore-sxa-ps-sql/Dockerfile create mode 100644 linux/9.3.x/sitecore-sxa-ps-sql/attach-databases.sh create mode 100644 linux/9.3.x/sitecore-sxa-ps-sql/build.json create mode 100644 linux/9.3.x/sitecore-sxa-ps-sql/install-databases.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 8243d5874..03380ee57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## July 2020 +- [Added] Sitecore 9.3.0 XP/SXA/PS SQL linux images. - [Fixed] Sitecore 9.3.0 XP/SXA Solr linux images. ## May 2020 diff --git a/IMAGES.md b/IMAGES.md index 5e0be68d3..93b1d557d 100644 --- a/IMAGES.md +++ b/IMAGES.md @@ -711,6 +711,8 @@ | Version | Repository | OS | Build | Tag | | ------- | ---------- | --- | -----------| --- | | 9.3.0 | sitecore-xp-sxa-sql | linux | | `sitecore-xp-sxa-sql:9.3.0-linux` [Dockerfile](linux/9.3.x/sitecore-sxa-sql/Dockerfile) | +| 9.3.0 | sitecore-xp-sxa-solr | linux | | `sitecore-xp-sxa-solr:9.3.0-linux` [Dockerfile](linux/9.3.x/sitecore-xp-solr/Dockerfile) | +| 9.3.0 | sitecore-xp-sxa-ps-sql | linux | | `sitecore-xp-sxa-ps-sql:9.3.0-linux` [Dockerfile](linux/9.3.x/sitecore-sxa-ps-sql/Dockerfile) | | 9.3.0 | sitecore-xp-sql | linux | | `sitecore-xp-sql:9.3.0-linux` [Dockerfile](linux/9.3.x/sitecore-xp-sql/Dockerfile) | | 9.3.0 | sitecore-xp-spe-sql | linux | | `sitecore-xp-spe-sql:9.3.0-linux` [Dockerfile](linux/9.3.x/sitecore-spe-sql/Dockerfile) | | 9.3.0 | sitecore-xp-solr | linux | | `sitecore-xp-solr:9.3.0-linux` [Dockerfile](linux/9.3.x/sitecore-xp-solr/Dockerfile) | diff --git a/README.md b/README.md index e1fc0da88..deccb8004 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [//]: # "start: stats" -[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=flat-square)](https://opensource.org/licenses/MIT) ![Repositories](https://img.shields.io/badge/Repositories-104-blue.svg?style=flat-square) ![Tags](https://img.shields.io/badge/Tags-706-blue.svg?style=flat-square) ![Deprecated](https://img.shields.io/badge/Deprecated-0-lightgrey.svg?style=flat-square) ![Dockerfiles](https://img.shields.io/badge/Dockerfiles-92-blue.svg?style=flat-square) ![Default version](https://img.shields.io/badge/Default%20version-9.3.0%20on%20ltsc2019/1809-blue?style=flat-square) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=flat-square)](https://opensource.org/licenses/MIT) ![Repositories](https://img.shields.io/badge/Repositories-105-blue.svg?style=flat-square) ![Tags](https://img.shields.io/badge/Tags-708-blue.svg?style=flat-square) ![Deprecated](https://img.shields.io/badge/Deprecated-0-lightgrey.svg?style=flat-square) ![Dockerfiles](https://img.shields.io/badge/Dockerfiles-93-blue.svg?style=flat-square) ![Default version](https://img.shields.io/badge/Default%20version-9.3.0%20on%20ltsc2019/1809-blue?style=flat-square) [//]: # "end: stats" diff --git a/linux/9.3.x/sitecore-sxa-ps-sql/Dockerfile b/linux/9.3.x/sitecore-sxa-ps-sql/Dockerfile new file mode 100644 index 000000000..d9862b814 --- /dev/null +++ b/linux/9.3.x/sitecore-sxa-ps-sql/Dockerfile @@ -0,0 +1,32 @@ +ARG BASE_IMAGE + +FROM $BASE_IMAGE as builder + +USER root + +RUN apt-get -y update \ + && apt-get -y --allow-unauthenticated install unzip \ + && wget -progress=bar:force -q -O sqlpackage.zip https://go.microsoft.com/fwlink/?linkid=2113331 \ + && unzip -qq sqlpackage.zip -d /opt/sqlpackage \ + && chmod +x /opt/sqlpackage/sqlpackage + +COPY *.zip /opt/wdp/ + +RUN unzip -qq /opt/wdp/Sitecore*scwdp.zip -d /opt/wdp/ + +COPY attach-databases.sh /opt/ +COPY install-databases.sh /opt/ + +ENV DB_PREFIX='sc' + +RUN mkdir -p /install \ + && chmod -R 700 /install \ + && chmod +x /opt/*.sh \ + && cp /clean/* /install/ \ + && ( /opt/mssql/bin/sqlservr & ) | grep -q "Service Broker manager has started" \ + && ./opt/attach-databases.sh /install \ + && ./opt/install-databases.sh /opt/wdp + +FROM $BASE_IMAGE + +COPY --from=builder ["/install/*", "/clean/"] \ No newline at end of file diff --git a/linux/9.3.x/sitecore-sxa-ps-sql/attach-databases.sh b/linux/9.3.x/sitecore-sxa-ps-sql/attach-databases.sh new file mode 100644 index 000000000..b5ff47124 --- /dev/null +++ b/linux/9.3.x/sitecore-sxa-ps-sql/attach-databases.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +dataDir=$1 + +for attempt in {1..10} +do + echo "### Connection attempt $attempt..." + + /opt/mssql-tools/bin/sqlcmd -S . -U sa -P $SA_PASSWORD -t 120 -l 120 -Q "SELECT Name from sys.Databases" >/dev/null 2>&1 + + if [[ $? == 0 ]]; then + echo "### Connected." + + break + else + echo "### Retrying..." + + sleep 1 + fi +done + +echo "### Attaching databases in '$dataDir':" + +set -e + +echo "### Attaching databases now '$dataDir':" + +for filename in $dataDir/Sitecore.*.mdf; do + [ -e "$filename" ] || continue + + fileBaseName=$(basename $filename .mdf) + databaseName="${fileBaseName/_Primary/}" + ldfPath="$dataDir/$fileBaseName.ldf" + mdfPath=$filename + + echo "### Attaching '$databaseName' from '$mdfPath' and '$ldfPath'..." + + /opt/mssql-tools/bin/sqlcmd -S . -U sa -P $SA_PASSWORD -t 60 -l 300 -Q "CREATE DATABASE [$databaseName] ON (FILENAME = '$mdfPath'),(FILENAME = '$ldfPath') FOR ATTACH" +done + +echo "### Databases ready." \ No newline at end of file diff --git a/linux/9.3.x/sitecore-sxa-ps-sql/build.json b/linux/9.3.x/sitecore-sxa-ps-sql/build.json new file mode 100644 index 000000000..9838e7896 --- /dev/null +++ b/linux/9.3.x/sitecore-sxa-ps-sql/build.json @@ -0,0 +1,13 @@ +{ + "tags": [ + { + "tag": "sitecore-xp-sxa-ps-sql:9.3.0-linux", + "build-options": [ + "--build-arg BASE_IMAGE=sitecore-xp-sxa-sql:9.3.0-linux" + ] + } + ], + "sources": [ + "Sitecore Publishing Module 9.3.0.0.scwdp.zip" + ] +} \ No newline at end of file diff --git a/linux/9.3.x/sitecore-sxa-ps-sql/install-databases.sh b/linux/9.3.x/sitecore-sxa-ps-sql/install-databases.sh new file mode 100644 index 000000000..3fe57cb4c --- /dev/null +++ b/linux/9.3.x/sitecore-sxa-ps-sql/install-databases.sh @@ -0,0 +1,35 @@ +#!/bin/bash +source=$1 + +for attempt in {1..10} +do + echo "### Connection attempt $attempt..." + + /opt/mssql-tools/bin/sqlcmd -S . -U sa -P $SA_PASSWORD -t 120 -l 120 -Q "SELECT Name from sys.Databases" >/dev/null 2>&1 + + if [[ $? == 0 ]]; then + echo "### Connected." + + break + else + echo "### Retrying..." + + sleep 1 + fi +done + +echo "### Installing databases..." + +set -e + +for filename in $source/*.dacpac; do + [ -e "$filename" ] || continue + + fileBaseName=$(basename $filename .dacpac) + databaseName="Sitecore.${fileBaseName}" + + + echo "### Installing '$databaseName' from '$filename'..." + + /opt/sqlpackage/sqlpackage /a:Publish /tsn:. /tdn:$databaseName /tu:sa /tp:$SA_PASSWORD /sf:$filename /tt:120 /q +done From 72aad401e49e9fdb652daceba6f7d8548ddeec33 Mon Sep 17 00:00:00 2001 From: Rey Rahadian Date: Fri, 10 Jul 2020 20:17:02 +1000 Subject: [PATCH 2/2] #326 updated readme to explain the usage of SITECORE_LICENSE_LOCATION in 9.3 docker images (#327) Co-authored-by: Rey Rahadian --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index deccb8004..e285c9a92 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ When completed then... 1. Run `Set-LicenseEnvironmentVariable.ps1 -Path C:\license\license.xml` (use the `PersistForCurrentUser` switch to persist the license for future sessions). This will gzip and base64 encode the license file content and save it in `$env:SITECORE_LICENSE`. 1. Switch directory to `.\windows\tests\9.3.x\` and then run any of the docker-compose files, for example an XM with: `docker-compose --file .\docker-compose.xm.yml up` +9.3 docker images still supports mounting the license file inside the container, if for some reason you need to use this method please see [License file volume mount configuration for 9.3 docker images](#license-file-volume-mount-configuration-for-9.3-docker-images) + **For Sitecore 9.2.x:** 1. Place your Sitecore license file at `C:\license\license.xml`, or override location using the environment variable `LICENSE_PATH` like so: `$env:LICENSE_PATH="D:\my\sitecore\licenses"` @@ -251,6 +253,37 @@ SitecoreImageBuilder\Invoke-Build ` ``` +### License file volume mount configuration for 9.3 docker images + +If you've been using the license file mounted approach in 9.2 docker images, you can still continue using the same approach in 9.3 docker images. Follow these steps + +1. Place your Sitecore license file at `C:\license\license.xml`, or override location using the environment variable `LICENSE_PATH` like so: `$env:LICENSE_PATH="D:\my\sitecore\licenses"` +1. Switch directory to `.\windows\tests\9.3.x\` and then run any of the docker-compose files, for example an XM with: `docker-compose --file .\docker-compose.xm.yml up` after the docker compose file has been updated following the instruction below + +#### For cm and cd +1. Add a new volume mount configuration using the environment variable `LICENSE_PATH` to a folder inside the container, for example `C:\license` +1. Add a new environment variable `SITECORE_LICENSE_LOCATION` that point to the license file path inside the container, for example: `C:\license\license.xml` + +``` +cm: + environment: + SITECORE_LICENSE_LOCATION: C:\license\license.xml + volumes: + - ${LICENSE_PATH}:C:\license +``` + +#### For xconnect, xconnect-automationengine, xconnect-indexworker, xconnect-processingengine +1. Add a new volume mount configuration using the environment variable `LICENSE_PATH` to a folder inside the container, for example `C:\license` +1. Add a new environment variable `SITECORE_LICENSE_LOCATION` that point to the license file folder path inside the container, for example: `C:\license` + +``` +xconnect: + environment: + SITECORE_LICENSE_LOCATION: C:\license + volumes: + - ${LICENSE_PATH}:C:\license +``` + ## Cleanup Its recommended to clean up you Docker engine hosts (developer workstations, build agents etc.) regularly.