docker-compose部署apollo

安装Apollo

创建一个apollo环境管理的配置文件

  • 这个文件是用于配置apollo-portal管理的各个环境的Eureka地址
vim apollo-env.properties
  • 创建好之后添加以下配置
#本地默认环境配置,没啥用
local.meta=http://localhost:8080
#下面的环境,你有几个就添加几个,没有的或者不需要的可以直接删掉
#将以下各环境的ip更换为自己对应的服务器ip
dev.meta=http://fill-in-dev-meta-server:8080
fat.meta=http://fill-in-fat-meta-server:8080
uat.meta=http://fill-in-uat-meta-server:8080
lpt.meta=http://fill-in-lpt-meta-server:8080
pro.meta=http://fill-in-pro-meta-server:8080
  • 部署编排文件:
vim apollo-compose.yml
version: "3"

services:
  apollo-mysql:
    container_name: apollo-mysql
    restart: always
    image: pengfeilu/apollo-mysql:5.7.22_1.6.0
    ports:
      - "23306:3306"
    volumes:
      - "$PWD/mysql/data:/var/lib/mysql"
      - "$PWD/mysql/logs:/logs"
      - "/etc/localtime:/etc/localtime:ro"
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - UPDATE_EUREKA_URL_SQL=update ApolloConfigDB.ServerConfig set `Value`="http://47.xx.xx.190:28080/eureka/" where `Key`="eureka.service.url"
      - TZ=Asia/Shanghai

  apollo-configservice:
    container_name: apollo-configservice
    restart: always
    image: pengfeilu/apollo-configservice:1.6.0
    ports:
      - "28080:8080"
    depends_on:
      - apollo-mysql
    volumes:
      - "$PWD/logs/100003171:/opt/logs/100003171"
    environment:
      - spring_datasource_url=jdbc:mysql://47.xx.xx.190:23306/ApolloConfigDB?characterEncoding=utf8
      - spring_datasource_username=root
      - spring_datasource_password=123456
      - host_ip=47.xx.xx.190

  apollo-adminservice:
    container_name: apollo-adminservice
    restart: always
    image: pengfeilu/apollo-adminservice:1.6.0
    ports:
      - "28090:8090"
    depends_on:
      - apollo-mysql
      - apollo-configservice
    links:
      - apollo-configservice
    volumes:
      - "$PWD/logs/100003172:/opt/logs/100003172"
    environment:
      - spring_datasource_url=jdbc:mysql://47.xx.xx.190:23306/ApolloConfigDB?characterEncoding=utf8
      - spring_datasource_username=root
      - spring_datasource_password=123456
      - host_ip=47.xx.xx.190

  apolo-portal:
    container_name: apollo-portal
    restart: always
    image: pengfeilu/apollo-portal:1.6.0
    ports:
      - "28070:8070"
    volumes:
      - "$PWD/logs/100003173:/opt/logs/100003173"
      - "$PWD/apollo-env.properties:/apollo-portal/config/apollo-env.properties"
    environment:
      - spring_datasource_url=jdbc:mysql://47.xx.xx.190:23306/ApolloPortalDB?characterEncoding=utf8
      - spring_datasource_username=root
      - spring_datasource_password=123456
    depends_on:
      - apollo-mysql

参数说明
SPRING_DATASOURCE_URL: 对应环境ApolloPortalDB的地址
SPRING_DATASOURCE_USERNAME: 对应环境ApolloPortalDB的用户名
SPRING_DATASOURCE_PASSWORD: 对应环境ApolloPortalDB的密码
APOLLO_PORTAL_ENVS(可选): 对应ApolloPortalDB中的apollo.portal.envs配置项,如果没有在数据库中配置的话,可以通过此环境参数配置
DEV_META/PRO_META(可选): 配置对应环境的Meta Service地址,以${ENV}_META命名,如果ApolloPortalDB中配置了apollo.portal.meta.servers,则以apollo.portal.meta.servers中的配置为准

  • 部署命令
docker-compose up -d
  • 访问测试

http://47.xx.xx.231:8070/ 账号:apollo 密码:admin

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容