1.环境配置
配置java、maven环境,并安装mysql,reids,zookeeeper,Nginx
2.下载disconf
下载:https://codeload.github.com/knightliao/disconf/zip/master
解压:unzip disconf-master.zip
3.编译打包
创建目录
mkdir /home/disconf/online-resources
mkdir /home/disconf/war
cd disconf-master
mvn clean install
ONLINE_CONFIG_PATH=/home/disconf/online-resources
WAR_ROOT_PATH=/home/disconf/war
export ONLINE_CONFIG_PATH
export WAR_ROOT_PATH
cd disconf-web
sh deploy/deploy.sh
完成在/home/disconf/war目录下产生文件
-disconf-web.war
-html
-jpaas_control
-META-INF
-Release
-tmp
-WEB-INF
4.修改配置
1)将配置文件放到此地址目录下:/home/disconf/online-resources
配置文件包括:
- jdbc-MySQL.properties (数据库配置)
- Redis-config.properties (Redis配置)
- zoo.properties (Zookeeper配置)
- application.properties (应用配置)
注意,记得执行将application-demo.properties复制成application.properties:
cp application-demo.properties application.properties
2)修改disconf配置
cd /home/disconf/war/WEB-INF/classes/
application.properties
jdbc-mysql.properties
redis-config.properties
zoo.properties
修改文件中的地址端口,调整日志目录
#log4j.properties
${catalina.home}/logs/disconf-log4j.log
#logback.xml
<property name="log.base" value="${catalina.home}/logs/disconf-web"/>
<property name="log.monitor" value="${catalina.home}/logs/monitor"/>
5.初始化数据库
按照disconf-master/disconf-web/sql/readme.txt说明按照顺序导入数据
6.配置tomcat
安装tomcat配置server.xml配置war目录
<Context path="" docBase="/home/disconf/disconf/war"></Context>
7.配置nginx
安装nginx,并配置,安装参考:
配置:vi /home/disconf/nginx/conf/nginx.conf
upstream disconf {
server 127.0.0.1:8080;
}
server {
listen 8000;
server_name localhost;
access_log logs/disconf_access.log;
error_log logs/disconf_error.log;
location / {
root /home/disconf/disconf/war/html;
if ($query_string) {
expires max;
}
}
location ~ ^/(api|export) {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://disconf;
}
}
通过http://192.168.1.90:8000/即可访问 默认用户:admin/admin