configure once – use everywhere
MIT License
cloud-config is a multi-tenant-aware configuaration center based on Zookeeper and tightly integrated with Spring framework which is inspired by Centralized Application Configuration with Spring and Apache ZooKeeper.
Run following scripts to build entire project after sync the latest code
cd cloud-config-ui && npm install && cd .. && mvn clean install
Install & Start Zookeeper server
Start cloud-config-server application
java -Dnamespace={namespace} -Dconfig.center.url={zk.url} -jar cloud-config-server/target/cloud-config-server-1.0.0-SNAPSHOT.jar
Go to http://localhost:8001/ in browser
import cloud-config-client as your project maven dependency, e.g.
<dependency>
<groupId>org.squirrelframework</groupId>
<artifactId>cloud-config-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
simple usage configuration, e.g.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cc="http://www.squirrelframework.org/schema/config"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.squirrelframework.org/schema/config
http://www.squirrelframework.org/schema/config/cloud-config.xsd">
<!-- config zookeeper client -->
<cc:zk-client connection-string="127.0.0.1:2181" credential-string="user:passwd"/>
<!-- config as property place holder -->
<cc:zk-property-placeholder path="/mail, /query" location="classpath:query-server.properties"/>
<!-- config as jdbc dataSource -->
<cc:zk-jdbc-datasource id="dataSource" path="/database/mydb" resource-type="C3P0"/>
</beans>
Build cloud config docker container
cd ${cloud-config-prj-folder}
docker build -t hekailiang/cloud-config .
Run docker container for cloud config
docker run -d -p 8001:8001 --name cc -e ZK_URL={zkserver} hekailiang/cloud-config
For MacOS users, use following command to simplify docker machine access
echo $(docker-machine ip default) dockerhost | sudo tee -a /etc/hosts
Go to http://dockerhost:8001 in browser
cd ${cloud-config-prj-folder}
docker-compose up