Apollo open source address: https://github.com/ctripcorp/apollo first step Clone the project locally, and then download three zip files from the releases page on GitHub. This article focuses on the deployment method of the latest version 1.2.0 as of January 2019 Step 2 Open the cloned local project, the directory structure is as follows Step 3 Create a docker-compose.yml file in this directory and write the following content: version: "3" services: apollo-configservice: ##Container service namecontainer_name: apollo-configservice ##Container namebuild: apollo-configservice/src/main/docker/ ##Dockerfile pathimage: apollo-configservice ##Image nameports: - "9180:8080" volumes: - "/opt/logs/100003171" ##Mount the /opt/logs/100003171 directory to the host's /Users/mobin/opt/logs/100003171 to facilitate viewing logs on the host environment: - spring_datasource_url=jdbc:mysql://192.168.31.136:3306/ApolloConfigDB?characterEncoding=utf8 -spring_datasource_username=root -spring_datasource_password=123456 apollo-adminservice: container_name: apollo-adminservice build: apollo-adminservice/src/main/docker/ image: apollo-adminservice ports: - "9181:8090" depends_on: - apollo-configservice volumes: - "/opt/logs/100003172" environment: - spring_datasource_url=jdbc:mysql://192.168.31.136:3306/ApolloConfigDB?characterEncoding=utf8 -spring_datasource_username=root -spring_datasource_password=123456 apollo-portal: container_name: apollo-portal build: apollo-portal/src/main/docker/ image: apollo-portal ports: - "9182:8070" depends_on: - apollo-adminservice volumes: - "/opt/logs/100003173" environment: - spring_datasource_url=jdbc:mysql://192.168.31.136:3306/ApolloPortalDB?characterEncoding=utf8 -spring_datasource_username=root -spring_datasource_password=123456 Note two points here: 1. Here, I map the original ports 8080, 8070, and 8090 to ports 9180, 9181, and 9182 respectively, because ports 8080 and other ports are commonly used ports and may conflict with other projects. 2. Remember to modify the connection address of mysql Let me explain. Some people may ask why not use the quickstart-docker script provided in the apollo project, because: In quickstart-docker, the apollo open source project team built-in a series of configurations such as MySQL to reduce deployment operations. We will definitely not use the built-in things when we use them. We hope to store the data in our own MySQL database. Also, quickstart-docker is for our convenience in demonstration Step 4 Copy the three zip files downloaded in the first step to the following directories respectively <1> <2> <3> Notice: These three directories correspond to apollo-adminservice, apollo-configservice, and apollo-portal services respectively. At the same time, we need to modify the Dockerfile files in these three directories respectively. Open the Dockerfile file Here, we find that the version number specified in the Dockerfile is 1.3.0-SNAPSHOT, but the zip package we downloaded is version 1.2.0, so we need to modify the version numbers of these three Dockerfiles respectively. The modified files are as follows: Step 5 Log in to mysql, import the sql file in the folder below, and initialize the database After the import is successful, two more databases are seen Step 6 Package the entire project apollo folder into a zip file, use the ftp or scp command to upload the file to the centos7 server, and execute the following command on the server unzip apollo.zip cd apollo docker-compose up -d Then you see the command output This means that the three Docker containers have been created successfully. use docker ps -a View Docker service It is found that it has been successfully run. Now open the browser and enter http://0.0.0.0:9182 You can see the Apollo background management page Step 7 In step 6, although the deployment is complete, there are two places that need to be modified, otherwise an error will be reported 1. Enter the apollo-portal container Modify apollo-env environment variables local.meta=http://localhost:9180 dev.meta=http://localhost:9180 fat.meta=http://localhost:9180 uat.meta=http://localhost:9180 lpt.meta=${lpt_meta} pro.meta=http://localhost:9180 2. Modify the eureka.service.url field in the ServerConfig table of the ApolloConfigDB database http://localhost:9180/eureka/ After the modification is completed, restart the three containers of apollo Notice: The default account is apollo Default password: admin After logging in to apollo, open the system information page, and you can see that there is a Home Page Url. Because we are deployed in docker, the IP address displayed here is problematic. Its IP address is the default IP address in the Docker container. This address is problematic because when we integrate it into the project, we access the server IP, so the IP address in the Docker container cannot be accessed. When integrating, we find that we cannot read the apollo configuration. The official method for modifying HomePageUrl is given, but the test found that there are still problems Official solution In Article 3 It is not recommended to modify HomePageUrl directly. The best solution is as follows: Add the following code in Application static{ System.setProperty("Dapollo.configService","http://192.168.XX") } This is the end of this article about how to use docker to deploy Apollo Configuration Center on CentOS7. For more information about how to deploy Apollo Configuration Center on docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: A problem with MySQL 5.5 deployment
>>: Practice of multi-layer nested display of element table
[LeetCode] 181.Employees Earning More Than Their ...
Table of contents Overview Four examples Example ...
js date time format Convert the date and time to ...
In Linux operation and configuration work, dual n...
Table of contents Overview The history of CPU-bou...
SQL finds all duplicate records in a table 1. The...
Strictly speaking, nginx does not have a health c...
In Linux system, both chmod and chown commands ca...
Cell -- the content of the table Cell margin (tabl...
This article example shares the specific code of ...
Table of contents The server runs jupyter noteboo...
1. Prerequisites 1. The project has been deployed...
Table of contents 1. Introduction to pid-file 2.S...
Table of contents variable Data Types Extension P...
Table of contents Preface Install vue-i18n Config...