在群晖NAS上搭建私有部署笔记软件——Blossom

一、Blossom 简介

Blossom 是一个需要私有部署的笔记软件,虽然本身定位是一个云端软件,但你仍然可以在本地部署,数据和图片都将保存在本地,不依赖任何的图床或者对象存储

Blossom | Blossom (wangyunf.com)https://www.wangyunf.com/blossom-doc/index.html

二、群晖部署Blossom

2.1、安装mariadb数据库

登陆群晖的管理界面打开【套件中心】-->顶部搜索框输入【mariadb】后按下Enter键-->找到Mariadb 10点击【安装套件、然后输入密码】,mariadb安装完成后打开该数据库开启tcp连接,如下图所示:

2.2、授权mariadb的指定用户可以远程登录该数据库

授权mariadb的指定用户可以远程登录该数据库和创建blossom数据库可以采用以下的2种方法中的任意一种实现。

2.2.1、方法一:使用phpMyAdmin套件执行授权sql

登陆群晖的管理界面打开【套件中心】--》顶部搜索框输入【phpmyadmin】后按下Enter键--》找到phpMyAdmin套件点击【安装套件】,phpMyAdmin套件安装完成后打开输入默认用户【root】和刚才设置的mariadb数据库密码后点击【登录】按钮登录,如下图所示:

使用phpMyAdmin套件连接mariadb10数据库成功后选择【SQL】-->输入需要执行的授权指定的用户可以远程登录mariadb10数据库、创建blossom数据命令后-->点击【执行】,如下图所示:

sql 复制代码
UPDATE mysql.user SET Host='%' WHERE User='root' and Host='localhost';

flush privileges;

CREATE DATABASE `blossom` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

2.2.2、方法二:使用ssh执行授权sql

2.2.2.1、下载ssh工具连接到群晖NAS

可以直接使用putty工具连接到群晖NAS:

在Windows中通过Putty连接Linux、通过pscp传输文件到Linux_window使用putty登录linux,如何传输文件-CSDN博客https://blog.csdn.net/xiaochenXIHUA/article/details/118067326?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522170460131616777224447380%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=170460131616777224447380&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-1-118067326-null-null.nonecase&utm_term=Putty&spm=1018.2226.3001.4450

我这里使用WindTerm工具的ssh功能连接群晖NAS,如下图为WindTerm工具的下载方法:

直接下载WindTerm_2.5.0工具https://github.com/kingToolbox/WindTerm/releases/download/2.5.0/WindTerm_2.5.0_Windows_Portable_x86_64.zip

下载WindTerm工具https://github.com/kingToolbox/WindTerm/releases

2.2.2.2、使用ssh工具连接到群晖NAS后连接mariadb数据库执行授权操作

连接mariadb数据库命令【mysql -u数据库的用户名 -p数据库的用户名对应的密码】(如下为mariadb数据库默认用户root和root用户对应的密码jasmine888G连接命令,输入完成后按下Enter键即可连接上mariadb数据库)

bash 复制代码
mysql -uroot -pjasmine888G

注意:在执行一下的sql语句前,必须要登陆到mariadb数据库中

设置任意主机使用root用户可远程访问mariadb数据库(%表示任意主机)sql语句:

sql 复制代码
UPDATE mysql.user SET Host='%' WHERE User='root' and Host='localhost';
flush privileges;

创建名为blossom的数据库sql语句:

sql 复制代码
CREATE DATABASE `blossom` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

退出数据库:

sql 复制代码
exit;

2.3、部署Blossom

2.3.1、创建blossom的映射文件夹

2.3.2、拉取blossom镜像

bash 复制代码
docker pull jasminexzzz/blossom:latest

2.3.3、部署且启动blossom容器

bash 复制代码
--部署blossom且启动的语法
sudo docker run -d --net=host --name blossom-backend -p 9999:9999 -v /volume1/docker/blossom/bl/:/home/bl/ jasminexzzz/blossom:latest --project.iaas.blos.domain="http://你自己的群晖NASIP地址:9999/pic/" --project.iaas.blos.default-path="/home/bl/img/" --spring.datasource.url="jdbc:mysql://127.0.0.1:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" --spring.datasource.username=你的mariadb数据库登陆用户名称 --spring.datasource.password=你的mariadb数据库登陆用户名称对应的密码

--示例:比如我的群晖NASIP地址是【172.24.1.6】、mariadb数据库登陆用户名称是【root】、mariadb数据库登陆用户名称【root】对应的密码是【jasmine888G】
sudo docker run -d --net=host --name blossom-backend -p 9999:9999 -v /volume1/docker/blossom/bl/:/home/bl/ jasminexzzz/blossom:latest --project.iaas.blos.domain="http://172.24.1.6:9999/pic/" --project.iaas.blos.default-path="/home/bl/img/" --spring.datasource.url="jdbc:mysql://127.0.0.1:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" --spring.datasource.username=root --spring.datasource.password=jasmine888G

注意:

1、这里的数据库端口要根据你实际的mariadb数据库端口填写(默认情况下是3306) ;

2、还有关于部署且启动blossom容器的地址【--project.iaas.blos.domain="http://172.24.1.6:9999/pic/"】若你需要在外网使用则该地址需要修改为外网地址【--project.iaas.blos.domain="http://外网IP地址:9999/pic/"】

2.3.4、验证部署的blossom容器是否成功

验证部署的blossom容器是否成功命令:

bash 复制代码
sudo docker logs blossom-backend

注意:执行验证命令后若出现如下所示的【821: Application run failed 】 、【Error 】、【Failed to execute SQL script...】错误提示,则表示部署的blossom失败!!!

2.3.5、解决部署的blossom容器失败方法

从验证部署blossom容器是否成功的日志内容可以了解到是由于初始化sql语句在我们的数据库中执行出现了语法错误导致失败的,我们只需要替换掉原来的初始化sql语句即可。

1、创建一个文本文件并命名为【schema-mysql.sql】且用记事本打开;

2、将如下的blossom初始sql语句内容复制到【schema-mysql.sql】文件中且保存;

bash 复制代码
-- 修改后的可在mariadb数据库中执行的blossom初始sql语句
-- Copy from /blossom/script/sql/blossom.sql

-- ----------------------------
-- Table structure for base_sys_param
-- ----------------------------
CREATE TABLE IF NOT EXISTS `base_sys_param`  (
                                   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '参数ID',
                                   `param_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '参数名称',
                                   `param_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '参数值',
                                   `param_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '参数说明',
                                   `open_state` int NOT NULL COMMENT '开放状态 [YesNo]',
                                   `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                   `upd_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                   PRIMARY KEY (`id`) USING BTREE,
                                   UNIQUE INDEX `unq_param_name`(`param_name`) USING BTREE COMMENT '参数名称唯一'
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '系统参数' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of base_sys_param
-- ----------------------------
DELETE FROM base_sys_param WHERE ID=1;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 1,
       'WEB_ARTICLE_URL',
       'https://www.domain.com/blossom/#/articles?articleId=',
       '博客端文章地址,用于PC端直接调往WEB端阅读文章',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
    );
		
DELETE FROM base_sys_param WHERE ID=3;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 3,
       'ARTICLE_LOG_EXP_DAYS',
       '30',
       '文章修改记录保存天数, 超过该天数将被删除',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
    );
		
DELETE FROM base_sys_param WHERE ID=4;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES(  4,
       'ARTICLE_RECYCLE_EXP_DAYS',
       '45',
       '文章回收站过期天数, 超过该天数将被删除',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
);

DELETE FROM base_sys_param WHERE ID=11;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES(  11,
       'HEFENG_KEY',
       '',
       '和风天气的KEY',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
    );
		
DELETE FROM base_sys_param WHERE ID=21;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 21,
       'GITEE_ACCESS_TOKEN',
       '',
       '[过时配置]GITEE API 的访问 token',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
    );
		
DELETE FROM base_sys_param WHERE ID=31;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES(  31,
       'BACKUP_PATH',
       '/home/bl/backup/',
       '备份路径, 参考格式: /home/bl/backup/',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
   );
	 
DELETE FROM base_sys_param WHERE ID=32;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 32,
       'BACKUP_EXP_DAYS',
       '7',
       '备份过期天数',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
    );
		
DELETE FROM base_sys_param WHERE ID=900;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 900,
       'SERVER_JWT_SECRET',
       '96cae35ce8a9b0244178bf28e4966c2ce1b8385723a96a6b838858cdd6ca0a1e',
       'JWT加密字符串',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
   );
	 
DELETE FROM base_sys_param WHERE ID=901;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 901,
       'SERVER_MACHINE_EXPIRE',
       '2024-01-01',
       '过期时间 - 服务器',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
    );
		
DELETE FROM base_sys_param WHERE ID=902;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 902,
       'SERVER_DOMAIN_EXPIRE',
       '2024-01-01',
       '过期时间 - 域名',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
   );
	 
DELETE FROM base_sys_param WHERE ID=903;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 903,
       'SERVER_HTTPS_EXPIRE',
       '2024-01-01',
       '过期时间 - HTTPS 证书',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
   );
	 
DELETE FROM base_sys_param WHERE ID=904;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 904,
       'SERVER_DATABASE_EXPIRE',
       '2024-01-01',
       '过期时间 - 数据库',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
   );



-- ----------------------------
-- since: 1.12.0
-- ----------------------------
DELETE FROM base_sys_param WHERE ID=101;
INSERT INTO base_sys_param (id, param_name, param_value, param_desc, open_state, cre_time, upd_time)
VALUES( 101,
       'BLOSSOM_OBJECT_STORAGE_DOMAIN',
       'http://www.xxx.com/',
       'BLOSSOM 对象存储地址',
       1,
       CURRENT_TIMESTAMP,
       CURRENT_TIMESTAMP
);

-- ----------------------------
-- Table structure for base_user
-- ----------------------------
CREATE TABLE IF NOT EXISTS `base_user`  (
                              `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
                              `type` tinyint(1) NOT NULL DEFAULT 2 COMMENT '用户类型: 1:管理员; 2:普通用户; 3:只读用户;',
                              `username` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '用户名',
                              `phone` varchar(13) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '用户手机号',
                              `password` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '用户密码',
                              `salt` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '密码加盐',
                              `nick_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '昵称',
                              `real_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '真实姓名',
                              `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '用户头像',
                              `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注',
                              `cre_by` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '0,SYS' COMMENT '创建人ID,名称',
                              `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                              `upd_by` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '0,SYS' COMMENT '修改人ID,名称',
                              `upd_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                              `del_by` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '0,SYS' COMMENT '删除人ID,名称',
                              `del_time` bigint NOT NULL DEFAULT 0 COMMENT '删除时间',
                              `location` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '101100101' COMMENT '和风天气的位置, 官方文档:https://github.com/qwd/LocationList/blob/master/China-City-List-latest.csv',
                              PRIMARY KEY (`id`) USING BTREE,
                              UNIQUE INDEX `unq_user_username`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10002 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of base_user
-- ----------------------------
DELETE FROM base_user WHERE ID=1;
INSERT INTO base_user (id, type, username, phone, password, salt, nick_name, real_name, remark, cre_by, cre_time, upd_by, upd_time, location)
VALUES( 1,
       1,
       'blos',
       '',
       '$2a$10$SgMx8T/06595PEq3EA9US.ja1oHxpIDG/XnERmBXS.wYS8qbxAGDa',
       'UVeESP5NgXwb8JmjCHUK',
       '用户',
       'blos',
       '预设管理员账号, 用户名密码都是 blos',
       '0,SYS',
       CURRENT_TIMESTAMP,
       '0,SYS',
       CURRENT_TIMESTAMP,
       '101100101'
    );
-- ----------------------------
-- Table structure for blossom_article
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_article`  (
                                    `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                    `pid` bigint NOT NULL COMMENT '文件夹ID',
                                    `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文章名称',
                                    `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文章图标',
                                    `tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '标签集合',
                                    `sort` int NOT NULL DEFAULT 1 COMMENT '排序',
                                    `cover` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '封面',
                                    `describes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '描述',
                                    `star_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'star状态',
                                    `open_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '公开状态',
                                    `open_version` int NOT NULL DEFAULT 0 COMMENT '公开版本',
                                    `pv` int NOT NULL DEFAULT 0 COMMENT '页面的查看数',
                                    `uv` int NOT NULL DEFAULT 0 COMMENT '独立的访问次数,每日IP重置',
                                    `likes` int NOT NULL DEFAULT 0 COMMENT '点赞数',
                                    `words` int NOT NULL DEFAULT 0 COMMENT '文章字数',
                                    `version` int NOT NULL DEFAULT 0 COMMENT '版本',
                                    `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '颜色',
                                    `toc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '目录解析',
                                    `markdown` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'Markdown 内容',
                                    `html` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'Html内容',
                                    `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                    `upd_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                    `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 20153 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '文章,Article' ROW_FORMAT = DYNAMIC;


-- ----------------------------
-- Records of blossom_article
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_article_log
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_article_log`  (
                                        `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                        `article_id` bigint NOT NULL COMMENT '文章ID',
                                        `version` int NOT NULL DEFAULT 0 COMMENT '版本',
                                        `markdown` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文章内容',
                                        `cre_time` datetime NOT NULL COMMENT '修改日期',
                                        PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 146 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '文章记录,ArticleLog' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of blossom_article_log
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_article_log
-- since 1.10.0
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_article_recycle` (
                                           `id` bigint NOT NULL COMMENT 'ID',
                                           `pid` bigint NOT NULL COMMENT '文件夹ID',
                                           `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文章名称',
                                           `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文章图标',
                                           `tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '标签集合',
                                           `sort` int NOT NULL DEFAULT '1' COMMENT '排序',
                                           `cover` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '封面',
                                           `describes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '描述',
                                           `pv` int NOT NULL DEFAULT '0' COMMENT '页面的查看数',
                                           `uv` int NOT NULL DEFAULT '0' COMMENT '独立的访问次数,每日IP重置',
                                           `likes` int NOT NULL DEFAULT '0' COMMENT '点赞数',
                                           `words` int NOT NULL DEFAULT '0' COMMENT '文章字数',
                                           `version` int NOT NULL DEFAULT '0' COMMENT '版本',
                                           `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '颜色',
                                           `markdown` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'Markdown 内容',
                                           `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                           `upd_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                           `del_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '删除时间',
                                           `user_id` bigint NOT NULL DEFAULT '1' COMMENT '用户ID',
                                           PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='文章回收站';

-- ----------------------------
-- Table structure for blossom_article_open
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_article_open`  (
                                         `id` bigint NOT NULL COMMENT '文章ID',
                                         `pid` bigint NOT NULL COMMENT '文件夹ID',
                                         `words` int NOT NULL COMMENT '字数',
                                         `open_version` int NOT NULL DEFAULT 1 COMMENT '版本',
                                         `open_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '公开时间',
                                         `sync_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '同步时间',
                                         `toc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '目录',
                                         `markdown` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'Markdown 内容',
                                         `html` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'Html内容',
                                         `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                         PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '公开文章,ArticleOpen' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of blossom_article_open
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_article_reference
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_article_reference` (
                                             `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                             `source_id` bigint NOT NULL COMMENT '文章ID',
                                             `source_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文章名称',
                                             `target_Id` bigint NOT NULL COMMENT '引用文章ID',
                                             `target_name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '引用名称',
                                             `target_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '图片链接',
                                             `type` tinyint NOT NULL COMMENT '引用类型: 10:图片; 11:文章; 21:外部文章',
                                             `user_id` bigint NOT NULL DEFAULT '1' COMMENT '用户ID',
                                             PRIMARY KEY (`id`) USING BTREE,
                                             KEY `idx_article_ref_sourceid` (`source_id`) USING BTREE COMMENT 'source id',
                                             KEY `idx_article_ref_targetid` (`target_Id`) USING BTREE COMMENT 'target id'
) ENGINE=InnoDB AUTO_INCREMENT=100000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of blossom_article_reference
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_article_view
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_article_view` (
                                        `id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                        `article_id` bigint NOT NULL COMMENT '文章ID',
                                        `type` char(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '事件类型 1:uv; 2:like',
                                        `ip` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '地址,IPV4',
                                        `user_agent` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '设备',
                                        `country` varchar(50) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '国家',
                                        `province` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '省',
                                        `city` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '市',
                                        `cre_day` date NOT NULL COMMENT '日期 yyyy-MM-dd',
                                        `cre_time` datetime NOT NULL COMMENT '日期',
                                        PRIMARY KEY (`id`) USING BTREE,
                                        KEY `idx_view_articleid` (`article_id`) USING BTREE COMMENT '文章ID',
                                        KEY `idx_view_ip` (`ip`) USING BTREE COMMENT 'IP',
                                        KEY `idx_view_creday` (`cre_day`) USING BTREE COMMENT '日期'
) ENGINE=InnoDB AUTO_INCREMENT=465 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='文章访问记录,ArticleView';

-- ----------------------------
-- Records of blossom_article_view
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_folder
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_folder`  (
                                   `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id',
                                   `pid` bigint UNSIGNED NOT NULL COMMENT '父id',
                                   `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文件夹名称',
                                   `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '图标',
                                   `tags` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '标签',
                                   `open_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '开放状态',
                                   `sort` int UNSIGNED NOT NULL DEFAULT 1 COMMENT '排序',
                                   `cover` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '封面图片',
                                   `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '颜色',
                                   `describes` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注',
                                   `store_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '/' COMMENT '存储地址',
                                   `subject_words` int NOT NULL DEFAULT 0 COMMENT '专题字数',
                                   `subject_upd_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '专题的最后修改时间',
                                   `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:文章;2:图片',
                                   `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                   `upd_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                   `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12035 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '文件夹,Folder' ROW_FORMAT = DYNAMIC;

alter table blossom_folder modify icon varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL default '' comment '图标';
alter table blossom_folder modify sort int NOT NULL default 1 comment '排序';

-- ----------------------------
-- Records of blossom_folder
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_note
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_note`  (
                                 `id` bigint NOT NULL AUTO_INCREMENT,
                                 `content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '内容',
                                 `top` tinyint(1) NOT NULL DEFAULT 0 COMMENT '置顶',
                                 `top_time` datetime NULL DEFAULT NULL COMMENT '置顶时间',
                                 `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of blossom_note
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_picture
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_picture`  (
                                    `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                    `pid` bigint NOT NULL DEFAULT -1 COMMENT '文件夹ID',
                                    `source_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '原文件名',
                                    `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文件名',
                                    `path_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文件路径',
                                    `url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文件访问url',
                                    `rate` tinyint NOT NULL DEFAULT 0 COMMENT '评分 {0,1,2,3,4,5}',
                                    `star_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '收藏 0:否,1:是',
                                    `suffix` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文件后缀',
                                    `size` bigint NOT NULL DEFAULT 0 COMMENT '文件大小',
                                    `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建日期',
                                    `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                    PRIMARY KEY (`id`) USING BTREE,
                                    UNIQUE INDEX `unq_pic_url`(`url`) USING BTREE COMMENT '链接唯一',
                                    UNIQUE INDEX `unq_pic_pathname`(`path_name`) USING BTREE COMMENT '路径唯一'
) ENGINE = InnoDB AUTO_INCREMENT = 305774931235323969 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '图片,Picture' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of blossom_picture
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_plan
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_plan`  (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                 `group_id` bigint NOT NULL COMMENT '分组ID',
                                 `type` tinyint(1) NOT NULL COMMENT '计划类型: daily, day',
                                 `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '标题',
                                 `content` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '内容',
                                 `plan_month` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '日期所在月份',
                                 `plan_date` date NULL DEFAULT NULL COMMENT '日期: day',
                                 `plan_start_time` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '开始时间: daily, day',
                                 `plan_end_time` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '结束时间',
                                 `color` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '颜色',
                                 `position` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '该计划在该组计划的位置 head, tail, all',
                                 `img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '图片名称, 或图片地址',
                                 `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
                                 `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 142 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '计划,Plan' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of blossom_plan
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_stat
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_stat`  (
                                 `id` bigint NOT NULL AUTO_INCREMENT,
                                 `type` tinyint(1) NOT NULL COMMENT '统计类型: 1:每日编辑文章数; 2:每月总字数;',
                                 `stat_date` date NOT NULL COMMENT '统计日期',
                                 `stat_value` int NOT NULL DEFAULT 0 COMMENT '统计数值',
                                 `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 218 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of blossom_stat
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_web
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_web`  (
                                `id` int NOT NULL AUTO_INCREMENT,
                                `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '网页名称',
                                `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '网页url',
                                `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '图标',
                                `img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '图片, 图片的优先级高于图标',
                                `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '类型 ',
                                `sort` int NOT NULL DEFAULT 1 COMMENT '排序',
                                `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                `user_id` bigint NOT NULL DEFAULT 1 COMMENT '用户ID',
                                PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 292 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '[FS] 网站收藏' ROW_FORMAT = DYNAMIC;

alter table blossom_web modify icon varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL default '' comment '图标';
-- ----------------------------
-- Records of blossom_web
-- ----------------------------

-- ----------------------------
-- Table structure for blossom_todo
-- ----------------------------
CREATE TABLE IF NOT EXISTS `blossom_todo` (
                                `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
                                `todo_id` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '事项ID',
                                `todo_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '事项名称',
                                `todo_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '事项状态 1:未完成 | 2:完成 | 9:作废',
                                `todo_type` tinyint(1) NOT NULL DEFAULT '10' COMMENT '事项类型 10:每日待办事项 | 20:阶段性事项',
                                `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '任务名称',
                                `task_content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '任务内容',
                                `task_tags` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '便签',
                                `task_status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT 'WAITING' COMMENT '任务状态 WAIT | PROC | DONE',
                                `dead_line` varchar(100) COLLATE utf8mb4_bin DEFAULT '' COMMENT '截止日期',
                                `start_time` datetime DEFAULT NULL COMMENT '开始日期',
                                `end_time` datetime DEFAULT NULL COMMENT '结束日期',
                                `color` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '颜色',
                                `process` tinyint(1) NOT NULL DEFAULT '0' COMMENT '进度 0 ~ 100',
                                `user_id` bigint DEFAULT NULL COMMENT '用户ID',
                                `cre_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                PRIMARY KEY (`id`),
                                KEY `idx_todo_todoid` (`todo_id`) COMMENT 'todoid 索引',
                                KEY `idx_todo_userid` (`user_id`) USING BTREE COMMENT 'userid 索引',
                                KEY `idx_todo_cretime` (`cre_time`) USING BTREE COMMENT '创建时间'
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='待办事项,Todo';
SET FOREIGN_KEY_CHECKS = 1;

3、将【schema-mysql.sql】文件上传到群晖NAS的路径中且查看该文件路径

①将【schema-mysql.sql】文件上传到群晖NAS的【docker/blossom】路径中,如下图所示:

②【schema-mysql.sql】文件上传到群晖NAS的【docker/blossom】路径成功后查看该【schema-mysql.sql】文件的完整路径并复制下来,如下图所示:

4、使用ssh工具连接到群晖NAS后查看blossom的容器id

查看docker下所有容器的ID命令:

bash 复制代码
sudo docker ps

5、使用我们修改的【schema-mysql.sql】blossom初始文件替换原来的文件

首先我们需要使用ssh工具进入到群晖NAS,然后在执行替换命令:

bash 复制代码
sudo docker cp /volume1/docker/blossom/schema-mysql.sql b9275737e077:/application/BOOT-INF/classes/

6、重启blossom的容器

重启docker容器命令

bash 复制代码
sudo docker restart 需重启的docker容器id

比如我要重启容器id是【b9275737e077】的容器命令如下:

bash 复制代码
sudo docker restart b9275737e077

7、再次验证部署的blossom容器是否成功

用ssh工具进入到群晖NAS,然后在执验证部署的blossom容器是否成功命令,如执行该命令后最下面的内容如下图显示的客户端访问地址XXX则表示成功。

复制代码
启动成功: 可使用客户端登录, 默认用户名/密码: blos/blos
下载地址: https://github.com/blossom-editor/blossom/releases
文档地址: https://www.wangyunf.com/blossom-doc/index
博客端访问地址: http://IP:端口(域名)/blog/#/home
客户端访问地址: http://IP:端口(域名)/editor/#/settingindex
bash 复制代码
sudo docker logs blossom-backend

2.4、输入群晖NASIP:9999查看

在浏览器输入群晖NASIP:9999后按下Enter键后若出现如下所示的【无效的授权信息】内容也表示blossom的服务端部署完成;

2.5、在群晖NAS部署blossom的网页客户端

1、下载blossom的网页客户端后解压

下载 | Blossom (wangyunf.com)

Releases · blossom-editor/blossom · GitHub

或者可以直接到blossom指定的百度网盘下载blossom的网页客户端

前往百度网盘下载:百度网盘 请输入提取码

提取码uksl

2、将下载好的blossom网页客户端上传到群晖NAS中

将下载好的blossom网页客户端上传到群晖NAS中路径如下所示:

3、群晖NAS中配置blossom的网页客户端网页内容

验证在群晖NAS部署的blossom网页客户端是否成功【在浏览器中输入群晖NASIP:9998】后按下Enter键;

三、登陆自己的blossom

1、在浏览器中输入群晖NASIP:9998后按下Enter键进入blossom的网页客户端;

2、在blossom的网页客户端输入自己部署好的blossom服务地址【群晖NASIP:9999】(比如我的是:http://172.24.1.6:9999)、默认账号和密码都是【blos】

3、登陆成功后显示如下