-
Notifications
You must be signed in to change notification settings - Fork 0
/
das.sh
66 lines (46 loc) · 1.3 KB
/
das.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -o nounset # Treat unset variables as an error
PORT=${1-4848}
HOST=${2-127.0.0.1}
ASADMIN=/opt/payara41/glassfish/bin/asadmin
PAYA_HOME=/opt/payara41
PASSWORD=admin
RASADMIN="$ASADMIN --user admin --passwordfile=$PAYA_HOME/pfile --port $PORT --host $HOST"
createPasswordFile() {
cat << EOF > pfile
AS_ADMIN_PASSWORD=$PASSWORD
AS_ADMIN_SSHPASSWORD=payara
EOF
cp pfile $PAYA_HOME
}
startDomain() {
$ASADMIN start-domain domain1
}
enableSecureAdmin() {
# Set admin password
curl -X POST \
-H 'X-Requested-By: payara' \
-H "Accept: application/json" \
-d id=admin \
-d AS_ADMIN_PASSWORD= \
-d AS_ADMIN_NEWPASSWORD=$PASSWORD \
http://localhost:4848/management/domain/change-admin-password
$RASADMIN enable-secure-admin
$ASADMIN restart-domain domain1
}
createCluster() {
$RASADMIN create-cluster cluster
$RASADMIN create-node-config --nodehost localhost --installdir $PAYA_HOME node1
}
createInstance(){
$RASADMIN create-local-instance --cluster cluster i00
$RASADMIN create-local-instance --cluster cluster i01
$RASADMIN start-local-instance --sync full i00
$RASADMIN start-local-instance --sync full i01
}
#Calling the method
createPasswordFile
startDomain
enableSecureAdmin
createCluster
createInstance