• Apollo——dockercompose运行Apollo


    前言

    本地开发需要Apollo,记录下写的docker-compose的脚本

    内容

    目录结构

    apollo/
    ├── docker-compose.yml
    └── sql
        ├── apolloconfigdb.sql
        └── apolloportaldb.sql
    

    docker-compose.yml

    192.168.223.10为本地虚机内网IP

    version: '3'
    services:
      apollo-configservice:
        image: apolloconfig/apollo-configservice:latest
        container_name: apollo-configservice
        restart: always
        ports:
          - "8080:8080"
        volumes:
          - /tmp/logs:/opt/logs
        environment:
          SERVER_PORT: 8080
          EUREKA_INSTANCE_IP_ADDRESS: 192.168.223.10
          EUREKA_INSTANCE_HOME_PAGE_URL: "http://192.168.223.10:8080"
          EUREKA_INSTANCE_PREFER_IP_ADDRESS: false
          SPRING_DATASOURCE_URL: 'jdbc:mysql://192.168.223.10:13306/ApolloConfigDB?characterEncoding=utf8'
          SPRING_DATASOURCE_USERNAME: 'root'
          SPRING_DATASOURCE_PASSWORD: '123456'
        depends_on:
          - apollo-db
    
      apollo-adminservice:
        image: apolloconfig/apollo-adminservice:latest
        container_name: apollo-adminservice
        restart: always
        ports:
          - "8090:8090"
        volumes:
          - /tmp/logs:/opt/logs
        environment:
          SERVER_PORT: 8090
          EUREKA_INSTANCE_IP_ADDRESS: 192.168.223.10
          EUREKA_INSTANCE_HOME_PAGE_URL: "http://192.168.223.10:8090"
          EUREKA_INSTANCE_PREFER_IP_ADDRESS: false
          SPRING_DATASOURCE_URL: 'jdbc:mysql://192.168.223.10:13306/ApolloConfigDB?characterEncoding=utf8'
          SPRING_DATASOURCE_USERNAME: 'root'
          SPRING_DATASOURCE_PASSWORD: '123456'
        depends_on:
          - apollo-configservice
    
      apollo-db:
        image: mysql:5.7
        container_name: apollo-db
        restart: always
        command: --default-authentication-plugin=mysql_native_password
        environment:
          TZ: Asia/Shanghai
          MYSQL_ROOT_PASSWORD: 123456
        depends_on:
    
          - apollo-dbdata
        ports:
          - "13306:3306"
        volumes:
          - ./sql:/docker-entrypoint-initdb.d
        volumes_from:
          - apollo-dbdata
    
      apollo-dbdata:
        image: alpine:latest
        container_name: apollo-dbdata
        volumes:
          - /var/lib/mysql
    
    
      apollo-portal:
        image: apolloconfig/apollo-portal:latest
        container_name: apollo-portal
        restart: always
        ports:
          - "8070:8070"
        volumes:
          - /tmp/logs:/opt/logs
        environment:
          DS_URL: "jdbc:mysql://192.168.223.10:13306/ApolloPortalDB?characterEncoding=utf8"
          DS_USERNAME: "root"
          DS_PASSWORD: "123456"
          APOLLO_PORTAL_ENVS: "DEV"
          DEV_META: "http://192.168.223.10:8080"
          #SERVER_SERVLET_CONTEXT_PATH: "/apollo"
        depends_on:
          - apollo-adminservice
    

    配置eureka.service.url

    • 将eureka.service.url修改成自己的虚机地址

    • 修改后apollo-configservice会从DB中读取

    查看服务

    浏览器访问192.168.223.10:8070

  • 相关阅读:
    基于centos的freeradius高可用lvs(UDP)
    sql server 2012的AlwaysOn高可用
    python基础题型一
    用户访一个APP或者网页流程示意图
    DNS解析流程
    crontab的定时任务实例
    Xcode设置
    Nvidia Nsight + .NET
    C++ Pointer-to-Member Selector
    C++11
  • 原文地址:https://www.cnblogs.com/wangyang0210/p/16261620.html
Copyright © 2020-2023  润新知