-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure_unicore
91 lines (75 loc) · 7.04 KB
/
configure_unicore
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#title :configure_unicore
#description :This script will configure and start the UNICORE components
#author :Maximilian Hanussek
#date :2019-10-15
#version :1.3
#usage :sh configure_unicore MASTER_NODE_IP TOTAL_CPUS_MAX NODE_CPUS_MAX NODE_MEM_MAX NODES_MAX
#notes :Needs six parameter: Local IP of the master node, Sum of total CPUs, Maximum of CPUs per node, Maximum of RAM per node (in Bytes), Maximum number of nodes, Public IP of master node
#bash_version :4.2.46(1)-release
#============================================================================================================================================================================
MASTER_NODE_IP_LOCAL=$1 #Get local master node IP (unicore-master)
TOTAL_CPUS_MAX=$2 #Get number of CPUs of total cluster
NODE_CPUS_MAX=$3 #Get maximal number of CPUs per node
NODE_MEM_MAX=$4 #Get maximal number of RAM per node (in Bytes!)
NODE_MEM_DEFAULT=$NODE_MEM_MAX #Set value of maximal RAM per node also as default
NODES_MAX=$5 #Get the maximal number of nodes in the cluster
MASTER_NODE_IP_PUBLIC=$6 #Get public master node IP (unicore-master-public)
REGISTRY_URL="https://$MASTER_NODE_IP_PUBLIC:8080/REGISTRY/services/Registry?res=default_registry" #Set Registry URL accessing cluster from outside
WORKFLOW_GATEWAY="https://$MASTER_NODE_IP_PUBLIC:8098" #Set Workflow gateway URL
SERVORCH_GATEWAY="https://$MASTER_NODE_IP_PUBLIC:7701" #Set Serverorchestration gateway URL
PROPERTIES_FILE_SERVER=/usr/local/unicore-servers-7.9.0/configure.properties #Set path to UNICORE servers configuration file
PROPERTIES_FILE_WORKFLOW=/usr/local/unicore-workflow-7.9.1/configure.properties #Set path to UNICORE workflow configuration file
PROPERTIES_FILE_CONNECTIONS_GATEWAY=/usr/local/unicore-servers-7.9.0/gateway/conf/connections.properties #Set path to gateway connections property path
ADDUSER_FILE=/usr/local/unicore-servers-7.9.0/adduser.sh #Set path to adduser.sh file used by xuudb
### UNICORE SERVER CONFIGURATION ###
#Set the correct configvalues in the corresponding configuration file#
sudo sed -i "/^gwHost=/c\gwHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxHost=/c\uxHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxTotalCPUsMax=/c\uxTotalCPUsMax=$TOTAL_CPUS_MAX" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxCPUsPerNodeMax=/c\uxCPUsPerNodeMax=$NODE_CPUS_MAX" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxMemoryPerNodeMax=/c\uxMemoryPerNodeMax=$NODE_MEM_MAX" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxMemoryPerNodeDefault=/c\uxMemoryPerNodeDefault=$NODE_MEM_DEFAULT" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxNodesMax/c\uxNodesMax=$NODES_MAX" $PROPERTIES_FILE_SERVER
sudo sed -i "/^tsiHost=/c\tsiHost=$MASTER_NODE_IP_LOCAL" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxXnjsConfigFile=/c\uxXnjsConfigFile=xnjs_legacy.xml" $PROPERTIES_FILE_SERVER #Important that job is scheduled to compute nodes
sudo sed -i "/^xuudbHost=/c\xuudbHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_SERVER
sudo sed -i "/^registryHost=/c\registryHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_SERVER
sudo sed -i "/^INSTALL_PATH=/c\INSTALL_PATH=/usr/local/unicore-servers-7.9.0" $PROPERTIES_FILE_SERVER
sudo sed -i "/^registry=/c\registry=true" $PROPERTIES_FILE_SERVER
sudo sed -i "/^gwAutoRegistration=/c\gwAutoRegistration=true" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxMemory=/c\uxMemory=1024" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxEnableStorageFactory=/c\uxEnableStorageFactory=true" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxDefaultStorageFactoryPath=/c\uxDefaultStorageFactoryPath=/beeond" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxTSIStatusUpdateInterval=/c\uxTSIStatusUpdateInterval=5000" $PROPERTIES_FILE_SERVER
sudo sed -i "/^uxTSIWorkingDirectoriesBasedir=/c\uxTSIWorkingDirectoriesBasedir=/beeond" $PROPERTIES_FILE_SERVER
sudo sed -i "/^tsiSelected=/c\tsiSelected=torque" $PROPERTIES_FILE_SERVER
### UNICORE WORKFLOW CONFIGURATION ###
#Set the correct configvalues in the corresponding configuration file#
sudo sed -i "/^gwHost=/c\gwHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^wfHost=/c\wfHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^soHost=/c\soHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^urlExternalRegistry=/c\urlExternalRegistry=$REGISTRY_URL" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^xuudbHost=/c\xuudbHost=$MASTER_NODE_IP_PUBLIC" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^wfPort=/c\wfPort=8098" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^wfMemory=/c\wfMemory=1024" $PROPERTIES_FILE_WORKFLOW
sudo sed -i "/^soMemory=/c\soMemory=1024" $PROPERTIES_FILE_WORKFLOW
cd /usr/local/unicore-servers-7.9.0/ #Change into unicore-servers directory
sudo ./configure.py unicore $MASTER_NODE_IP_PUBLIC #Run configure.py script
### Make UNICORE server component aware of the workflow component ###
sudo -u unicore bash -c "echo 'WORKFLOW = $WORKFLOW_GATEWAY' >> $PROPERTIES_FILE_CONNECTIONS_GATEWAY"
sudo -u unicore bash -c "echo 'SERVORCH = $SERVORCH_GATEWAY' >> $PROPERTIES_FILE_CONNECTIONS_GATEWAY"
### Install/Copy all files to the correct directory ###
sudo ./install.py #Run install.py script (might throw an error, which does not matter)
#Change use of system python (2.7.5), to additional installed version of python >= 2.7.6 (required by UNICORE tsi)
sudo sed -i '/nohup/c\nohup /usr/local/bin/python2.7 $PY/TSI.py $PARAM > ${STARTLOG} 2>&1 & echo $! > ${PID}' /usr/local/unicore-servers-7.9.0/tsi_selected/bin/start.sh
#Add -f flag for rm command to run it without interaction
sudo sed -i "/^rm/c\rm -f FIRST_START" $ADDUSER_FILE
sudo -u unicore sh -c "/usr/local/unicore-servers-7.9.0/start.sh" #Start all UNICORE server components (as user unicore)
sudo -u root sh -c "/usr/local/unicore-servers-7.9.0/tsi_selected/bin/start.sh" #Start tsi (as user root)
cd /usr/local/unicore-workflow-7.9.1/ #Change into unicore-workflow directory
sudo ./configure.py unicore #Run configure.py script
sudo ./install.py #Run install.py script (might answer that nothing is to do)
sudo -u unicore sh -c "sh /usr/local/unicore-servers-7.9.0/xuudb/bin/admin.sh adddn REGISTRY 'CN=Demo Servorch, O=UNICORE, C=EU' nobody server"
sudo -u unicore sh -c "sh /usr/local/unicore-servers-7.9.0/xuudb/bin/admin.sh adddn REGISTRY 'CN=Demo Workflow, O=UNICORE, C=EU' nobody server"
sudo -u unicore sh -c "/usr/local/unicore-workflow-7.9.1/start-workflow.sh" #Start all UNICORE workflow components (as user unicore)