In July last year, it was a waste to think that I had a spare server to put there, and I happened to have a domain name filing so I thought about deploying a blog system on the public network. So I went to github and found an open source blog project that looked better, and the technical stack of this project was the same as the current mainstream Internet application architecture, such as using SpringCloud microservices, middleware, ES, etc.
But it was very difficult to deploy, this project has about 5 microservices, not to mention middleware such as ES, which is obviously not feasible under the configuration of my own server (1 core and 2G).
So I decided to write my own lightweight blog system that could be deployed with minimal resources without losing functionality.
tip
The following is the source code of the lightweight blog I built with SpringBoot+Vue, if you are interested, you can get it yourself.
// git**。
This blog project is functionally divided into the background management side and the front-end user side, the management side is mainly responsible for maintaining blog posts, viewing user scope behavior, etc., and the user side is mainly used to display blog posts and provide user interaction functions (likes, comments, etc.).Preview address: A one-page blog.
Blog homepage
Blog details
Like Comment
After the administrator enters the account password, he can enter the management page
Under the blog management menu, there are articles, topics, titles, and category management
Under article management, we first create an article and set basic information such as title and category
Then, on the list page, double-click the title to enter the article details editing page, and edit and preview the article
There's also a dedicated menu for user behavior logs for blogs
The technical architecture of the blog adopts front-end and back-end separation, in which the front-end page is developed, compiled and packaged based on the Vue+element-ui component library, and the server uses the Springboot framework to automate the configuration and introduce starter components on demand to achieve business function logic development.
The front-end and back-end are independent, detached from interdependence, reducing the risk of development and deployment impact and improving development efficiency.
Front-end pages use vue+element-ui independently
The backend adopts m**en+springboot, and is designed hierarchically according to functional modules, although it is currently packaged as a monolithic project, it is convenient to deploy independently when needed
Blog details content editing uses an open-source and powerful rich text editor, wangeditor(5.).1.23)Wangeditor5 is a web rich text editor developed based on j**ascript, up to 20 common functions, simple to use, easy to maintain, provides extension plugins, upload services and other related resources, so that we can better use in the development process.
The resource permission authentication framework on the blog management side uses the SpringSecurity + OAuth2 + JWT framework. SpringSecurity is the security framework of the Spring framework, which is used to provide identity authentication and authorization functions, and uses OAuth2 to realize the unified issuance of authentication tokens by the authentication server, which is mainly used for single sign-on (SSO), and the data format for generating tokens uses JWT, which has reliability and self-validation.
tip
I have encapsulated SpringSecurity + OAuth2 + JWT as Starter, I only need to introduce the corresponding server CION to use, if you are interested, you can get it yourself.
// git**。
The business of the project is relatively simple, mainly query, such as query detail page, list page, obviously, the main performance bottleneck of the system is the database QPS, so I decided to use the second level cache (Redis + local cache), where there is already a more popular framework JetCache on the market.Jetcache is an open-sourced distributed caching framework based on Spring and Redis by Alibaba Group, and its main features include: annotation-based, multi-level caching, high performance, and ease of use.
Add cached annotation @cached directly on the desired method
To run the project, we need to install the jdk (1.) in advance8)、mysql(>=5.7) Redis, nginx (static resources**) The second is to package the compiled static resources and functional service jar files to the server.
I use docker installation here, and the specific installation process is not repeated in detail in this article
Changes to the management UI. env.production file, and then run the npm command to package it
User UI changes. env.production file, and then run the npm command to package it
Upload the compiled and packaged static files to the corresponding directory of the home webpage of the server, and configure nginxconf**
server
Client-side UI.
location ^~/webui
Run the MVN Clean Install command locally to compile and package the JAR file and upload it to the server
nginx.Configure the conf interface and run the j**a -jar command to start the j**a program
server
Client-side interface.
location ^~/api
j**a -jar -xms300m -xmx300m yeee-app-bootstrap-1.0.0-snapshot.jar >./startup-blog.log&
So far, I have completely introduced my open source lightweight blog system through the function introduction, technical architecture and deployment process, if you have any questions, you can communicate in the comment area, or you can go to github to submit PR or ask me questions, thank you for your support.
tip
The following is the source code of the lightweight blog I built with SpringBoot+Vue, if you are interested, you can get it yourself.
// git**。