All Projects → xiayesuifeng → goblog

xiayesuifeng / goblog

Licence: GPL-3.0 license
使用golang写的个人博客mirrored from https://gitlab.com/xiayesuifeng/goblog.git

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Labels

Projects that are alternatives of or similar to goblog

Nlpgnn
1. Use BERT, ALBERT and GPT2 as tensorflow2.0's layer. 2. Implement GCN, GAN, GIN and GraphSAGE based on message passing.
Stars: ✭ 221 (+750%)
Mutual labels:  gin
go-rest
Build golang restful api, with - Gin Framework and MongoDB
Stars: ✭ 20 (-23.08%)
Mutual labels:  gin
cookiecutter-go
boilerplate, golang project starter tool, support go-zero/go-micro/gin
Stars: ✭ 63 (+142.31%)
Mutual labels:  gin
Goweibo
Go Weibo App
Stars: ✭ 243 (+834.62%)
Mutual labels:  gin
grpc-todo
A TODO app using grpc-web and Vue.js
Stars: ✭ 76 (+192.31%)
Mutual labels:  gin
go api boilerplate
🐶Go (Golang)🚀REST / GraphQL API + Postgres boilerplate
Stars: ✭ 127 (+388.46%)
Mutual labels:  gin
Gopherlabs
Go - Beginners | Intermediate | Advanced
Stars: ✭ 205 (+688.46%)
Mutual labels:  gin
logging
mod: zap logging in golang
Stars: ✭ 44 (+69.23%)
Mutual labels:  gin
requestid
Request ID middleware for Gin Framework
Stars: ✭ 115 (+342.31%)
Mutual labels:  gin
go-gin-logrus
Gin Web Framework for using Logrus as the Gin logger with Tracing middleware
Stars: ✭ 38 (+46.15%)
Mutual labels:  gin
Market monitor
💂 market monitor
Stars: ✭ 246 (+846.15%)
Mutual labels:  gin
httpsign
Signing HTTP Messages Middleware
Stars: ✭ 54 (+107.69%)
Mutual labels:  gin
goroseGin
gorose + gin demo,半小时快速上手golang web编程之用户的增删改查(示例代码)
Stars: ✭ 18 (-30.77%)
Mutual labels:  gin
Awesome Gin
awesome for gin framework
Stars: ✭ 236 (+807.69%)
Mutual labels:  gin
ginadmin
基于Gin开发的后台管理系统,集成了、数据库操作、日志管理、权限分配管理、多模板页面、自动分页器、数据库迁移和填充、Docker集成部署等功能、静态资源打包
Stars: ✭ 149 (+473.08%)
Mutual labels:  gin
Goview
Goview is a lightweight, minimalist and idiomatic template library based on golang html/template for building Go web application.
Stars: ✭ 213 (+719.23%)
Mutual labels:  gin
gonrails
Rails like mvc backend application with golang .
Stars: ✭ 37 (+42.31%)
Mutual labels:  gin
web-marisa
🍄 白丝魔理沙网页版
Stars: ✭ 65 (+150%)
Mutual labels:  gin
ginhelper
gin framework helper
Stars: ✭ 16 (-38.46%)
Mutual labels:  gin
gin-cache
🚀 A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有巨大性能提升。
Stars: ✭ 151 (+480.77%)
Mutual labels:  gin

goblog

个人博客goblog后端

pipeline status Go Report Card GoDoc Sourcegraph

博客预览

夏叶随风

前端

goblog-web

重构计划

现已使用 gin , gorm , gin-sessions 进行后端重构,前端使用react重构,使用axios和后端 API 进行交互。

  • 一键部署
  • 信息修改
  • 架构搭建
  • 登录
  • 获取article
  • 新建article
  • 编辑article
  • 删除article
  • 获取分类
  • 新建分类
  • 编辑分类
  • 删除分类
  • 备份功能
  • 还原功能
  • 插件管理中心
  • 插件机制

插件列表

插件可通过登录后在后台的插件中心中安装,也可以 手动安装 注:插件只支持 linux-amd64 ,其他平台请自行编译

  • 友链
  • 评论
  • 打赏
  • RSS订阅
  • 站点地图

数据库支持

  • MySQL
  • PortgreSQL
  • Sqlite3
  • SQL Server

其中 Sqlite3SQL Server 不内置驱动,请自行导入驱动然后重新编译,导入驱动方法如下:

修改 sql-driver/driver.go

Sqlite3 在最后一行加入 import _ "github.com/jinzhu/gorm/dialects/sqlite"

SQL Server 则加入 import _ "github.com/jinzhu/gorm/dialects/mssql"

最后根据 编译安装 重新编译既可

快速部署

下载

wget https://gitlab.com/xiayesuifeng/goblog/-/jobs/artifacts/2.5.2/download?job=build-goblog -O goblog.zip
unzip goblog.zip
cd goblog

配置

方法一(推荐)

根据 配置 进行手动配置

方法二

# 生成配置文件(数据库自行创建)
./goblog -i

后端启动

./goblog -p 20181

caddy配置实例

your {
    root /your/path/goblog/web
    gzip
    
    rewrite {
        if {path} not_match ^/api
        to {path} {path} /
    }
    proxy /api localhost:20181 {
        websocket
        transparent
    }
}

编译安装

编译

前端

git clone https://gitlab.com/xiayesuifeng/goblog-web.git goblog
cd goblog
npm install
npm run build

后端

go get gitlab.com/xiayesuifeng/goblog
go build -ldflags "-s -w" -trimpath gitlab.com/xiayesuifeng/goblog

配置

cp config.default.json config.json

config.json详解

{
  "mode":"debug",           //调试模式,正式部署改为release
  "name": "goblog",         //个人博客名
  "password": "0925e15d0ae6af196e6295923d76af02b4a3420f",   //登录密码,当前为admin
  "useCategory": true,      //使用分类功能,不使用分类改为false
  "dataDir":"data",         //数据存放路径,当前为goblog运行路径下的data下,用于存储article和图片等
  "database":{              //数据库信息
    "driver":"mysql",       //数据库驱动(支持mysql, portgres, sqlite3, mssql(SQL Server))
    "username":"root",      //数据库用户名
    "password":"",          //数据库密码
    "dbname":"goblog",      //数据库名(需要手动创建)
    "address":"127.0.0.1",  //数据库地址,当前为本地
    "port":"3306"           //数据库端口
  },
  "smtp":{                  //邮箱配置,用于当article有新评论时发送邮件通知(尚未支持,无需配置,敬请期待)
    "username":"",
    "password": "",
    "host": ""
  },
  "tls": {                    // autotls 配置,可不需要任何 web 服务器直接运行并支持 HTTPS (证书自动申请)
    "enable": false,          // 启用 autotls
    "domain": ["example.com"] // 绑定的域名
  }
}

裸奔功能 (无需 web 服务器直接监听80与443,自动申请证书)

  1. 修改配置文件中的 tls 下的 enable 为 true,如
"tls": {
    "enable": true,
    "domain": ["example.com"]
}
  1. 修改 domain 中的 example.con 为你自己的域名(支持绑定多个),如
"tls": {
    "enable": true,
    "domain": ["example1.com","example2.com"]
}
  1. 设置 GOBLOG_WEB_PATH 变量为前端所在路径,然后启动 goblog,如
env GOBLOG_WEB_PATH=./web ./goblog

注:如果需要修改 http 监听端口,可添加 -autotls-use-custom-http-port 启动,然后配合 -p 参数指定想要的端口既可

备份功能 (不支持 SQL Server 数据备份)

为保证数据完整性,请确保 goblog 未在运行,然后使用 -b 参数进行启动,如

./goblog -b

备份文件所在位置将在备份成功后提示

恢复功能 (不支持 SQL Server 数据恢复)

为保证数据完整性,请确保 goblog 未在运行,然后

  1. 确保待恢复的数据库已存在,如不存在请自行去使用如 CREATE DATABASE goblog 这类的去创建
  2. 然后使用 -r + 备份文件路径 参数进行启动,如
./goblog -r data/backup/Backup-GoBlog-20200401214718.zip
  1. 在正式开始恢复前将询问是否使用原备份中的配置文件的 dataDirdatabase 配置,如果不使用请确保 config.json 已配置

恢复成功后既可重新启动 goblog

加密密码生成

echo -n yourpassword | openssl dgst -md5 -binary | openssl dgst -sha1

配合 systemd 使用

[Unit]
Description=GoBlog Service

[Service]
ExecStart=/path/to/goblog -pid-file /tmp/goblog.pid
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/tmp/goblog.pid

[Install]
WantedBy=multi-user.target

License

goblog is licensed under GPLv3.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].