Skip to content

Commit d9ccaed

Browse files
authored
Finish Release/v1.1.0
Docker on windows
2 parents 4275b2e + ebb9da6 commit d9ccaed

File tree

6 files changed

+205
-4
lines changed

6 files changed

+205
-4
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
FROM node:10 AS react-build
22
RUN mkdir app
3-
COPY . /app/
3+
COPY ./ /app
44
WORKDIR /app
55
RUN node openimis-config.js
66
RUN . ./modules-installs.txt
77
RUN yarn install --network-timeout 1000000
88
RUN yarn build
9-
RUN yarn global add serve
9+
RUN yarn global add serve
10+
CMD ["serve","-s","build"]

Dockerfile_win

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
ARG INSTALL_BASE="mcr.microsoft.com/windows/servercore"
2+
ARG INSTALL_TAG="ltsc2016"
3+
ARG WINDOWS_VERSION="4.8-windowsservercore-ltsc2016"
4+
ARG WINDOWS_BASE="mcr.microsoft.com/dotnet/framework/aspnet"
5+
6+
#FROM "${INSTALL_BASE}:${INSTALL_TAG}" AS downloader
7+
#ARG NEW_OPENIMIS_HOST
8+
#ENV NPM_CONFIG_LOGLEVEL info
9+
#ARG NODE_VERSION="10.16.3"
10+
#ARG ARCH="64"
11+
12+
13+
#SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
14+
#WORKDIR C:/dl
15+
#ARG NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-x${ARCH}.msi"
16+
17+
## download node and build the front end
18+
#RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\
19+
# Invoke-WebRequest -Uri $Env:NODE_URL -OutFile nodejs.msi -UseBasicParsing;\
20+
# Start-Process msiexec.exe -Wait -ArgumentList '/q /i nodejs.msi';
21+
#RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\
22+
# Invoke-WebRequest -Uri https://classic.yarnpkg.com/latest.msi -OutFile yarn.msi -UseBasicParsing;\
23+
# Start-Process msiexec.exe -Wait -ArgumentList '/q /i yarn.msi';
24+
25+
#COPY ./ C:/app
26+
27+
#WORKDIR C:/app
28+
#RUN node openimis-config.js
29+
#RUN ./modules-installs.txt;
30+
#RUN yarn install --network-timeout 1000000
31+
#RUN yarn build
32+
33+
34+
35+
FROM "${WINDOWS_BASE}:${WINDOWS_VERSION}"
36+
ARG OPENIMIS_VERSION="1.4.1"
37+
LABEL vendor="openIMIS"\
38+
maintainer="Patrick Delcroix <[email protected]>"\
39+
org.openimis.webapp.is-beta= \
40+
org.openimis.webapp.is-production="" \
41+
org.openimis.webapp.version="${OPENIMIS_VERSION}"
42+
ADD https://github.com/openimis/web_app_vb/releases/download/v${OPENIMIS_VERSION}/openIMIS_Web_App_x64_v${OPENIMIS_VERSION}.zip /temp/openIMIS.zip
43+
ADD "https://github.com/openimis/web_service_vb/releases/download/v1.2.1/openIMIS_Web_Services_v1.2.1.zip" /temp/Service.zip
44+
# ADD "https://github.com/openimis/policy_renewal_service_vb/releases/download/v1.2.0/ImisPolicyRenewalSetup.zip" /temp/Renewal.zip
45+
# ADD "https://github.com/openimis/assign_photo_service_vb/releases/download/v1.2.0/AssignPhotosSetup.zip" /temp/photo.zip
46+
# ADD "https://github.com/openimis/feedback_prompt_service_vb/releases/download/v1.2.0/ImisFeedbackPromptSetup.zip" /temp/feedback.zip
47+
ADD "https://github.com/shibayan/iislua/releases/download/v0.6.1/iislua_x64.msi" /temp/iislua_x64.msi
48+
ADD "https://go.microsoft.com/fwlink/?LinkID=615136" /temp/ARS.mis
49+
COPY script/configureConnectionStr.ps1 /temp/configureConnectionStr.ps1
50+
COPY script/InstallopenIMIS.ps1 /temp/InstallopenIMIS.ps1
51+
RUN powershell -Command /temp/InstallopenIMIS.ps1 $env:username;\
52+
Start-Process msiexec.exe -Wait -ArgumentList '/q /i /temp/iislua_x64.msi';
53+
RUN Start-Process msiexec.exe -Wait -ArgumentList '/q /i /temp/ars.msi';
54+
#ADD https://github.com/openimis/openimis-fe_js/releases/download/v1.1.0/openIMIS_FE_v1.1.0.zip C:/temp/build.zip
55+
#RUN Expand-Archive -Path C:/temp/build.zip -DestinationPath C:/inetpub/wwwroot/openIMIS/front
56+
57+
WORKDIR "/inetpub/wwwroot"
58+
#COPY --from=downloader /app/build /inetpub/wwwroot/openIMIS/front
59+
60+
ENTRYPOINT ["powershell","-Command","C:\\temp\\configureConnectionStr.ps1"]

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
# openIMIS Frontent Reference Implementation
1+
# openIMIS Frontent Reference Implementation : Windows Docker
2+
This repository holds the configuration files for the openIMIS Frontend Reference Implementation:
3+
- Legacy web applictation
4+
- Modular front end
5+
6+
Please look for the direction on the openIMIS Wiki: https://openimis.atlassian.net/wiki/spaces/OP/pages/963182705/MO1.1+Install+the+modular+openIMIS+using+Docker
7+
8+
Note: the modular frontend is part of the release ZIP of the legacy webapp, if the modular frontend need to be changed then new modular frontend static files need to be placed in /inetroot/www/openIMIS/front
9+
10+
Note 2: The docker file can be change to build first the frontend by uncommenting the "downloader" related lines.
11+
12+
This repo branches, tags,... are maintained by openIMIS official delivery team who use it to build the official openIMIS Docker images containing the official modules (versions) list.
13+
14+
In case of troubles, please consult/contact our service desk via our [ticketing site](https://openimis.atlassian.net/servicedesk/customer).
15+
16+
# openIMIS Frontent Reference Implementation : Linux
217
This repository holds the configuration files for the openIMIS Frontend Reference Implementation.
318
It serves 2 distinct use cases:
419
- developers who want to implement new modules or modify existing frontend modules of openIMIS
@@ -81,4 +96,4 @@ When release candidate is accepted:
8196
* tag the git repo according to your new version number
8297
* upload openimis-be docker image to docker hub
8398

84-
Note: This image only provides the openimis frontend server. The full openIMIS deployment (with the backend,...) is managed from openimis-dist_dck repo and its docker-compose.yml file.
99+
Note: This image only provides the openimis frontend server. The full openIMIS deployment (with the backend,...) is managed from openimis-dist_dck repo and its docker-compose.yml file.

script/InstallopenIMIS.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#https://blog.backslasher.net/event-log-permissions-with-scripts.html
2+
param(
3+
[string]$IISUser = 'IIS_IUSRS',
4+
[string]$source='IMIS',
5+
[string]$LogName="$source-LOG",
6+
[string]$SiteName = "Default Web Site",
7+
[string]$PathZip = "/temp"
8+
)
9+
#configure ISS
10+
Import-Module WebAdministration
11+
12+
$ZipFiles = Get-ChildItem "$PathZip/" -Filter *.zip
13+
Write-Output "move app binaries in wwwroot"
14+
15+
if(Test-Path IIS:\Sites\$SiteName){
16+
Write-output "Site $Sitename exist"
17+
} else{
18+
Write-output "Site $Sitename doesn't exist, create it"
19+
New-WebSite -Name $Sitename -IPAddress -PhysicalPath /inetpub/wwwroot/
20+
}
21+
foreach($Zip in $ZipFiles){
22+
$ZipName = $Zip.BaseName
23+
New-Item -ItemType directory -Path /temp/$ZipName
24+
Expand-Archive $PathZip/$Zip -DestinationPath /temp/$ZipName/
25+
$singleFile = (Get-ChildItem /temp/$ZipName/ | Measure-Object).count
26+
$subdirectoryPath = ""
27+
Write-output " number of file found $singleFile"
28+
if($singleFile -eq 1){
29+
$subdirectoryPath = Get-ChildItem -Directory /temp/$ZipName/ -Name | Select-Object -First 1
30+
Write-Output "sub directory $subdirectoryPath detected "
31+
$subdirectoryPath = "/$subdirectoryPath"
32+
}
33+
if($ZipName -eq "openIMIS"){
34+
New-Item -ItemType directory -Path /inetpub/wwwroot/$ZipName
35+
Set-ItemProperty "IIS:\Sites\$SiteName\" -name physicalPath -value C:\inetpub\wwwroot\$ZipName
36+
Move-Item -Path "/temp/$ZipName$subdirectoryPath/*" -Destination "/inetpub/wwwroot/$ZipName/"
37+
Write-Output "Create a copy of the $ZipName config files"
38+
Copy-Item "/inetpub/wwwroot/$ZipName/Web.config" -Destination "/inetpub/wwwroot/$ZipName/Web.config.sample"
39+
}elseif(Test-Path "/temp/$ZipName$subdirectoryPath/Web.config"){
40+
New-Item -ItemType directory -Path /inetpub/wwwroot/$ZipName
41+
New-WebApplication -Name $ZipName -Site $SiteName -PhysicalPath C:\inetpub\wwwroot\$ZipName -ApplicationPool DefaultAppPool
42+
Move-Item -Path "/temp/$ZipName$subdirectoryPath/*" -Destination "/inetpub/wwwroot/$ZipName/"
43+
Write-Output "Create a copy of the $ZipName config files"
44+
Copy-Item "/inetpub/wwwroot/$ZipName/Web.config" -Destination "/inetpub/wwwroot/$ZipName/Web.config.sample"
45+
}else{
46+
Write-Output "Move $ZipName in the service directory"
47+
New-Item -ItemType directory -Path /service/$ZipName
48+
Move-Item -Path "/temp/$ZipName$subdirectoryPath/*" -Destination /service/$ZipName/
49+
}
50+
51+
}
52+
53+
Write-Output "Create the eventlog/source"
54+
New-EventLog -LogName $LogName -Source $source
55+
Write-Output "give the right to $IISUser to the eventlog"
56+
$LogPath = 'HKLM:\SYSTEM\CurrentControlSet\services\EventLog\'+$LogName;
57+
$acl = Get-Acl $LogPath
58+
$ace = New-Object System.Security.AccessControl.RegistryAccessRule $IISUser,'WriteKey, ReadKey','allow'
59+
$acl.AddAccessRule($ace)
60+

script/configureConnectionStr.ps1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
param(
2+
[string]$DB_HOSTNAME=$Env:DB_HOST,
3+
[string]$DB_NAME=$Env:DB_NAME,
4+
[string]$DB_USER=$Env:DB_USER,
5+
[string]$DB_PASSWORD=$Env:DB_PASS
6+
)
7+
8+
Write-Output 'Old config: '
9+
Write-Output 'Source=[DatabaseIPAdress];Initial Catalog=IMIS;User ID=[ImisUserId];Password=[ImisUserPassword]'
10+
Write-Output 'New config: '
11+
Write-Output "Source=$DB_HOSTNAME;Initial Catalog=$DB_NAME;User ID=$DB_USER;Password=$DB_PASSWORD"
12+
$WebDirectories = Get-ChildItem -Directory /inetpub/wwwroot/
13+
foreach($webRoot in $WebDirectories){
14+
$webRootName = $webRoot.Name
15+
Write-Output "write the $webRootName config files"
16+
if (Test-Path /inetpub/wwwroot/$webRootName/Web.config){
17+
(Get-Content /inetpub/wwwroot/$webRootName/Web.config.sample)`
18+
-replace '\[DatabaseIPAdress\]',$DB_HOSTNAME`
19+
-replace '\[ImisUserId\]',$DB_USER`
20+
-replace '\[IMISDB\]',$DB_NAME`
21+
-replace '\[ImisUserPassword\]',$DB_PASSWORD`
22+
| Out-File -Encoding UTF8 /inetpub/wwwroot/$webRootName/Web.config;`
23+
Write-Output ('Pointing to legacy openIMIS on https://'+$Env:LEGACY_OPENIMIS_HOST)
24+
}
25+
}
26+
27+
Write-Output "launch IIS"
28+
$ISSprocess = (Start-Process C:\ServiceMonitor.exe -ArgumentList 'w3svc' -PassThru )
29+
$handle = $proc.Handle
30+
$ISSprocess.WaitForExit();
31+
While ($true){
32+
Get-EventLog -LogName IMIS-LOG -Source IMIS -After (Get-Date).AddMinutes(-1) | Sort-Object Time
33+
if ($ISSprocess.ExitCode -ne 0) {
34+
Write-Warning "$_ exited with status code $($proc.ExitCode)"
35+
break;
36+
}
37+
Start-Sleep -s 60
38+
}

script/downloadIMIS.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
param(
2+
[string]$PathZip = "/temp"
3+
)
4+
5+
#setting https protocols
6+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
7+
# lattest open IMIS binaries
8+
$urlWebApp = "https://github.com/openimis/web_app_vb/releases/download/v1.3.0/openIMIS_Web_App_x64_v1.3.0.zip"
9+
$urlWebService = "https://github.com/openimis/web_service_vb/releases/download/v1.2.1/openIMIS_Web_Services_v1.2.1.zip"
10+
# $urlRenewalService = "https://github.com/openimis/policy_renewal_service_vb/releases/download/v1.2.0/ImisPolicyRenewalSetup.zip"
11+
#$urlBackupService = "https://github.com/openimis/backup_service_vb/releases/download/v1.2.0/ImisBackupSetupx64.zip"
12+
# $urlPhotoService = "https://github.com/openimis/assign_photo_service_vb/releases/download/v1.2.0/AssignPhotosSetup.zip"
13+
# $urlfeedbackService = "https://github.com/openimis/feedback_prompt_service_vb/releases/download/v1.2.0/ImisFeedbackPromptSetup.zip"
14+
#dowload
15+
Write-Output "download OpenIMIS binaries"
16+
Invoke-WebRequest -Uri $urlWebApp -OutFile "$PathZip/openIMIS.zip"
17+
Write-Output "download web services binaries"
18+
Invoke-WebRequest -Uri $urlWebService -OutFile "$PathZip/Service.zip"
19+
Write-Output "download Renewal service binaries"
20+
# Invoke-WebRequest -Uri $urlRenewalService -OutFile "$PathZip/RenewalService.zip"
21+
#Write-Output "download Backup service binaries"
22+
#Invoke-WebRequest -Uri $urlBackupService -OutFile "$PathZip/BackupService.zip"
23+
# Write-Output "download Photo update service binaries"
24+
# Invoke-WebRequest -Uri $urlPhotoService -OutFile "$PathZip/PhotoService.zip"
25+
# Write-Output "download Feedback prompt binaries"
26+
# Invoke-WebRequest -Uri $urlfeedbackService -OutFile "$PathZip/FBService.zip"
27+
# Write-Output "uncompress app binaries"

0 commit comments

Comments
 (0)