GithubHelp home page GithubHelp logo

configserver_demo's Introduction

#主要思路

#构建

  • 构建配置管理容器。将所有配置文件拷贝或者挂载到此容器中的nginx发布目录,通过nginx服务下载或读取配置文件。

      #-------------------------------------
      #构建/发布配置管理镜像
      #-------------------------------------
      cd config 
      docker build -t config .
      docker run --net=host -d config (why must host?FIXME)
    
  • 构建sample应用容器。index.jsp通过容器env获得配置文件链接并读取配置文件。

      #-------------------------------------
      # For tomcat 8.0
      #-------------------------------------
      cd sample
      #构建tomcat8.0 sample应用镜像
      docker build -t sample:tomcat -f Dockerfile.tomcat .
      #开发环境发布应用
      docker run -p 8080:8080 
      	-e config_uri=http://IPADDR/dev.properties 
      	-e config_file=/opt/dev.properties 
      	-d sample:tomcat 
      	/bin/bash -c "/opt/loadconfig.sh;/usr/local/tomcat/bin/catalina.sh stop;/usr/local/tomcat/bin/catalina.sh run"
      
      #测试环境发布应用
      docker run -p 8080:8080 
      	-e config_uri=http://IPADDR/test.properties 
      	-e config_file=/opt/test.properties 
      	-d sample:tomcat 
      	/bin/bash -c "/opt/loadconfig.sh;/usr/local/tomcat/bin/catalina.sh stop;/usr/local/tomcat/bin/catalina.sh run"
      
      #准生产环境发布应用
      docker run -p 8080:8080 
      	-e config_uri=http://IPADDR/pre-online.properties 
      	-e config_file=/opt/pre-online.properties 
      	-d sample:tomcat 
      	/bin/bash -c "/opt/loadconfig.sh;/usr/local/tomcat/bin/catalina.sh stop;/usr/local/tomcat/bin/catalina.sh run"
      	
      #生产环境发布应用
      docker run -p 8080:8080 
      	-e config_uri=http://IPADDR/online.properties -e config_file=/opt/online.properties 
      	-d sample:tomcat 
      	/bin/bash -c "/opt/loadconfig.sh;/usr/local/tomcat/bin/catalina.sh stop;/usr/local/tomcat/bin/catalina.sh run"
      
      #-------------------------------------
      # For Weblogic12.2.1
      #-------------------------------------
      cd sample 
      # 构建/发布weblogic12.2.1 sample应用镜像
      docker build -t sample:weblogic -f Dockerfile.weblogic .
      #开发环境发布应用
      docker run -p 8001:8001 
      	-e config_uri=http://IPADDR/dev.properties 
      	-e config_file=//u01/oracle/dev.properties
      	-d sample:weblogic
      	/bin/bash -c "/u01/oracle/loadconfig.sh;stopWebLogic.sh;startWebLogic.sh"
      
      #测试环境发布应用
      docker run -p 8001:8001 
      	-e config_uri=http://IPADDR/test.properties 
      	-e config_file=/u01/oracle/test.properties
      	-d sample:weblogic
      	/bin/bash -c "/u01/oracle/loadconfig.sh;stopWebLogic.sh;startWebLogic.sh"
      
      #准生产环境发布应用
      	-e config_uri=http://IPADDR/pre-online.properties 
      	-e config_file=/u01/oracle/pre-online.properties
      	-d sample:weblogic
      	/bin/bash -c "/u01/oracle/loadconfig.sh;stopWebLogic.sh;startWebLogic.sh"
      
      #生产环境发布应用
      	-e config_uri=http://IPADDR/online.properties 
      	-e config_file=/u01/oracle/online.properties
      	-d sample:weblogic
      	/bin/bash -c "/u01/oracle/loadconfig.sh;stopWebLogic.sh;startWebLogic.sh"
    

#TODO

  • 可以考虑构建配置管理服务提供get/refresh配置项等API,提供事件注册和通知,或加上zookeeper实现配置同步。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.