Skip to content

Commit 4bf6f01

Browse files
adding missing powershell scripts/fixes (#237)
1 parent 296424b commit 4bf6f01

File tree

3 files changed

+118
-1
lines changed

3 files changed

+118
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<#
2+
Copyright (c) 2023, Oracle and/or its affiliates.
3+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
This script is used to create a local WebLogic Server domain to use for
6+
discovering the model section of the WKTUI Quickstart.
7+
#>
8+
$BASEDIR = $PSScriptRoot
9+
if (-not $env:WKTUI_QS_HOME) {
10+
$env:WKTUI_QS_HOME = (get-item $BASEDIR).parent.parent.FullName
11+
}
12+
13+
if (-not $env:JAVA_HOME) {
14+
Write-Error "JAVA_HOME environment variable must be set. Please edit and run the ${env:WKTUI_QS_HOME}\setQuickstartEnv.sh file"
15+
exit 1
16+
} elseif (-not (Test-Path -Path "$env:JAVA_HOME")) {
17+
Write-Error "JAVA_HOME directory ${env:JAVA_HOME} does not exist...exiting"
18+
exit 1
19+
}
20+
21+
if (-not $env:ORACLE_HOME) {
22+
Write-Error "ORACLE_HOME environment variable must be set. Please edit and run the ${env:WKTUI_QS_HOME}\setQuickstartEnv.sh file"
23+
exit 1
24+
} elseif (-not (Test-Path -Path "$env:ORACLE_HOME")) {
25+
Write-Error "ORACLE_HOME directory ${env:ORACLE_HOME} does not exist...exiting"
26+
exit 1
27+
}
28+
29+
if (-not $env:WLSDEPLOY_HOME) {
30+
Write-Error "WLSDEPLOY_HOME environment variable must be set. Please edit and run the ${env:WKTUI_QS_HOME}\setQuickstartEnv.sh file"
31+
exit 1
32+
} elseif (-not (Test-Path -Path "$env:WLSDEPLOY_HOME")) {
33+
Write-Error "WLSDEPLOY_HOME directory ${env:WLSDEPLOY_HOME} does not exist...exiting"
34+
exit 1
35+
}
36+
37+
if (-not (Test-Path -Path "${env:WKTUI_QS_HOME}\todolist_domain")) {
38+
Get-ChildItem -Path "${env:WKTUI_QS_HOME}\todolist_domain" -Recurse | Remove-Item -Force -Recurse
39+
if ($LASTEXITCODE -ne 0) {
40+
Write-Error "Failed to delete existing files in domain directory ${WKTUI_QS_HOME}\todolist_domain...exiting"
41+
exit 1
42+
}
43+
44+
Remove-Item "${env:WKTUI_QS_HOME}\todolist_domain" -Force
45+
if ($LASTEXITCODE -ne 0) {
46+
Write-Error "Failed to delete existing domain directory ${WKTUI_QS_HOME}\todolist_domain...exiting"
47+
exit 1
48+
}
49+
}
50+
51+
&"${env:WLSDEPLOY_HOME}\bin\createDomain.cmd" -oracle_home "${env:ORACLE_HOME}" -domain_parent "${env:WKTUI_QS_HOME}" -model_file "${BASEDIR}\model.yaml" -variable_file "${BASEDIR}\variables.properties" -archive_file "${BASEDIR}\archive.zip"
52+
if ($LASTEXITCODE -eq 0) {
53+
Write-Output ""
54+
Write-Output "Successfully created the domain at ${env:WKTUI_QS_HOME}\todolist_domain"
55+
Write-Output ""
56+
} else {
57+
Write-Error ""
58+
Write-Error "Failed to create the domain at ${env:WKTUI_QS_HOME}\todolist_domain...exiting"
59+
Write-Error ""
60+
exit 1
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<#
2+
Copyright (c) 2023, Oracle and/or its affiliates.
3+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
This script starts up a MySQL database in a container using the
6+
host's networking (to make it simpler). There is no persistence
7+
directory so any changes made to the data can be reset by simply
8+
restarting the container.
9+
#>
10+
$BASEDIR = $PSScriptRoot
11+
if (-not $env:WKTUI_QS_HOME) {
12+
$env:WKTUI_QS_HOME = (get-item $BASEDIR).parent.parent.FullName
13+
}
14+
15+
if (-not $env:IMAGE_BUILDER_EXE) {
16+
Write-Error "IMAGE_BUILDER_EXE environment variable must be set. Please edit and run the ${env:WKTUI_QS_HOME}\setQuickstartEnv.sh file"
17+
exit 1
18+
}
19+
20+
if (-not $env:ORCL_SSO_USER) {
21+
$env:ORCL_SSO_USER = Read-Host "Please enter your Oracle SSO account username: "
22+
if (-not $env:ORCL_SSO_USER) {
23+
Write-Error "No Oracle SSO account username provided...exiting"
24+
exit 1
25+
}
26+
}
27+
28+
if (-not $env:ORCL_SSO_PASS) {
29+
$ORCL_SSO_PASS = Read-Host "Please enter your Oracle SSO account password: " -AsSecureString
30+
if (-not $ORCL_SSO_PASS) {
31+
Write-Error "No Oracle SSO account password provided...exiting"
32+
exit 1
33+
}
34+
$env:ORCL_SSO_PASS = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
35+
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($ORCL_SSO_PASS))
36+
}
37+
38+
$argList = "login container-registry.oracle.com -u `"$env:ORCL_SSO_USER`" -p `"$env:ORCL_SSO_PASS`""
39+
40+
$proc = Start-Process -NoNewWindow -FilePath "$env:IMAGE_BUILDER_EXE" -ArgumentList "$argList" -PassThru
41+
Wait-Process -InputObject $proc
42+
if ($proc.ExitCode -ne 0) {
43+
Write-Error "Failed to log in to the image registry container-registry.oracle.com"
44+
exit 1
45+
}
46+
47+
$argList = "run --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=manager1 -e MYSQL_USER=weblogic -e MYSQL_PASSWORD=welcome1 -e MYSQL_DATABASE=tododb --mount type=bind,src=`"${env:WKTUI_QS_HOME}\sql\\`",dst=/docker-entrypoint-initdb.d/ -d container-registry.oracle.com/mysql/community-server:8.0.32"
48+
Write-Output "argList = $argList"
49+
50+
$proc = Start-Process -NoNewWindow -FilePath "$env:IMAGE_BUILDER_EXE" -ArgumentList "$argList" -PassThru
51+
Wait-Process -InputObject $proc
52+
if ($proc.ExitCode -ne 0) {
53+
Write-Error "Failed to start MySQL database container...exiting"
54+
exit 1
55+
}
56+

samples/quickstart/setQuickstartEnv.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ $env:ORCL_SSO_PASS = 'welcome1'
6161
# Set to the name of the program you are using to create
6262
# container images (i.e., docker or podman)
6363
#
64-
$env:IMAGE_BUILDER_EXE=docker
64+
$env:IMAGE_BUILDER_EXE = "docker"
6565

6666
#############################################################
6767
# DO NOT EDIT BELOW HERE #

0 commit comments

Comments
 (0)