Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
The concept of DevOps is a great solution to the small conflicts between development operations and maintenance, but for lZ’s small company, development takes the lead in decision making and assumes more responsibility. So in this paper, we do the integration of small company operation and maintenance scheme
Of course, no matter what period, no matter what deployment plan, can not escape the following steps
- Program packaging (run in different environments)
For example: Maven PackageCopy the code
- Upload the program package to the corresponding path of the running server, usually a Tomcat Webapps
For example, mv /**.jar /tomcat/webapps/**.jarCopy the code
- Run or restart Tomcat
For example, run the sh /tomcat/bin/startup.sh command to stop the service: kill -9 ***Copy the code
- View the startup logs and the startup status
tail -f /tomcat/logs/catalina.out
Copy the code
It is mainly divided into the following periods:
Manual contract
This period, the complete drop corresponding to the above several links, but is a little trouble, trouble, trouble
Specific operation:
- Manual packaging
- Manual transmission
- Manually operate the Tomcat service
Advantages: Suitable for beginners to be familiar with Linux platform disadvantages: but each link needs to manually adjust some parameters, and every time need a lot of repetitive work, if not careful, may have to start again
Jenkins scripts and scheduled tasks
The service connects directly to the code management platform, code submission/manually triggered version iteration, fixed activity fixed environment
Specific operation:
- Set up and configure Jenkins service
- Each service corresponds to an activity
- Maven, Gradle, and Ant scripts are packaged
- Shell script remote replication and service restart
Advantages: Suitable for a fixed server, such as production service with a stable number of requests or small test service. Different test environments are targeted at different branch codes, convenient for business testing and professional testing, and more friendly for developers. Disadvantages: Excessive detailed operations and heavy workload during service expansion or contraction
Development platform pipeline +K8S platform
Packaging code management platform, making mirror, managed kubernetes docker containers, load balancing, this period will open in the middle of the operations and problem solved a big part of, mainly due to the virtualization platform for container, save a lot of configuration, don’t jilt pan back and forth on both sides, also need not to a small low-level problem to troubleshoot the along while, In a way, it has greatly improved productivity
Specific operation:
- Platform side package
- Integrate dockerFile to build the image and upload it to the image repository
- Run the Docker container
Advantages: Clear division between the development side and the O&M side, eliminating detailed configuration, avoiding low-level problems, and smooth capacity expansion Disadvantages: Heavy maintenance workload and more deployment policies need to be considered on the development side
Personal view
There is no best, only the most suitable
Deploy a service once, so do it manually
A team doing a service frequent walk test, Jenkins
A service to withstand different pressures at different points in time, or to clearly divide the development operation and maintenance system, that is K8S