Skip to content

Commit 3b7639d

Browse files
author
Wu Wenxiang
authored
chore: installation scripts (#16)
1. remove 1.0.126 version from markdown guide 2. add environment variables support in installation scripts 3. mariadb1 -> mariadb 4. add set -e in installation scripts cherry pick from: #11
1 parent 63d7470 commit 3b7639d

9 files changed

+55
-50
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ application scenarios, enabling autonomous driving and autonomous transportation
3535

3636
![](src/images/v2x-arch-details.svg)
3737

38-
- [OpenV2X 1.0.126 Architectural Design](src/v2x-1.0.126-architectural-design.md)
38+
- [OpenV2X Architectural Design](src/v2x-architectural-design.md)
3939

4040
## Quick Install
4141

42-
- [OpenV2X 1.0.126 QuickInstall Guide](src/v2x-1.0.126-quick-install.md)
42+
- [OpenV2X QuickInstall Guide](src/v2x-quick-install.md)
4343

4444
## Quick Start
4545

46-
- [OpenV2X 1.0.126 QuickStart Guide](src/v2x-1.0.126-quick-start.md)
46+
- [OpenV2X QuickStart Guide](src/v2x-quick-start.md)
4747

4848
## Documents
4949

50-
- [OpenV2X 1.0.126 Algorithm Documents](src/v2x-1.0.126-algorithm.md)
50+
- [OpenV2X Algorithm Documents](src/v2x-algorithm.md)
5151

5252
## Contributing
5353

src/deploy/docker-compose-pre.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '2.4'
22
services:
33
mariadb:
44
image: 'mariadb:10.5.5'
5-
container_name: 'mariadb1'
5+
container_name: 'mariadb'
66
restart: 'always'
77
environment:
88
MYSQL_USER: 'dandelion'

src/install.sh

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,88 @@
11
#!/bin/sh
2-
# set -e # TODO
2+
set -e
33

4-
unalias cp 2>/dev/null
4+
unalias cp 2>/dev/null || true
55
alias docker-compose='docker compose'
66

7-
set_password() {
8-
read -p "Enter your openv2x external ip: " ip
9-
read -p "Enter your redis root password (do not include @): " redis_root
10-
read -p "Enter your mariadb1 root password (do not include @): " mariadb1_root # TODO add url encode
11-
read -p "Enter your mariadb1 dandelion password (do not include @): " mariadb1_dandelion
12-
read -p "Enter your emqx root password (do not include @): " emqx_root
7+
set_env() {
8+
[[ ! -n "$external_ip" ]] && read -p "Enter your openv2x external ip: " external_ip
9+
[[ ! -n "$redis_root" ]] && read -p "Enter your redis root password (do not include @): " redis_root
10+
[[ ! -n "$mariadb_root" ]] && read -p "Enter your mariadb root password (do not include @): " mariadb_root # TODO add url encode
11+
[[ ! -n "$mariadb_dandelion" ]] && read -p "Enter your mariadb dandelion password (do not include @): " mariadb_dandelion
12+
[[ ! -n "$emqx_root" ]] && read -p "Enter your emqx root password (do not include @): " emqx_root
13+
14+
echo "export external_ip=$external_ip"
15+
echo "export redis_root=$redis_root"
16+
echo "export mariadb_root=$mariadb_root"
17+
echo "export mariadb_dandelion=$mariadb_dandelion"
18+
echo "export emqx_root=$emqx_root"
1319
}
1420

1521
verify_input() {
16-
if [ ! -n "$ip" ] ;then
22+
if [[ ! -n "$external_ip" ]] ;then
1723
echo "you have not input openv2x external ip!"
1824
exit 1
1925
fi
20-
if [ ! -n "$redis_root" ] ;then
26+
if [[ ! -n "$redis_root" ]] ;then
2127
echo "you have not input redis root password!"
2228
exit 1
2329
fi
24-
if [ ! -n "$mariadb1_root" ] ;then
25-
echo "you have not input mariadb1 root password!"
30+
if [[ ! -n "$mariadb_root" ]] ;then
31+
echo "you have not input mariadb root password!"
2632
exit 1
2733
fi
28-
if [ ! -n "$mariadb1_dandelion" ] ;then
29-
echo "you have not input mariadb1 dandelion password!"
34+
if [[ ! -n "$mariadb_dandelion" ]] ;then
35+
echo "you have not input mariadb dandelion password!"
3036
exit 1
3137
fi
32-
if [ ! -n "$emqx_root" ] ;then
38+
if [[ ! -n "$emqx_root" ]] ;then
3339
echo "you have not input emqx root password!"
3440
exit 1
3541
fi
36-
3742
}
3843

3944
verify_uninstall() {
40-
containers=(redis emqx mariadb1 dandelion edgeview centerview cerebrum rse-simulator)
45+
containers=(redis emqx mariadb dandelion edgeview centerview cerebrum rse-simulator)
4146
for i in ${containers[@]}; do
4247
docker stop $i 2>/dev/null || true
4348
docker rm $i 2>/dev/null || true
4449
done
4550
}
4651

47-
set_env() {
52+
pre_install() {
4853
mkdir -pv /tmp/pre
4954
mkdir -pv /tmp/init
5055
mkdir -pv /tmp/service
5156
cp -f deploy/docker-compose-pre.yaml /tmp/pre/docker-compose-pre.yaml
5257
cp -f deploy/docker-compose-init.yaml /tmp/init/docker-compose-init.yaml
5358
cp -f deploy/docker-compose-service.yaml /tmp/service/docker-compose-service.yaml
54-
sed -i "s/127.0.0.1/$ip/" /tmp/service/docker-compose-service.yaml
59+
sed -i "s/127.0.0.1/$external_ip/" /tmp/service/docker-compose-service.yaml
5560
sed -i "s/redis12345/$redis_root/" /tmp/pre/docker-compose-pre.yaml
56-
sed -i "s/mysql@1234/$mariadb1_root/" /tmp/pre/docker-compose-pre.yaml
57-
sed -i "s/dandelion123/$mariadb1_dandelion/" /tmp/pre/docker-compose-pre.yaml
61+
sed -i "s/mysql@1234/$mariadb_root/" /tmp/pre/docker-compose-pre.yaml
62+
sed -i "s/dandelion123/$mariadb_dandelion/" /tmp/pre/docker-compose-pre.yaml
5863
sed -i "s/abc@1234/$emqx_root/" /tmp/pre/docker-compose-pre.yaml
5964
sed -i "s/abc@1234/$emqx_root/" /tmp/service/docker-compose-service.yaml
60-
sed -i "s/mysql@1234/$mariadb1_root/" /tmp/service/docker-compose-service.yaml
65+
sed -i "s/mysql@1234/$mariadb_root/" /tmp/service/docker-compose-service.yaml
6166
sed -i "s/redis12345/$redis_root/" /tmp/service/docker-compose-service.yaml
6267
cp -rf deploy/edgeview /etc/
6368
cp -rf deploy/centerview /etc/
6469
cp -rf deploy/dandelion /etc/
6570
sed -i "s/redis12345/$redis_root/" /etc/dandelion/dandelion.conf
66-
sed -i "s/dandelion123/$mariadb1_dandelion/" /etc/dandelion/dandelion.conf
71+
sed -i "s/dandelion123/$mariadb_dandelion/" /etc/dandelion/dandelion.conf
6772
sed -i "s/abc@1234/$emqx_root/" /etc/dandelion/dandelion.conf
6873
rm -rf /var/log/dandelion && mkdir -p /var/log/dandelion
6974
rm -rf /data && mkdir -pv /data
7075
cp -rf deploy/mysql /data/
71-
sed -i "s/dandelion123/$mariadb1_dandelion/" /data/mysql/init/init.sql
76+
sed -i "s/dandelion123/$mariadb_dandelion/" /data/mysql/init/init.sql
7277
touch /var/log/dandelion/dandelion.log
7378
}
7479

7580
verify_mysql(){
7681
while true
7782
do
78-
databases=`docker exec mariadb1 mysql -uroot -p$mariadb1_root -e 'show databases;' 2>/dev/null`
83+
databases=`docker exec mariadb mysql -uroot -p$mariadb_root -e 'show databases;' 2>/dev/null || true`
7984
target="dandelion"
80-
result=$(echo $databases | grep "${target}")
85+
result=$(echo $databases | grep "${target}" || true)
8186
if [[ "$result" != "" ]]
8287
then
8388
break
@@ -92,7 +97,7 @@ verify_bootstrap(){
9297
do
9398
info=`docker ps -a | grep dandelion_bootstrap 2>/dev/null`
9499
status="Exited (0)"
95-
result=$(echo $info | grep "${status}")
100+
result=$(echo $info | grep "${status}" || true)
96101
if [[ "$result" != "" ]]
97102
then
98103
break
@@ -125,8 +130,8 @@ verify_install() {
125130
repository: https://github.com/open-v2x
126131
portal: https://openv2x.org
127132
128-
OpenV2X Edge Portal (Edgeview): http://$ip
129-
OpenV2X Central Portal (Centerview): http://$ip:8080
133+
OpenV2X Edge Portal (Edgeview): http://$external_ip
134+
OpenV2X Central Portal (Centerview): http://$external_ip:8080
130135
131136
username: admin
132137
password: dandelion
@@ -135,9 +140,9 @@ verify_install() {
135140
}
136141

137142
{
138-
set_password
143+
set_env
139144
verify_input
140145
verify_uninstall
141-
set_env
146+
pre_install
142147
verify_install
143148
}

src/v2x-1.0.126-algorithm.md renamed to src/v2x-algorithm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# V2X 算法文档
1+
# OpenV2X 算法文档
22

33
## 1.算法架构
44

src/v2x-1.0.126-architectural-design.md renamed to src/v2x-architectural-design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 架构设计文档
1+
# OpenV2X 架构设计文档
22

33
## 1. 设计架构图
44

src/v2x-1.0.126-quick-install.md renamed to src/v2x-quick-install.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# V2X 1.0.126 All in One 部署文档
1+
# OpenV2X All-in-One 部署文档
22

33
## 1. 基本环境
44

@@ -61,19 +61,19 @@ cd docs-albany/src/
6161
## 5. 一键部署服务
6262

6363
```shell
64+
export external_ip=100.100.100.100
65+
# 这里的外部 IP 地址要确保客户端可以访问,用于后续 centerview 和 edgeview portal 访问
66+
export redis_root=password
67+
export mariadb_root=password
68+
export mariadb_dandelion=password
69+
export emqx_root=password
6470
sh ./install.sh
6571
```
6672

6773
安装效果如下:
6874

6975
```console
7076
[root@v2x-demo src]# sh ./install.sh
71-
Enter your openv2x external ip: 100.100.100.100
72-
这里的外部 IP 地址要确保客户端可以访问,用于后续 centerview 和 edgeview portal 访问
73-
Enter your redis root password (do not include @): password
74-
Enter your mariadb1 root password (do not include @): password
75-
Enter your mariadb1 dandelion password (do not include @): password
76-
Enter your emqx root password (do not include @): password
7777

7878
...
7979

@@ -96,7 +96,7 @@ Enter your emqx root password (do not include @): password
9696

9797
上述提示中包含了 Edge Portal 和 Central Portal 的访问路径,以及用户名密码。此时可以从客户端,通过 Chrome 浏览器(其它浏览器未测试)访问试用。
9898

99-
欢迎试用~,参考:[快速入门](v2x-1.0.126-quick-start.md)
99+
欢迎试用~,参考:[快速入门](v2x-quick-start.md)
100100

101101
如果遇到问题,欢迎在 github 提交
102102
issue:<https://github.com/open-v2x/docs/issues/new/choose>,参考:[提交注意事项](v2x_contribution-zh_CN.md)
File renamed without changes.

src/v2x_contribution-zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ request** 按钮并按照模板要求填写必要的信息 ![](images/issues_but
4545

4646
### 开始之前
4747

48-
查看[OpenV2X 架构设计文档](v2x-1.0.126-architectural-design.md),了解组成 OpenV2X
48+
查看[OpenV2X 架构设计文档](v2x-architectural-design.md),了解组成 OpenV2X
4949
的不同模块。选择最合适的一个来加入新功能。如果在此过程中出现任何问题,请随时与我们的团队联系。
5050

5151
### 代码规范

src/v2x_contribution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ with the original repository.
5858

5959
### Before getting started
6060

61-
Check out the [OpenV2X Architectural Design document](v2x-1.0.126-architectural-design.md) to get an
62-
idea on the different modules that compose OpenV2X. Choose the most appropriate one to hold the new
63-
feature. Feel free to contact the team in case any doubt arises during the process.
61+
Check out the [OpenV2X Architectural Design document](v2x-architectural-design.md) to get an idea on
62+
the different modules that compose OpenV2X. Choose the most appropriate one to hold the new feature.
63+
Feel free to contact the team in case any doubt arises during the process.
6464

6565
### Coding standard
6666

0 commit comments

Comments
 (0)