安裝依賴軟件html
安裝Mysql(Ver 14.12 Distrib 5.0.45, for unknown-linux-gnu (x86_64) using EditLine wrapper)前端
安裝Tomcat(apache-tomcat-7.0.50)java
安裝Nginx(nginx/1.5.3)mysql
安裝 zookeeeper (zookeeper-3.3.0)linux
安裝 Redis (2.4.5)nginx
具體安裝方法請網上參考git
準備配置github
將你的配置文件放到此地址目錄下(如下地址可自行設定):web
home/work/dsp/disconf-rd/online-resourcesredis
配置文件包括:
- jdbc-mysql.properties (數據庫配置)
- redis-config.properties (Redis配置)
- zoo.properties (Zookeeper配置)
- application.properties (應用配置)
注意,記得執行將application-demo.properties複製成application.properties:
cp application-demo.properties application.properties
設置War包將要被部署的地址(如下地址可自行設定):
/home/work/dsp/disconf-rd/war
構建
ONLINE_CONFIG_PATH=/home/work/dsp/disconf-rd/online-resources
WAR_ROOT_PATH=/home/work/dsp/disconf-rd/war
export ONLINE_CONFIG_PATH
export WAR_ROOT_PATH
cd disconf-web
sh deploy/deploy.sh
這樣會在 /home/work/dsp/disconf-rd/war 生成如下結果:
-disconf-web.war
-html
-META-INF
-WEB-INF
上線前的初始化工做
初始化數據庫:
能夠參考 sql/readme.md 來進行數據庫的初始化。
裏面默認有6個用戶
若是想本身設置初始化的用戶名信息,能夠參考代碼來本身生成用戶:
src/main/java/com/baidu/disconf/web/tools/UserCreateTools.java
部署War
修改server.xml文件,在Host結點下設定Context:
<Context path="" docBase="/home/work/dsp/disconf-rd/war"></Context>
並設置端口爲 8015
啓動Tomcat,便可。
修改 nginx.conf,放在http下面http{中}
upstream disconf { server 127.0.0.1:8015; } server { listen 8081; server_name localhost; access_log /home/work/var/logs/disconf/access.log; error_log /home/work/var/logs/disconf/error.log; location / { root /home/work/dsp/disconf-rd/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.111:8081/ 地址(nginx監聽端口)訪問,用戶名和密碼爲admin以下圖示
參考:https://github.com/knightliao/disconf/tree/master/disconf-web