Skip to content

Commit

Permalink
[DI-1334 Change Docker check to see if posgres is ready] (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpardogrowthaccelerationpartners authored Apr 3, 2024
1 parent a404c8f commit 60806ea
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 26 deletions.
22 changes: 16 additions & 6 deletions Compose/pgsql/compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version: "3.8"

services:
dataimport:
platform: linux/x86_64
build:
context: ../../
dockerfile: Dockerfile
Expand All @@ -26,9 +27,9 @@ services:
APPSETTINGS__SHARENAME: "${APPSETTINGS__SHARENAME:-/app/Common/temp}"
TZ: "${TIME_ZONE:-US/Central}"
depends_on:
- pb-dataimport
- pb-dataimport
restart: always
hostname: dataimport
hostname: dataimport
container_name: ed-fi-dataimport

db-dataimport:
Expand All @@ -43,12 +44,21 @@ services:
- vol-db-dataimport:/var/lib/postgresql/data
restart: always
container_name: ed-fi-db-dataimport
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
start_period: "60s"
retries: 3

pb-dataimport:
image: pgbouncer/pgbouncer@sha256:aa8a38b7b33e5fe70c679053f97a8e55c74d52b00c195f0880845e52b50ce516 #pgbouncer:1.15.0
image: bitnami/pgbouncer
environment:
DATABASES: "* = host = db-dataimport port=5432 user=${POSTGRES_USER} password=${POSTGRES_PASSWORD}"
POSTGRES_PORT: "${POSTGRES_PORT:-6432}"
PGBOUNCER_DATABASE: "*"
PGBOUNCER_PORT: "${PGBOUNCER_LISTEN_PORT:-6432}"
POSTGRESQL_USER: "${POSTGRES_USER}"
POSTGRESQL_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRESQL_HOST: db-dataimport
PGBOUNCER_SET_DATABASE_USER: "yes"
PGBOUNCER_SET_DATABASE_PASSWORD: "yes"
ports:
- "5403:${POSTGRES_PORT:-6432}"
restart: always
Expand All @@ -59,4 +69,4 @@ services:
volumes:
vol-db-dataimport:
driver: local
name: vol-db-dataimport
name: vol-db-dataimport
2 changes: 1 addition & 1 deletion DataImport.Web/Helpers/JsonValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public bool IsValidJson(string data)
return false;
}
}
}
}
38 changes: 19 additions & 19 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ param(
# Assembly and package version number. The current package number is
# configured in the build automation tool and passed to this script.
[string]
$Version = "0.1.0",
$Version = "0.1.0",

# .NET project build configuration, defaults to "Debug". Options are: Debug, Release.
[string]
Expand Down Expand Up @@ -136,7 +136,7 @@ $appCommonPackageVersion = "3.1.0"

Import-Module -Name "$PSScriptRoot/eng/build-helpers.psm1" -Force
Import-Module -Name "$PSScriptRoot/eng/package-manager.psm1" -Force
function Clean {
function DotNetClean {
Invoke-Execute { dotnet clean $solutionRoot -c $Configuration --nologo -v minimal }
}

Expand All @@ -151,15 +151,15 @@ function InitializePython {
if (-not (Test-Path $python)) {
$sourcePythonZip = "https://www.python.org/ftp/python/3.10.2/python-3.10.2-embed-amd64.zip"
$destPythonZip = "$toolsDir\python-3.10.2-embed-amd64.zip"

Write-Host "Downloading python 3.10.2 official release"
Invoke-WebRequest $sourcePythonZip -OutFile $destPythonZip
Expand-Archive $destPythonZip -DestinationPath "$toolsDir\python"
Remove-Item $destPythonZip
}
}

function Clean {
function DotNetClean {
Invoke-Execute { dotnet clean $solutionRoot -c $Configuration --nologo -v minimal }
}

Expand Down Expand Up @@ -214,7 +214,7 @@ function PublishTransformLoad {
function PublishTransformLoadSelfContained {
Invoke-Execute {
$outputPath = "$solutionRoot/$transformLoadProject/publish/scd"
$project = "$solutionRoot/$transformLoadProject/"
$project = "$solutionRoot/$transformLoadProject/"
dotnet publish $project -c $Configuration /p:EnvironmentName=Production -o $outputPath -r win10-x64 --nologo --self-contained true
}
}
Expand Down Expand Up @@ -299,27 +299,27 @@ function NewDevCertificate {
}

function BuildPackage {
$baseProjectFullName = "$solutionRoot/$entryProject/$entryProject"
$baseProjectFullName = "$solutionRoot/$entryProject/$entryProject"
RunDotNetPack -PackageVersion $Version -projectName $baseProjectFullName $baseProjectFullName
}

function PushPackage {
param (
[string]
$PackageVersion = $Version
$PackageVersion = $Version
)

if (-not $NuGetApiKey) {
throw "Cannot push a NuGet package without providing an API key in the `NuGetApiKey` argument."
}

if (-not $PackageFile) {
if("Web" -ieq $PackageFileType){
$PackageFile = "$PSScriptRoot/$entryProject.$PackageVersion.nupkg"
if("Web" -ieq $PackageFileType){
$PackageFile = "$PSScriptRoot/$entryProject.$PackageVersion.nupkg"
DotnetPush $PackageFile
}
else {
$PackageFile = "$PSScriptRoot/$transformLoadProject.$PackageVersion.nupkg"
else {
$PackageFile = "$PSScriptRoot/$transformLoadProject.$PackageVersion.nupkg"
DotnetPush $PackageFile
$PackageFileWin64 = "$PSScriptRoot/$transformLoadProject.Win64.$PackageVersion.nupkg"
DotnetPush $PackageFileWin64
Expand All @@ -344,7 +344,7 @@ function DotnetPush {
function Invoke-Build {
Write-Host "Building Version $Version" -ForegroundColor Cyan

Invoke-Step { Clean }
Invoke-Step { DotNetClean }
Invoke-Step { Restore }
Invoke-Step { Compile }
}
Expand All @@ -370,11 +370,11 @@ function Invoke-Run {
}

function Invoke-SetUp {
Invoke-Step { InitializePython }
Invoke-Step { InitializePython }
}

function Invoke-Clean {
Invoke-Step { Clean }
Invoke-Step { DotNetClean }
}

function Invoke-UnitTests {
Expand All @@ -394,11 +394,11 @@ function Invoke-BuildPackage {
Invoke-Step { BuildPackage }
}

function Invoke-BuildTransformLoadPackage {
function Invoke-BuildTransformLoadPackage {
Invoke-Step { BuildTransformLoadPackage }
}

function Invoke-PushPackage {
function Invoke-PushPackage {
Invoke-Step { PushPackage }
}

Expand Down Expand Up @@ -429,10 +429,10 @@ function Invoke-DockerDeploy {
function Invoke-SetAssemblyInfo {
Write-Output "Setting Assembly Information" -ForegroundColor Cyan

Invoke-Step { AssemblyInfo }
Invoke-Step { AssemblyInfo }
}

function AddAppCommonPackageForInstaller {
function AddAppCommonPackageForInstaller {
$destinationPath = "$PSScriptRoot/Installer"

$arguments = @{
Expand All @@ -448,7 +448,7 @@ function AddAppCommonPackageForInstaller {
Invoke-Main {
if($IsLocalBuild)
{
$nugetExePath = Install-NugetCli
$nugetExePath = Install-NugetCli
Set-Alias nuget $nugetExePath -Scope Global -Verbose
}
switch ($Command) {
Expand Down

0 comments on commit 60806ea

Please sign in to comment.