PostgreSQL install on Ubuntu/Windows. (#636)

* added windows installation script for postgresql

* removed if from Start-PostreSQL

* added script to packar template.

* changed postgresql.sh for ubuntu.

* postgresql stop and disalbe services.

* change name of the functions

* Stop postgreSQL after validation instead of start.

* added validation and re-work installation prcoedur

* remove redundunt code from psql

* correct intendation

* path to Path

* added PostgreSQL validation procedure.

* Removed useless last line.

* redundunt parameter passed in function call.

* removed repeated part of code.

* removed Stop function since it was useless.

* spaces

* spaces =

* Update Windows2019-Azure.json

* resolve confictls

* added validate and install postgresql

* added password to choco install and variables.

* add new system variables.

* added --params flag

* added correct quotas

* added logging for PostgreSQL install

Co-authored-by: Dariy.Nurgaleev <d.nurgaleev@trueengineering.ru>
This commit is contained in:
Darii Nurgaleev
2020-06-02 19:52:42 +07:00
committed by GitHub
parent c6a872a71e
commit 3be17cf239
5 changed files with 100 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
$ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers
#Define user and password for PostgreSQL database
$postgresusr="postgres"
$postgrespwd="root"
#Prepare environment variable for validation
Set-SystemVariable -SystemVariable PGUSER -Value $postgresusr
Set-SystemVariable -SystemVariable PGPASSWORD -Value $postgrespwd
#Install latest PostgreSQL
cinst postgresql --params "/Password:$postgrespwd" --params-global --debug --verbose
#Get Path to pg_ctl.exe
$paths = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
#Parse output of command above to obtain pure path
$pgbin = $paths.split('"')[1].replace("\pg_ctl.exe", "")
#Added PostgreSQL bin path into PATH variable.
Add-MachinePathItem $pgbin