Skip to content

Commit

Permalink
Adjust "ADDLOCAL" to disable the Windows service
Browse files Browse the repository at this point in the history
Also, update Dockerfile to provide installer logs when the installer fails in an obvious way.
  • Loading branch information
tianon committed Nov 30, 2020
1 parent da7e52d commit 69ff4ee
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 9 deletions.
11 changes: 10 additions & 1 deletion 3.6/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=Server,Client,Router,MiscellaneousTools,MonitoringTools,ImportExportTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 3.6/windows/windowsservercore-ltsc2016/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=Server,Client,Router,MiscellaneousTools,MonitoringTools,ImportExportTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 4.0/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=ServerNoService,Client,Router,MiscellaneousTools,MonitoringTools,ImportExportTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 4.0/windows/windowsservercore-ltsc2016/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=ServerNoService,Client,Router,MiscellaneousTools,MonitoringTools,ImportExportTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 4.2/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=ServerNoService,Client,Router,MiscellaneousTools,MonitoringTools,ImportExportTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 4.2/windows/windowsservercore-ltsc2016/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=ServerNoService,Client,Router,MiscellaneousTools,MonitoringTools,ImportExportTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 4.4/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=ServerNoService,Client,Router,MiscellaneousTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion 4.4/windows/windowsservercore-ltsc2016/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=ServerNoService,Client,Router,MiscellaneousTools' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
11 changes: 10 additions & 1 deletion Dockerfile-windows.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
'mongo.msi', \
'/quiet', \
'/qn', \
'/l*v', 'install.log', \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#run-the-windows-installer-from-the-windows-command-interpreter
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
'ADDLOCAL=placeholder' \
); \
if (-Not (Test-Path C:\mongodb\bin\mongo.exe -PathType Leaf)) { \
Write-Host 'Installer failed!'; \
Get-Content install.log; \
exit 1; \
}; \
Remove-Item install.log; \
\
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Expand Down
13 changes: 13 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ for version in "${versions[@]}"; do
# 4.3 doesn't seem to have a sha256 file (403 forbidden), so this has to be optional :(
windowsSha256="$(curl -fsSL "$windowsMsi.sha256" | cut -d' ' -f1 || :)"

# https://github.com/mongodb/mongo/blob/r4.4.2/src/mongo/installer/msi/wxs/FeatureFragment.wxs#L9-L92 (no MonitoringTools,ImportExportTools)
# https://github.com/mongodb/mongo/blob/r4.2.11/src/mongo/installer/msi/wxs/FeatureFragment.wxs#L9-L116
# https://github.com/mongodb/mongo/blob/r4.0.21/src/mongo/installer/msi/wxs/FeatureFragment.wxs#L9-L128
# https://github.com/mongodb/mongo/blob/r3.6.21/src/mongo/installer/msi/wxs/FeatureFragment.wxs#L9-L102 (no ServerNoService, only Server)
windowsFeatures='ServerNoService,Client,Router,MiscellaneousTools'
case "$rcVersion" in
4.2 | 4.0 | 3.6) windowsFeatures+=',MonitoringTools,ImportExportTools' ;;
esac
if [ "$rcVersion" = '3.6' ]; then
windowsFeatures="${windowsFeatures//ServerNoService/Server}"
fi

for winVariant in \
windowsservercore-{1809,ltsc2016} \
; do
Expand All @@ -190,6 +202,7 @@ for version in "${versions[@]}"; do
-e 's!^(ENV MONGO_DOWNLOAD_URL) .*!\1 '"$windowsMsi"'!' \
-e 's/^(ENV MONGO_DOWNLOAD_SHA256)=.*/\1='"$windowsSha256"'/' \
-e 's!^(FROM .+):.+!\1:'"${winVariant#*-}"'!' \
-e 's!(ADDLOCAL)=placeholder!\1='"$windowsFeatures"'!' \
Dockerfile-windows.template \
> "$version/windows/$winVariant/Dockerfile"
done
Expand Down

0 comments on commit 69ff4ee

Please sign in to comment.