Skip to content

Commit 24e11af

Browse files
Initial Commits for Streamis server.
1 parent 5f3d281 commit 24e11af

File tree

337 files changed

+7001
-12545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+7001
-12545
lines changed

Diff for: assembly/assembly.iml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4+
<output url="file://$MODULE_DIR$/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
6+
<content url="file://$MODULE_DIR$">
7+
<excludeFolder url="file://$MODULE_DIR$/target" />
8+
</content>
9+
<orderEntry type="inheritedJdk" />
10+
<orderEntry type="sourceFolder" forTests="false" />
11+
</component>
12+
</module>

Diff for: assembly/pom.xml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2021 WeBank
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<project xmlns="http://maven.apache.org/POM/4.0.0"
18+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
<parent>
21+
<artifactId>streamis</artifactId>
22+
<groupId>com.webank.wedatasphere.streamis</groupId>
23+
<version>0.1.0</version>
24+
</parent>
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<artifactId>assembly</artifactId>
28+
29+
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-antrun-plugin</artifactId>
35+
<executions>
36+
<execution>
37+
<phase>package</phase>
38+
<goals>
39+
<goal>run</goal>
40+
</goals>
41+
</execution>
42+
</executions>
43+
</plugin>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-assembly-plugin</artifactId>
47+
<version>2.3</version>
48+
<executions>
49+
<execution>
50+
<id>dist</id>
51+
<phase>package</phase>
52+
<goals>
53+
<goal>single</goal>
54+
</goals>
55+
<configuration>
56+
<skipAssembly>false</skipAssembly>
57+
<finalName>wedatasphere-streamis-${streamis.version}-dist</finalName>
58+
<appendAssemblyId>false</appendAssemblyId>
59+
<attach>false</attach>
60+
<descriptors>
61+
<descriptor>src/main/assembly/assembly.xml</descriptor>
62+
</descriptors>
63+
</configuration>
64+
</execution>
65+
</executions>
66+
</plugin>
67+
</plugins>
68+
</build>
69+
70+
</project>

Diff for: assembly/src/main/assembly/assembly.xml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!--
2+
~ Copyright 2021 WeBank
3+
~ Licensed under the Apache License, Version 2.0 (the "License");
4+
~ you may not use this file except in compliance with the License.
5+
~ You may obtain a copy of the License at
6+
~
7+
~ http://www.apache.org/licenses/LICENSE-2.0
8+
~
9+
~ Unless required by applicable law or agreed to in writing, software
10+
~ distributed under the License is distributed on an "AS IS" BASIS,
11+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
~ See the License for the specific language governing permissions and
13+
~ limitations under the License.
14+
-->
15+
16+
<assembly>
17+
<id>dist</id>
18+
<formats>
19+
<format>tar.gz</format>
20+
</formats>
21+
<includeBaseDirectory>false</includeBaseDirectory>
22+
23+
24+
25+
<fileSets>
26+
27+
<fileSet>
28+
<directory>${project.parent.basedir}</directory>
29+
<outputDirectory>.</outputDirectory>
30+
<includes>
31+
<include>README*</include>
32+
<include>LICENSE*</include>
33+
<include>NOTICE*</include>
34+
</includes>
35+
</fileSet>
36+
37+
<fileSet>
38+
<directory>
39+
${project.parent.basedir}/conf/
40+
</directory>
41+
<outputDirectory>conf</outputDirectory>
42+
<includes>
43+
<include>**/*</include>
44+
</includes>
45+
<lineEnding>unix</lineEnding>
46+
</fileSet>
47+
48+
<fileSet>
49+
<directory>
50+
${project.parent.basedir}/bin/
51+
</directory>
52+
<outputDirectory>bin</outputDirectory>
53+
<includes>
54+
<include>**/*</include>
55+
</includes>
56+
<lineEnding>unix</lineEnding>
57+
</fileSet>
58+
59+
<fileSet>
60+
<directory>
61+
${project.parent.basedir}/db/
62+
</directory>
63+
<outputDirectory>db</outputDirectory>
64+
<includes>
65+
<include>**/*</include>
66+
</includes>
67+
</fileSet>
68+
69+
<fileSet>
70+
<directory>
71+
${project.parent.basedir}/streamis-server/target/
72+
</directory>
73+
<outputDirectory>./share/streamis-server/</outputDirectory>
74+
<includes>
75+
<include>**/*.zip</include>
76+
</includes>
77+
</fileSet>
78+
79+
</fileSets>
80+
</assembly>

Diff for: bin/install.sh

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#!/bin/sh
2+
#Actively load user env
3+
if [ -f "~/.bashrc" ];then
4+
echo "Warning! user bashrc file does not exist."
5+
else
6+
source ~/.bashrc
7+
fi
8+
9+
shellDir=`dirname $0`
10+
workDir=`cd ${shellDir}/..;pwd`
11+
12+
SERVER_IP=""
13+
SERVER_HOME=""
14+
15+
local_host="`hostname --fqdn`"
16+
LOCAL_IP="`ifconfig | grep 'inet' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}'`"
17+
18+
#To be compatible with MacOS and Linux
19+
txt=""
20+
if [[ "$OSTYPE" == "darwin"* ]]; then
21+
txt="''"
22+
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
23+
# linux
24+
txt=""
25+
elif [[ "$OSTYPE" == "cygwin" ]]; then
26+
echo "streamis not support Windows operating system"
27+
exit 1
28+
elif [[ "$OSTYPE" == "msys" ]]; then
29+
echo "streamis not support Windows operating system"
30+
exit 1
31+
elif [[ "$OSTYPE" == "win32" ]]; then
32+
echo "streamis not support Windows operating system"
33+
exit 1
34+
elif [[ "$OSTYPE" == "freebsd"* ]]; then
35+
txt=""
36+
else
37+
echo "Operating system unknown, please tell us(submit issue) for better service"
38+
exit 1
39+
fi
40+
41+
function isSuccess(){
42+
if [ $? -ne 0 ]; then
43+
echo "Failed to " + $1
44+
exit 1
45+
else
46+
echo "Succeed to" + $1
47+
fi
48+
}
49+
50+
function checkJava(){
51+
java -version
52+
isSuccess "execute java --version"
53+
}
54+
55+
56+
##install env:expect,
57+
sudo yum install -y expect
58+
isSuccess "install expect"
59+
60+
##install env:telnet,
61+
sudo yum install -y telnet
62+
isSuccess "install telnet"
63+
64+
##load config
65+
echo "step1:load config"
66+
source ${workDir}/conf/config.sh
67+
source ${workDir}/conf/db.sh
68+
isSuccess "load config"
69+
70+
local_host="`hostname --fqdn`"
71+
72+
73+
##env check
74+
echo "Do you want to clear Streamis table information in the database?"
75+
echo " 1: Do not execute table-building statements"
76+
echo " 2: Dangerous! Clear all data and rebuild the tables."
77+
echo ""
78+
79+
MYSQL_INSTALL_MODE=1
80+
81+
read -p "Please input the choice:" idx
82+
if [[ '2' = "$idx" ]];then
83+
MYSQL_INSTALL_MODE=2
84+
echo "You chose Rebuild the table"
85+
elif [[ '1' = "$idx" ]];then
86+
MYSQL_INSTALL_MODE=1
87+
echo "You chose not execute table-building statements"
88+
else
89+
echo "no choice,exit!"
90+
exit 1
91+
fi
92+
93+
##init db
94+
if [[ '2' = "$MYSQL_INSTALL_MODE" ]];then
95+
mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/streamis_ddl.sql"
96+
isSuccess "source streamis_ddl.sql"
97+
mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/streamis_dml.sql"
98+
isSuccess "source streamis_dml.sql"
99+
echo "Rebuild the table"
100+
fi
101+
102+
103+
104+
###linkis Eurkea info
105+
SERVER_IP=$EUREKA_INSTALL_IP
106+
SERVER_PORT=$EUREKA_PORT
107+
SERVER_HOME=$STREAMIS_INSTALL_HOME
108+
109+
if test -z "$SERVER_IP"
110+
then
111+
SERVER_IP=$local_host
112+
fi
113+
EUREKA_URL=http://$SERVER_IP:$EUREKA_PORT/eureka/
114+
115+
##function start
116+
function installPackage(){
117+
echo "start to install $SERVERNAME"
118+
echo "$SERVERNAME-step1: create dir"
119+
if test -z "$SERVER_IP"
120+
then
121+
SERVER_IP=$local_host
122+
fi
123+
124+
if ! ssh -p $SSH_PORT $SERVER_IP test -e $SERVER_HOME; then
125+
ssh -p $SSH_PORT $SERVER_IP "sudo mkdir -p $SERVER_HOME;sudo chown -R $deployUser:$deployUser $SERVER_HOME"
126+
isSuccess "create the dir of $SERVERNAME"
127+
fi
128+
129+
echo "$SERVERNAME-step2:copy install package"
130+
scp -P $SSH_PORT ${workDir}/share/$PACKAGE_DIR/$SERVERNAME.zip $SERVER_IP:$SERVER_HOME
131+
isSuccess "copy ${SERVERNAME}.zip"
132+
ssh -p $SSH_PORT $SERVER_IP "cd $SERVER_HOME/;rm -rf $SERVERNAME-bak; mv -f $SERVERNAME $SERVERNAME-bak"
133+
ssh -p $SSH_PORT $SERVER_IP "cd $SERVER_HOME/;unzip $SERVERNAME.zip > /dev/null"
134+
isSuccess "unzip ${SERVERNAME}.zip"
135+
136+
echo "$SERVERNAME-step3:subsitution conf"
137+
SERVER_CONF_PATH=$SERVER_HOME/$SERVERNAME/conf/application.yml
138+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#port:.*#port: $SERVER_PORT#g\" $SERVER_CONF_PATH"
139+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#defaultZone:.*#defaultZone: $EUREKA_URL#g\" $SERVER_CONF_PATH"
140+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#hostname:.*#hostname: $SERVER_IP#g\" $SERVER_CONF_PATH"
141+
isSuccess "subsitution conf of $SERVERNAME"
142+
}
143+
##function end
144+
145+
146+
147+
##Streamis-Server Install
148+
PACKAGE_DIR=streamis-server
149+
SERVERNAME=streamis-server
150+
SERVER_IP=$STREAMIS_SERVER_INSTALL_IP
151+
SERVER_PORT=$STREAMIS_SERVER_INSTALL_PORT
152+
SERVER_HOME=$STREAMIS_INSTALL_HOME
153+
###install Streamis-Server
154+
installPackage
155+
###update Streamis-Server linkis.properties
156+
echo "$SERVERNAME-step4:update linkis.properties"
157+
SERVER_CONF_PATH=$SERVER_HOME/$SERVERNAME/conf/linkis.properties
158+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#wds.linkis.server.mybatis.datasource.url.*#wds.linkis.server.mybatis.datasource.url=jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DB}?characterEncoding=UTF-8#g\" $SERVER_CONF_PATH"
159+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#wds.linkis.server.mybatis.datasource.username.*#wds.linkis.server.mybatis.datasource.username=$MYSQL_USER#g\" $SERVER_CONF_PATH"
160+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#wds.linkis.server.mybatis.datasource.password.*#wds.linkis.server.mybatis.datasource.password=$MYSQL_PASSWORD#g\" $SERVER_CONF_PATH"
161+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#wds.linkis.gateway.ip.*#wds.linkis.gateway.ip=$GATEWAY_INSTALL_IP#g\" $SERVER_CONF_PATH"
162+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#wds.linkis.gateway.port.*#wds.linkis.gateway.port=$GATEWAY_PORT#g\" $SERVER_CONF_PATH"
163+
ssh -p $SSH_PORT $SERVER_IP "sed -i \"s#wds.linkis.gateway.url.*#wds.linkis.gateway.url=http://${GATEWAY_INSTALL_IP}:${GATEWAY_PORT}#g\" $SERVER_CONF_PATH"
164+
isSuccess "subsitution linkis.properties of $SERVERNAME"
165+
echo "<----------------$SERVERNAME:end------------------->"
166+
echo ""
167+
168+

0 commit comments

Comments
 (0)