Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 072727c

Browse files
[feat][*][v0.2.1] release v0.2.1 (#16)
* [feat][scripts][0.2.1] improvement for the start scripts * [doc][*][0.2.1] update description about start.sh into README * [fix][*][0.2.1] wrong default for `HOST_IP` in cli start.sh * [refactor][*][0.2.1] add `WorkingDirectory` to `plugin-server.service` * [fix][*][v0.2.1] downgrade fastjson version to `1.2.83_noneautotype` * [feat][*][v0.2.1]: add txHash to ProvableLedgerData [refactor][*][v0.2.1] update version to `v0.2.1` --------- Co-authored-by: dawn-to-dusk <[email protected]>
1 parent c6acccc commit 072727c

File tree

17 files changed

+309
-43
lines changed

17 files changed

+309
-43
lines changed

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,17 @@ tree .
6666
├── README.md
6767
├── bin
6868
│   ├── init_tls_certs.sh
69+
│   ├── plugin-server.service
6970
│   ├── print.sh
7071
│   ├── start.sh
7172
│   └── stop.sh
7273
├── config
7374
│   └── application.yml
7475
└── lib
75-
   └── ps-bootstrap-x.x.x.jar
76+
└── ps-bootstrap-x.x.x.jar
7677
7778
78-
3 directories, 7 files
79+
3 directories, 8 files
7980
```
8081

8182
首先,初始化PS的TLS秘钥和证书,该脚本将会在项目根目录下创建文件夹`certs`,下面存储了私钥`server.key`、证书`server.crt`、信任的证书`trust.crt`
@@ -124,6 +125,59 @@ pluginserver:
124125

125126
## 运行
126127

128+
### 作为系统服务运行
129+
130+
在解压包根目录之下,可以找到`start.sh`脚本。
131+
132+
如下可以打印帮助信息:
133+
134+
```
135+
./bin/start.sh -h
136+
137+
start.sh — Start the plugin server
138+
139+
Usage:
140+
start.sh <params>
141+
142+
Examples:
143+
1. start in system service mode:
144+
start.sh -s
145+
2. start in application mode:
146+
start.sh
147+
148+
Options:
149+
-s run in system service mode.
150+
-h print help information.
151+
```
152+
153+
运行如下命令,会自动将插件服务启动为系统服务:
154+
155+
```
156+
./bin/start.sh -s
157+
```
158+
159+
看到下面的输出即启动成功:
160+
161+
```
162+
___ __ ______ __ _ ____ _ __
163+
/ | ____ / /_ / ____// /_ ____ _ (_)____ / __ ) _____ (_)____/ /____ _ ___
164+
/ /| | / __ \ / __// / / __ \ / __ `// // __ \ / __ |/ ___// // __ // __ `// _ \
165+
/ ___ | / / / // /_ / /___ / / / // /_/ // // / / / / /_/ // / / // /_/ // /_/ // __/
166+
/_/ |_|/_/ /_/ \__/ \____//_/ /_/ \__,_//_//_/ /_/ /_____//_/ /_/ \__,_/ \__, / \___/
167+
/____/
168+
169+
[ INFO ]_[ 2023-06-20 20:57:06.168 ] : running in system service mode
170+
[ INFO ]_[ 2023-06-20 20:57:06.168 ] : plugin-server started successfully
171+
```
172+
173+
可以通过下面命令查看系统服务状态:
174+
175+
```
176+
systemctl status plugin-server.service
177+
```
178+
179+
### 作为普通进程运行
180+
127181
在解压包根目录之下,运行一下命令即可:
128182
129183
```

pom.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,37 @@
1919

2020
<properties>
2121
<java.version>8</java.version>
22-
<pluginserver.version>0.2.0</pluginserver.version>
22+
<pluginserver.version>0.2.1</pluginserver.version>
2323
<grpc-starter.version>2.13.1.RELEASE</grpc-starter.version>
2424
<netty-tcnative-boringssl-static.version>2.0.59.Final</netty-tcnative-boringssl-static.version>
2525
<protobuf.version>3.19.1</protobuf.version>
2626
<protobuf-plugin.version>0.6.1</protobuf-plugin.version>
2727
<grpc.version>1.42.2</grpc.version>
2828
<jakarta.annotation-api.version>1.3.5</jakarta.annotation-api.version>
2929
<junit.version>4.13.2</junit.version>
30-
<antchain-bridge.sdk.version>0.1.1</antchain-bridge.sdk.version>
30+
<antchain-bridge.sdk.version>0.1.2</antchain-bridge.sdk.version>
3131
<jline.version>3.3.0</jline.version>
3232
<groovy.version>3.0.17</groovy.version>
3333
<commons-cli.version>1.5.0</commons-cli.version>
3434
<hutool.version>5.8.10</hutool.version>
35-
<fastjson.version>2.0.21</fastjson.version>
35+
<fastjson.version>1.2.83_noneautotype</fastjson.version>
3636
<pf4j.version>3.8.0</pf4j.version>
3737
<slf4j.version>1.7.28</slf4j.version>
3838
</properties>
3939

40+
<repositories>
41+
<repository>
42+
<id>github</id>
43+
<url>https://maven.pkg.github.com/AntChainOpenLab/*</url>
44+
<snapshots>
45+
<enabled>true</enabled>
46+
</snapshots>
47+
</repository>
48+
</repositories>
49+
4050
<groupId>com.alipay.antchain.bridge</groupId>
4151
<artifactId>antchain-bridge-pluginserver</artifactId>
42-
<version>0.2.0</version>
52+
<version>0.2.1</version>
4353

4454
<name>antchain-bridge-pluginserver</name>
4555
<description>antchain-bridge-pluginserver</description>

ps-bootstrap/desc_tar.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<outputDirectory>${file.separator}bin</outputDirectory>
2020
<includes>
2121
<include>*.sh</include>
22+
<include>plugin-server.service</include>
2223
</includes>
2324
</fileSet>
2425
<fileSet>

ps-bootstrap/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.alipay.antchain.bridge</groupId>
88
<artifactId>antchain-bridge-pluginserver</artifactId>
9-
<version>0.2.0</version>
9+
<version>0.2.1</version>
1010
</parent>
1111

1212
<artifactId>ps-bootstrap</artifactId>
@@ -35,6 +35,7 @@
3535
<includes>
3636
<include>**/application.yml</include>
3737
<include>**/*.xml</include>
38+
<include>**/banner.txt</include>
3839
</includes>
3940
<!-- 是否替换@xx@表示的maven properties属性值 -->
4041
<filtering>true</filtering>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
${AnsiColor.BLUE}${AnsiStyle.BOLD}
2+
___ __ ______ __ _ ____ _ __
3+
/ | ____ / /_ / ____// /_ ____ _ (_)____ / __ ) _____ (_)____/ /____ _ ___
4+
/ /| | / __ \ / __// / / __ \ / __ `// // __ \ / __ |/ ___// // __ // __ `// _ \
5+
/ ___ | / / / // /_ / /___ / / / // /_/ // // / / / / /_/ // / / // /_/ // /_/ // __/
6+
/_/ |_|/_/ /_/ \__/ \____//_/ /_/ \__,_//_//_/ /_/ /_____//_/ /_/ \__,_/ \__, / \___/
7+
/____/
8+
plugin-server @project.version@

ps-bootstrap/src/main/resources/scripts/init_tls_certs.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/bin/bash
22

3+
#
4+
# Copyright 2023 Ant Group
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
CURR_DIR="$(cd `dirname $0`; pwd)"
420
source ${CURR_DIR}/print.sh
521

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright 2023 Ant Group
3+
#
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+
[Unit]
18+
Description=start shell script
19+
StartLimitIntervalSec=0
20+
21+
[Service]
22+
ExecStart=@@START_CMD@@
23+
Restart=always
24+
RestartSec=5
25+
WorkingDirectory=@@WORKING_DIR@@
26+
27+
[Install]
28+
WantedBy=multi-user.target

ps-bootstrap/src/main/resources/scripts/print.sh

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
#
2+
# Copyright 2023 Ant Group
3+
#
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+
117
RED='\033[0;31m'
218
GREEN='\033[0;32m'
319
BLUE='\033[0;34m'
@@ -23,26 +39,26 @@ function print_hint() {
2339
}
2440

2541
function log_info() {
26-
NOW=`date "+%Y-%m-%d %H:%M:%S.%s" | cut -b 1-23`
27-
INFO_PREFIX=`printf "${GREEN}\033[4m[ INFO ]${NC}"`
42+
NOW=$(date "+%Y-%m-%d %H:%M:%S.%s" | cut -b 1-23)
43+
INFO_PREFIX=$(printf "${GREEN}\033[4m[ INFO ]${NC}")
2844

29-
INFO=`printf "_${LIGHT_GRAY}[ %s ]${NC} : %s" "${NOW}" "$1"`
45+
INFO=$(printf "_${LIGHT_GRAY}[ %s ]${NC} : %s" "${NOW}" "$1")
3046
echo "${INFO_PREFIX}${INFO}"
3147
}
3248

3349
function log_warn() {
34-
NOW=`date "+%Y-%m-%d %H:%M:%S.%s" | cut -b 1-23`
35-
WARN_PREFIX=`printf "${YELLOW}\033[4m[ WARN ]${NC}"`
50+
NOW=$(date "+%Y-%m-%d %H:%M:%S.%s" | cut -b 1-23)
51+
WARN_PREFIX=$(printf "${YELLOW}\033[4m[ WARN ]${NC}")
3652

37-
INFO=`printf "_${LIGHT_GRAY}[ %s ]${NC} : %s" "${NOW}" "$1"`
53+
INFO=$(printf "_${LIGHT_GRAY}[ %s ]${NC} : %s" "${NOW}" "$1")
3854
echo "${WARN_PREFIX}${INFO}"
3955
}
4056

4157
function log_error() {
42-
NOW=`date "+%Y-%m-%d %H:%M:%S.%s" | cut -b 1-23`
43-
ERROR_PREFIX=`printf "${RED}\033[4m[ ERROR ]${NC}"`
58+
NOW=$(date "+%Y-%m-%d %H:%M:%S.%s" | cut -b 1-23)
59+
ERROR_PREFIX=$(printf "${RED}\033[4m[ ERROR ]${NC}")
4460

45-
INFO=`printf "_${LIGHT_GRAY}[ %s ]${NC} : %s" "${NOW}" "$1"`
61+
INFO=$(printf "_${LIGHT_GRAY}[ %s ]${NC} : %s" "${NOW}" "$1")
4662
echo "${ERROR_PREFIX}${INFO}"
4763
}
4864

@@ -54,4 +70,4 @@ function print_title() {
5470
echo '/_/ |_|/_/ /_/ \__/ \____//_/ /_/ \__,_//_//_/ /_/ /_____//_/ /_/ \__,_/ \__, / \___/'
5571
echo ' /____/ '
5672
echo
57-
}
73+
}

0 commit comments

Comments
 (0)