-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDeploy-Application.ps1
37 lines (28 loc) · 1.38 KB
/
Deploy-Application.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#Requires -Version 3.0
Param(
[Parameter(Mandatory=$True)]
[string]
$DockerRegistryUrl
)
# stop the script on first error
$ErrorActionPreference = 'Stop'
Remove-Item ./.generated -Recurse -ErrorAction Ignore
New-Item -ItemType Directory -Force -Path ./.generated
# namespace (will fail if exists, therefore should be manually delete if re-deploying)
kubectl create ns realtime-microservices
# redis
Copy-Item -Path ./Redis/deployment.yaml -Destination ./.generated/redis-deployment.yaml
# notification producer
$deploymentFilePath = "./.generated/notification-producer-deployment.yaml"
Copy-Item -Path ./NotificationProducer/deployment.yaml -Destination $deploymentFilePath
(Get-Content $deploymentFilePath).replace('${DockerRegistryUrl}', $DockerRegistryUrl) | Set-Content $deploymentFilePath
# backend for frontend
$deploymentFilePath = "./.generated/bff-deployment.yaml"
Copy-Item -Path ./BackendForFrontend/deployment.yaml -Destination $deploymentFilePath
(Get-Content $deploymentFilePath).replace('${DockerRegistryUrl}', $DockerRegistryUrl) | Set-Content $deploymentFilePath
# frontend
$deploymentFilePath = "./.generated/frontend-deployment.yaml"
Copy-Item -Path ./Frontend/deployment.yaml -Destination $deploymentFilePath
(Get-Content $deploymentFilePath).replace('${DockerRegistryUrl}', $DockerRegistryUrl) | Set-Content $deploymentFilePath
# deploy everything
kubectl apply -f .generated