banner
venom

venom

Docker Compose Single Machine Deployment Ctrip Apollo

Operating System: Ubuntu 18.04.6 LTS

Kernel: Linux 4.15.0-169-generic

Architecture: x86-64

Get Apollo Config Service Image#

root@ubuntu:~# docker pull apolloconfig/apollo-configservice:latest

Get Apollo Admin Service Image#

root@ubuntu:~# docker pull apolloconfig/apollo-adminservice:latest

Get Apollo Portal Image#

root@ubuntu:~# docker pull apolloconfig/apollo-portal:latest

Verification#

root@ubuntu:~# docker images |grep apollo
apolloconfig/apollo-portal          latest    d8f979fd9631   5 months ago   160MB
apolloconfig/apollo-adminservice    latest    2934fe191aa5   5 months ago   176MB
apolloconfig/apollo-configservice   latest    faf09bfd7daf   5 months ago   180MB

Create Mounting Directories#

root@ubuntu:~# mkdir -p apollo/configservice/conf apollo/configservice/logs apollo/adminservice/conf apollo/adminservice/logs apollo/portal/conf apollo/portal/logs

Initialize Databases#

Initialize ApolloConfigDB#

source /your_local_path/scripts/sql/apolloconfigdb.sql

Initialize ApolloPortalDB#

source /your_local_path/scripts/sql/apolloportaldb.sql

Modify Startup File#

  configservice:
    image: apolloconfig/apollo-configservice:latest
    container_name: configservice
    ports:
      - 7901:7901
    volumes:
      - /opt/apollo/configservice/logs:/opt/logs:rw
      - /opt/apollo/configservice/conf:/opt/conf:rw
      - /etc/localtime:/etc/localtime:ro
    network_mode: host
    restart: always
    environment:
      - SERVER_PORT=7901
      - SPRING_DATASOURCE_URL=jdbc:mysql://172.11.0.2:3306/ApolloConfigDB?characterEncoding=utf8&useSSL=false
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=root
    depends_on:
      - mysql
    deploy:
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure
  adminservice:
    image: apolloconfig/apollo-adminservice:latest
    container_name: adminservice
    ports:
      - 7902:7902
    volumes:
      - /opt/apollo/adminservice/logs:/opt/logs:rw
      - /opt/apollo/adminservice/conf:/opt/conf:rw
      - /etc/localtime:/etc/localtime:ro
    network_mode: host
    restart: always
    environment:
      - SERVER_PORT=7902
      - SPRING_DATASOURCE_URL=jdbc:mysql://172.11.0.2:3306/ApolloConfigDB?characterEncoding=utf8&useSSL=false
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=root
    depends_on:
      - configservice
    deploy:
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure
  portal:
    image: apolloconfig/apollo-portal:latest
    container_name: portal
    ports:
      - 7903:7903
    volumes:
      - /opt/apollo/portal/logs:/opt/logs:rw
      - /opt/apollo/portal/conf:/opt/conf:rw
      - /etc/localtime:/etc/localtime:ro
    network_mode: host
    restart: always
    environment:
      - SERVER_PORT=7903
      - SPRING_DATASOURCE_URL=jdbc:mysql://172.11.0.2:3306/ApolloPortalDB?characterEncoding=utf8&useSSL=false
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=root
      - APOLLO_PORTAL_ENVS=dev
      - DEV_META=http://124.71.212.147:7901
    depends_on:
      - configservice
      - adminservice
    deploy:
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure

Note#

Open All Ports#

The configservice service includes Eureka, so its port must be open to other services.

The adminservice service provides operations such as configuration querying and updating.

The portal service is the configuration page of Apollo, so the port also needs to be open.

Cloud Environment Deployment#

Add configuration eureka.instance.ip-address: <ip> (public IP) to ApolloConfigDB.ServerConfig.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.