Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process of building disconf environment by Docker

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the process of Docker building disconf environment". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the process of Docker building disconf environment".

Describe the construction process in detail

In the first two chapters, we quickly experienced the process of starting disconf locally by using remote or local images. In this chapter, we analyze and sort out the whole customization and building process. After understanding these, we can customize the local disconf environment according to our own needs.

Please note the following two points

Maven has been installed in the native environment, and the bin directory of maven is configured under the environment variable PATH

Official shell scripts are used when compiling disconf source code, so the operating system of this practice is recommended to use linux or mac. If you use windows, there are three ways: one is to change shell into a bat script, one is to use the linux of a virtual machine, and the other is to build a maven container on docker and compile the disconf source code under this container.

First analyze and then actual combat

First, list all the server that the disconf environment depends on:

Redis

Zookeeper

Mysql

Tomcat

Nginx

The next step is to sort out the dependencies between various server (for example, the business on tomcat needs to connect to the mysql database). The dependency is as follows. If you understand this, you will know how to write the link parameter:

The relationship between server has been sorted out. The next step is to customize these images of mysql,tomcat,nginx. The first step is to prepare materials. Disconf is an open source application. We can download the latest source code on git and execute the command:

Git clone git@github.com:knightliao/disconf.git

After downloading, open the folder, as shown below:

Next, let's start with the actual combat, which consists of five steps: customize mysql image-> customize tomcat image-> customize nginx image-> write docker-compose script-> start docker-compose

Custom mysql Image #

Mysql customization: the purpose is to allow the container to automatically execute sql scripts during creation, create libraries and tables, and import initialization data. The method to implement automatic execution of database scripts on docker can refer to the article "Let mysql in docker automatically execute sql when starting". Here are some steps:

Open the disconf source folder and find the following four files in the disconf/disconf-web/sql directory:

0-init_table.sql 1-init_data.sql 201512/20151225.sql 20160701/20160701.sql

Create a new directory mysql, copy the four sql files mentioned above to this directory, and create a new script called install_data.sh, as follows:

#! / bin/bashmysql-uroot-p$MYSQL_ROOT_PASSWORD

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report