apollo部署

1.下载工程包

进入apollo仓库[https://github.com/ctripcorp/apollo.git]下载最新版本代码;
apollo-adminservice-1.4.0-github.zip
apollo-configservice-1.4.0-github.zip
apollo-portal-1.4.0-github.zip

这三个项目含义如下:

项目 备注
apollo-adminservice 提供配置管理接口,提供配置修改、发布等接口,接口服务对象为Portal,以及Eureka
apollo-configservice 提供配置获取接口,提供配置更新推送接口,接口服务对象为Apollo客户端
apollo-portal 提供Web界面供用户管理配置

2.解压工程

在自己的服务器上新建一个目录 /usr/local/nlp/apollo/ 将官方提供的安装包直接下载到这个目录下,然后解压:

unzip apollo-adminservice-1.4.0-github.zip -d apollo-adminservice-1.4.0-github
unzip apollo-configservice-1.4.0-github.zip -d apollo-configservice-1.4.0-github
unzip apollo-portal-1.4.0-github.zip -d apollo-portal-1.4.0-github

3.apollo-configservice-1.4.0-github配置文件修改

修改apollo-configservice-1.4.0-github/config/application-github.properties文件

# DataSource
spring.datasource.url = jdbc:mysql://10.xxx.xx.57:8106/ApolloConfigDB?characterEncoding=utf8
spring.datasource.username = wxt_apollo
spring.datasource.password = wxt2016

4.apollo-adminservice-1.4.0-github配置文件修改

修改apollo-adminservice-1.4.0-github/config/application-github.properties文件

# DataSource
spring.datasource.url = jdbc:mysql://10.xxx.xx.57:8106/ApolloConfigDB?characterEncoding=utf8
spring.datasource.username = wxt_apollo
spring.datasource.password = wxt2016

5.apollo-portal-1.4.0-github配置文件修改

修改apollo-portal-1.4.0-github/config/application-github.properties文件,portal 使用的是 ApolloPortalDB。

# DataSource
spring.datasource.url = jdbc:mysql://10.168.14.57:8106/ApolloPortalDB?characterEncoding=utf8
spring.datasource.username = wxt_apollo
spring.datasource.password = wxt2016

修改apollo-portal-1.4.0-github/config/apollo-env.properties文件

local.meta=http://localhost:8080
dev.meta=http://fill-in-dev-meta-server:8080
fat.meta=http://fill-in-fat-meta-server:8080
uat.meta=http://fill-in-uat-meta-server:8080
lpt.meta=${lpt_meta}
pro.meta=http://fill-in-pro-meta-server:8080

修改 meta service 信息,Apollo Portal 需要在不同的环境访问不同的 meta service(apollo-configservice) 地址,所以我们需要在配置中提供这些信息。默认情况下,meta service 和 config service 是部署在同一个 JVM进程,所以 meta service 的地址就是 config service 的地址
需要修改apollo-portal的端口。直接修改startup.sh中的SERVER_PORT即可,如SERVER_PORT=8070。

6.启动项目

在每一个工程的解压包中,都有一个 scripts 文件夹,这里面是 Apollo 工程的启动脚本。三个工程分别先后启动:apollo-configservice、apollo-adminservice、apollo-portal,就是分别执行这三个工程下面的 /scripts/startup.sh 脚本即可,关闭执行的是 /scripts/shutdown.sh 脚本。

7.正式场apollo打包及部署

#dev 环境
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=jdbc:mysql://10.xxx.xx.25:3519/apollo_configdb_dev?characterEncoding=utf8 -Dspring_datasource_username=yrz_apollo -Dspring_datasource_password=wxt2016
#uat环境
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=jdbc:mysql://10.xxx.xx.25:3519/apollo_configdb_uat?characterEncoding=utf8 -Dspring_datasource_username=wxt_apollo -Dspring_datasource_password=wxt2016
#sit环境
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=jdbc:mysql://10.xxx.xx.25:3519/apollo_configdb_sit?characterEncoding=utf8 -Dspring_datasource_username=wxt_apollo -Dspring_datasource_password=wxt2016
#pro环境
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=jdbc:mysql://10.xxx.xx.25:3519/apollo_configdb_pro?characterEncoding=utf8 -Dspring_datasource_username=wxt_apollo -Dspring_datasource_password=wxt2016
#portal
mvn clean package -DskipTests -pl apollo-portal -am -Dapollo_profile=github,auth -Dspring_datasource_url=jdbc:mysql://10..xxx.xx.25:3519/apollo_portaldb?characterEncoding=utf8 -Dspring_datasource_username=wxt_apollo -Dspring_datasource_password=wxt2016 -Ddev_meta=http://10.180.14.127:8080 -Dsit_meta=http://10..xxx.xx.129:8080 -Duat_meta=http://10..xxx.xx.128:8080 -Dpro_meta=http://10..xxx.xx.130:8080

正式环境通过apollo1.4.0源码,修改了部分配置:
1.新增了sit环境。具体参考:https://blog.csdn.net/qq_15070281/article/details/83583402
2.修改了log文件路径,具体修改startup.sh文件。
3.打包完成后unzip解压修改config下的apollo-env.properties,添加对应环境[sit]。
4.修改数据库表ServerConfig,apollo.portal.envs添加值:dev,uat,sit,pro
4.apollo安装视频教程:https://pan.baidu.com/s/1rUAphfVq9fnEMqRrscDk-w#list/path=%2F%E5%88%B6%E4%BD%9C%E8%A7%86%E9%A2%91%2Fapollo&parentPath=%2F%E5%88%B6%E4%BD%9C%E8%A7%86%E9%A2%91

Logo

为开发者提供自动驾驶技术分享交流、实践成长、工具资源等,帮助开发者快速掌握自动驾驶技术。

更多推荐