This article describes the Spring Boot, Vue, project preparation Vue Element, deployed in Linux, the system uses Mysql database. According to this paper, project deployment, not get lost.
1 Introduction
Typical software development, after the "needs analysis", "outline design", "detailed design", "Development and unit testing", "front and rear ends FBI", "the production line." To publish links to production processes, nerves, can finally breathe! ! !
Wait a minute, the deployment is also very important part, the slightest mistake will "come to naught."
Development, each person's development environment, tools may be different. At present, most people (Win 10) developed with Windows, Mac systems with partially developed, there are very few developers use Linux systems. However, in order to stabilize the operation and development of the systems are deployed in most of the Linux platform. In this paper, Centos 7 deployment Spring Boot project and introduce package and deploy the front and rear end of the project.
2. Description deployment process
1) development environment Description
In all, in order to "development efficiency" in the project development time:
The back-end using IntelliJ IDEA as Spring Boot development tools (Eclipse is Ok with the fact), with the typical "controller, service, dao three-tier structure";
Front-end Vs Code Vue and Vue Element as a development tool, packaged with webpack project, "Earth people know, there is not much long-winded";
Git used as a distributed version control system;
Mysql data;
As used mybatis persistence framework.
2) Centos 7 mounted Jdk, MariaDB
Centos 7 operating system installation, slightly! There are plenty of online tutorials, not repeat them.
Installation Jdk environment
The easiest way, than with yum install a command to get (do not tell me you are still using 32-bit systems):
yum install java-11-openjdk.x86_64
Install MariaDB
[Note] when installing Linux in general will contain Mysql, which will lead to MariaDb installation is unsuccessful.
First, run the following command to check whether there is Mysql:
rpm -qa | grep mariadb
If the system pre-installed inside the Mysql, then uninstall:
yum remove mysql mysql-server mysql-libs compat-mysql51
Then add the source (both in 2020, and will not use vi, what is to save you):
vi /etc/yum.repos.d/MariaDB.repo
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.2.4/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Installation MariaDb:
yum -y install MariaDB-server MariaDB-client
Start MariaDb services:
systemctl start mariadb #启动服务
Join boot:
systemctl enable mariadb #设置开机启动
3) open firewall ports
By default, the firewall blocking is not accessible, here we open ports 80,22:
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=22/tcp --permanent
[Note] need to restart the firewall, the command is:
firewall-cmd --reload
Check whether the added successfully, I will not Screenshot demonstrated:
firewall-cmd --zone=public --list-ports
4) packaging, and front and rear ends Deployment
Busy most of the day, the preparatory work was finally done. Exciting moment finally came! ! !
Front-end project package
Webpack using front-end project management, compilation is very simple, but also a command to get (so easy !!!):
npm run build
After running this command, will produce a root folder of the project under the
dist
directory.Back-end packaging project
Copy the item to the distal end of the static directory resources springboot item, and then run
mvn clean package
to build the project, a project to generate a jar file, where the file name "myproject.jar" (The name can be set in file pom) .Database deployment
MariaDB after installation, there is no default root user password, this time through the
mysql -uroot
log to MariaDB command and then change the password by the following command654321
:mysql> use mysql; mysql> update user set password=password('654321') where user='root' and host='localhost'; mysql> flush privileges;
Then you can import the database script, and I was by
Navicat
the client operation. Of course, there are other tools that need to go through the "elephant refrigerator loaded" three steps:New Database provided encoding utf-8, import Sql files.
And witness the miracle run
We adopt the following command to run the project, if not an error, you can
http://ip
access the project:nohup java -jar myproject.jar >log.txt &
3. This paper summarizes
After an exhausting project development, and finally into the on-line test run. Large companies generally have a dedicated staff responsible for deployment, the general small companies, developers want to "full stack." Be responsible for the demand, development, testing, deployment, and so on.
This article does not involve automated deployment, do not talk about other ways to deploy docker.
Traditional crafts, handmade, worth having!
This article is a summary of individual project deployment experience, combined with the many success stories on the Internet, not claim credit alone.
如果您阅读本文后哪怕有一丢丢收获,请不要吝啬你手中关注和点赞的权力,谢谢!