DockerCompose部署Apollo配置中心

mtain 2024年04月15日 37次浏览

一、MySQL中创建数据库

apolloconfigdb.sql
apolloportaldb.sql

https://github.com/apolloconfig/apollo

注意:数据库版本要和程序版本一致

二、Yaml编排文件

version: '3'
services:
  apollo-configservice_dev:
    image: apolloconfig/apollo-configservice:2.0.0
    container_name: apollo-configservice_dev
    ports:
      - 18080:8080
    environment:
      - SPRING_DATASOURCE_URL=jdbc:mysql://192.168.xxx.xxx:3306/ApolloConfigDB?characterEncoding=utf8
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=mysql_8EzGen
    volumes:
       - ./logs:/opt/logs
  apollo-adminservice_dev:
    image: apolloconfig/apollo-adminservice:2.0.0
    container_name: apollo-adminservice_dev
    ports:
      - 18090:8090
    environment:
      - SPRING_DATASOURCE_URL=jdbc:mysql://192.168.xxx.xxx:3306/ApolloConfigDB?characterEncoding=utf8
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=mysql_8EzGen
      - EUREKA_SERVICE_URL=http://192.168.xxx.xxx:18080/eureka/
    volumes:
      - ./logs:/opt/logs
  apollo-portal_dev:
    image: apolloconfig/apollo-portal:2.0.0
    container_name: apollo-portal_dev
    ports:
      - 18070:8070
    depends_on:
      - apollo-adminservice_dev
    environment:
      - SPRING_DATASOURCE_URL=jdbc:mysql://192.168.xxx.xxx:3306/ApolloPortalDB?characterEncoding=utf8
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=mysql_8EzGen
      - APOLLO_PORTAL_ENVS=dev
      - DEV_META=http://192.168.xxx.xxx:18080
    volumes:
      - ./logs:/opt/logs

三、访问
控制面板(默认密码:apollo/admin):http://192.168.xxx.xxx:18070/