This method is suitable for scenarios where a physical machine already has JDK8
+ MySQL8
installed, and only the Jar package is needed for deployment.
Create Database
You need to create a database in MySQL first. The database name needs to be the same as the one configured in the startup parameter --spring.datasource.url
. If you don't need to customize the database name, you can directly use the following statement to create the database:
CREATE DATABASE `blossom` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE DATABASE `blossom` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
Download Jar Package
Go to the following link to download the Jar package:https://github.com/blossom-editor/blossom/releases
Deploy Jar Package
Upload the Jar package to the server and use the following command in the directory where the Jar package is located. If using Windows, remove the \
at the end of each line and write all commands in one line.
java -jar ./backend-blossom.jar \
# If port 9999 is already in use, modify it carefully
--server.port=9999 \
#【Modify Required】Configure the disk path for saving images
--project.iaas.blos.default-path="/home/bl/img" \
#【Modify Required】Configure the database access address
--spring.datasource.url="jdbc:mysql://192.168.31.99:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" \
#【Modify Required】Configure the database username
--spring.datasource.username=root \
#【Modify Required】Configure the database password
--spring.datasource.password=jasmine888 &
java -jar ./backend-blossom.jar \
# If port 9999 is already in use, modify it carefully
--server.port=9999 \
#【Modify Required】Configure the disk path for saving images
--project.iaas.blos.default-path="/home/bl/img" \
#【Modify Required】Configure the database access address
--spring.datasource.url="jdbc:mysql://192.168.31.99:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" \
#【Modify Required】Configure the database username
--spring.datasource.username=root \
#【Modify Required】Configure the database password
--spring.datasource.password=jasmine888 &
Caution
If the command is incorrect: 1. Remove the comments in the command. 2. Remove the backslash \
at the end of each line. 3. Write all commands on one line.
Parameter explanation:
Parameter | Description |
---|---|
--server.port | 【Can be modified】Application port |
--project.iaas.blos.default-path | 【Modify Required】Configure the disk path for saving images |
--spring.datasource.url | 【Modify Required】Configure the database access address |
--spring.datasource.username | 【Modify Required】Configure the database username |
--spring.datasource.password | 【Modify Required】Configure the database password |
Deploy Using Script
In addition to starting the Jar package with the above command, you can also use the following script. This script will automatically close the currently running background program and restart the Jar package in the current path.
Script link:https://github.com/blossom-editor/blossom/blob/dev/blossom-backend/script/restart-springboot.sh
#!/dash
# Restart blossom
pid=`ps aux | grep backend-blossom.jar | grep -v grep | awk '{print $2}'`
echo "Process ID: " $pid
kill -9 $pid
echo "Process" $pid "has been killed"
echo "Restarting the backend-blossom server"
# Remember to modify related parameters, same as above introduction
nohup java -jar ./backend-blossom.jar --server.port=9999 --spring.datasource.url="jdbc:mysql://192.168.31.99:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" --spring.datasource.username=root --spring.datasource.password=jasmine888 &
echo "backend-blossom is starting, please check the log ↓↓↓↓↓↓↓↓↓↓↓↓↓↓"
#!/dash
# Restart blossom
pid=`ps aux | grep backend-blossom.jar | grep -v grep | awk '{print $2}'`
echo "Process ID: " $pid
kill -9 $pid
echo "Process" $pid "has been killed"
echo "Restarting the backend-blossom server"
# Remember to modify related parameters, same as above introduction
nohup java -jar ./backend-blossom.jar --server.port=9999 --spring.datasource.url="jdbc:mysql://192.168.31.99:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" --spring.datasource.username=root --spring.datasource.password=jasmine888 &
echo "backend-blossom is starting, please check the log ↓↓↓↓↓↓↓↓↓↓↓↓↓↓"
Check Configuration Items
The various parameters you configured will be displayed at the top of the startup log.
Check if the Application Has Started Successfully
Method One: View Logs
If the bottom of the log displays the following content, it means the application has started successfully.
Method Two: Direct Access
For example, if you deploy locally, you can access 127.0.0.1:9999
. If it returns the following content, it means the deployment was successful.
{
"code": "AUTH-40101",
"msg": "Invalid authorization information",
"ex": "Invalid authorization information",
"data": null
}
{
"code": "AUTH-40101",
"msg": "Invalid authorization information",
"ex": "Invalid authorization information",
"data": null
}
This message means you are not logged in, and you can now log in to use the client.
Install the Client and Log In
After successfully deploying, you can use the client to log in. Blossom provides two types of clients:
- Download the PC Desktop Client.
- Use the built-in web client.
The web client address is:
IP:Port(domain)/editor/#/settingindex
For example, if the IP:Port is
127.0.0.1:9999
, visithttp://127.0.0.1:9999/editor/#/settingindex
For example, if the domain is
http://www.abc.com
, visithttp://www.abc.com/editor/#/settingindex
If you have configured a reverse proxy path, like
/bl/
, visithttp://www.abc.com/bl/editor/#/settingindex
Attention!
This address is for accessing the web, not the login address! Enter it in the browser's address bar!
When you open the client, you will enter the login page.
Enter the access address of the backend in the top, then log in using the default username and password.
- Username:
blos
, Password:blos
Attention!
The access address does not include /editor/#/settingindex
!!!
After logging in, it's recommended to change the default user's username and password to use it as your main account, because the built-in blog part of the backend only supports users with ID 1
.
Quick Setup
If you are a first-time user, you will see the following prompt in the upper right corner of the page.
Click on the flashing yellow icon to enter the following page.
Click on any red box above to start quick configuration.
Click on [Yes] to enter the blog configuration.
Usually, clicking on [Confirm using the built-in blog] will complete the configuration.
- For more about quick setup features, see Settings.
- For more information about blog configuration, see Blog/Mobile Page.