Apollo did me good

  1. The previous configuration information of the project is all in the Resources directory. Of course, HERE I use the project built by Spring Boot. After using Apollo, the configuration information is transferred to Apollo for management. After modifying the configuration in Apollo, you only need to restart the server.
  2. Hot refreshBusiness configurationAfter modifying the configuration in Apollo, you can directly access the interface again to obtain the configuration information without restarting the server. You need to write your own code, integrate Apollo’s client, listen for configuration changes on Apollo, and then refresh the data.
  3. Apollo does a lot of things, for exampleGray releasedYou’re going to need it later.

How does Apollo launch on Win

  1. In general, the database configuration cannot be found during startup on Win. The solution is as follows
  2. ifportNeed to modify, need to adjustConfigservice, AdminService, portalThree modulesapplication.ymlProfile basedserver.portProperty and add the database configuration under the change configuration file
spring
  datasource:
    url: jdbc:mysql://localhost:3306/ApolloPortalDB? characterEncoding=utf8
    username: root
    password: 123456
Copy the code
  1. The above database configuration can be modified according to different modules, and then start the project according to the startup sequence described below.

Apollo Server deployment steps

  1. Download the Apollo Master code
  2. Build. bat on Windows and build.sh on MAC, including port changes for eurake registry
  3. Run the build file
  4. Decompress the xxx-Github xxx.zip file in the target directory of adminService, ConfigService, and Portal modules and upload the file to the centos server
  5. Run the start script in the script directory of the three decompression packages
  6. Access path IP :port

Apollo Service startup sequence

  1. config service
  2. admin service
  3. portal service

Apollo Client configuration procedure

  1. The introduction ofapollo-client1.3.0 rely on
  2. Annotate the startup class@EnableApolloConfig
  3. The yML or Properties configuration file says the configuration to access Apollo

Considerations for integrating Apollo Client

  1. I’m using Apollo-Client 1.3.0, which supports YML configuration files.
  2. Writing Apollo Client configuration information to application.properties or bootstrap.properties/ yML is ok.
  3. Note the configuration apollo.meta, which points to the address in Apollo where Eurake was launched, not, not, notApollo Address of the management interface.

Deploy Apollo in the Docker container

  1. Write Dockerfile, Apollo source code is the default Dockerfile

    Apollo-configservice Dockerfile configuration. Unzip -d creates a directory containing the decompression package in the specified directory by default.

    Mirrors.aliyun.com/alpine/v3.8 use docker build mirror, may download failed, reset the docker can download properly.

    Restart the systemctl restart docker command

# Dockerfile for apollo-configservice # 1. Copy apollo-configservice-${VERSION}-github.zip to current directory # 2. Build with: docker build -t apollo-configservice . # 3. Run with: docker run -p 8080:8080 -d -v /tmp/logs:/opt/logs --name apollo-configservice apollo-configservice FROM Openjdk :8- jre-maintainer Lauleo ENV VERSION 1.5.0-SNAPSHOT ENV SERVER_PORT 8080 # DataSource Info ENV DS_URL "" ENV DS_USERNAME "" ENV DS_PASSWORD" RUN "echo" http://mirrors.aliyun.com/alpine/v3.8/main "> / etc/apk/repositories \ && Echo "http://mirrors.aliyun.com/alpine/v3.8/community" > > / etc/apk/repositories \ && apk update upgrade \ && apk add --no-cache procps unzip curl bash tzdata \ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone ADD apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-configservice-${VERSION}-github.zip RUN unzip /apollo-configservice/apollo-configservice-${VERSION}-github.zip -d /apollo-configservice \ && rm -rf /apollo-configservice/apollo-configservice-${VERSION}-github.zip \ && sed -i '$d' /apollo-configservice/apollo-configservice-${VERSION}-github/scripts/startup.sh \ && chmod +x /apollo-configservice/apollo-configservice-${VERSION}-github/scripts/startup.sh \ && echo "tail -f /dev/null" >> /apollo-configservice/apollo-configservice-${VERSION}-github/scripts/startup.sh EXPOSE $SERVER_PORT CMD ["/Apollo - configservice/Apollo - configservice - 1.5.0 - the SNAPSHOT - making/scripts/startup. Sh "]Copy the code
  1. Build script commands

    docker build -t apollo-configservice:v1 .

  2. Run apollo-configService image

    docker run -p 58080:8080 -d -v /root/apollo/apollo-configservice/logs:/opt/logs –name apollo-configservice apollo-configservice:v1

  3. View container run logs

    docker logs -f -t apollo-configservice

Ps: To be continued…