Skip to content

Commit

Permalink
Upgraded release script and local testing compose file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexatstariongroup committed Jun 10, 2022
1 parent 1265be4 commit 34933fe
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CDP4WebServer.IIS/CDP4WebServer.IIS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\$(MSBuildToolsVersion)\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
Expand Down
11 changes: 11 additions & 0 deletions compose.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,20 @@ IF %1==devdown GOTO DevDown
IF %1==devtestdown GOTO DevTestDown
IF %1==nginx GOTO Serv
IF %1==nginxdown GOTO ServDown
IF %1==local GOTO Local
IF %1==localdown GOTO LocalDown

GOTO End

:Local
START /B docker-compose -f docker-compose-local.yml down --remove-orphans
START /B docker-compose -f docker-compose-local.yml up --build -d
GOTO End

:LocalDown
START /B docker-compose -f docker-compose-local.yml down --remove-orphans
GOTO End

:Serv
rem Need to build the application in Release before making the image
CALL MSBuild.exe CDP4-Server.sln -property:Configuration=Release -restore
Expand Down
53 changes: 53 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3.8'
services:

cdp4_db:
image: rheagroup/cdp4-database-community-edition:latest
hostname: cdp4-postgresql
command: postgres -c max_locks_per_transaction=1024
environment:
- POSTGRES_PASSWORD=${DB_POSTGRESPASSWORD}
- POSTGRES_USER=postgres
networks:
cdp4:
aliases:
- cdp4-postgresql
container_name: cdp4-database-community-edition
restart: always
ports:
- '${DB_HOSTPORT}:5432'
expose:
- '5432'
volumes:
- cdpdbdata:/var/lib/postgresql/data
- cdpdblogs:/logs

cdp4_webservices:
hostname: cdp4-webservices
image: cdp4-services-community-edition:latest
restart: always
build: .
networks:
cdp4:
aliases:
- cdp4-webservices
depends_on:
- cdp4_db
ports:
- "${WEBSERVICES_HOSTPORT}:5000"
expose:
- '5000'
volumes:
- cdpwslogs:/app/logs
- cdpwsstorage:/app/storage
- cdpwsupload:/app/upload

networks:
cdp4:

volumes:
cdpdbdata:
cdpdblogs:
cdpwslogs:
cdpwsstorage:
cdpwsupload:
70 changes: 69 additions & 1 deletion release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
IF %1.==. GOTO VersionError
set version=%1

set releasefolder=.\Release
set buildfolder=.\CDP4WebServer\bin\Release\net472
set buildfolderIIS=.\CDP4WebServer.IIS\bin\app.publish
set logs=logs
set filename=COMETWebServices-%version%.zip
set filenameIIS=COMETWebServices-IIS-%version%.zip

GOTO Setup

:VersionError
Expand Down Expand Up @@ -31,10 +38,40 @@ set dry=true

:Begin

ECHO.
ECHO Creating release folders
ECHO.

if not exist %releasefolder% mkdir %releasefolder%
if exist %releasefolder%\%version% rmdir %releasefolder%\%version% /S /Q
if not exist %releasefolder%\%version% mkdir %releasefolder%\%version%

ECHO.
ECHO Cleaning up...
ECHO.

call MSBuild.exe CDP4-Server.sln -target:Clean -p:Configuration=Release

ECHO.
ECHO Removing logs if existing...
ECHO.

if exist %buildfolder%\%logs% rmdir %buildfolder%\%logs% /S /Q

ECHO.
ECHO Building solution....
ECHO.

call MSBuild.exe CDP4-Server.sln -property:Configuration=Release -restore

ECHO Error Level %errorlevel%

IF %errorlevel%==1 GOTO BuildError

ECHO.
ECHO Cleaning local Images...
ECHO.

REM cleanup previous if exists
docker rmi cdp4-services-community-edition:%version%
docker rmi rheagroup/cdp4-services-community-edition:%version%
Expand All @@ -52,6 +89,27 @@ docker build -t cdp4-services-community-edition:%version% -t cdp4-services-commu
docker tag cdp4-services-community-edition:%version% rheagroup/cdp4-services-community-edition:%version%
docker tag cdp4-services-community-edition:latest rheagroup/cdp4-services-community-edition:latest

ECHO.
ECHO Building IIS version....
ECHO.

call MSBuild.exe .\CDP4WebServer.IIS\CDP4WebServer.IIS.csproj /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /p:Configuration=Release /p:VisualStudioVersion=14.0

ECHO.
ECHO Building Release Archive
ECHO.

call powershell -Command "& {Compress-Archive -Path %buildfolder%\* -DestinationPath %releasefolder%\%version%\%filename% -Force;}"
call powershell -Command "& {Compress-Archive -Path %buildfolderIIS%\* -DestinationPath %releasefolder%\%version%\%filenameIIS% -Force;}"

ECHO.
ECHO Generating Verification Hashes
ECHO.

call powershell -Command "& {Get-ChildItem -Path %releasefolder%\%version% -Recurse -Filter *.zip | Get-FileHash -Algorithm MD5 | Format-List | Out-File %releasefolder%\%version%\verification_hashes_%version%.txt}"
call powershell -Command "& {Get-ChildItem -Path %releasefolder%\%version% -Recurse -Filter *.zip | Get-FileHash | Format-List | Out-File %releasefolder%\%version%\verification_hashes_%version%.txt -Append}"


IF %dry% equ true GOTO End

ECHO.
Expand All @@ -66,4 +124,14 @@ docker push rheagroup/cdp4-services-community-edition:latest

ECHO.
ECHO Release %version% Completed
ECHO.
ECHO.

EXIT /B 0

:BuildError

ECHO.
ECHO Release %version% %platform% Failed
ECHO.

EXIT /B 1

0 comments on commit 34933fe

Please sign in to comment.