mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-09 16:12:26 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c51055a0db | ||
|
|
445b188517 | ||
|
|
4bfff2e5e9 | ||
|
|
aa91997c0c | ||
|
|
3b2a6689be | ||
|
|
4c46be3f03 | ||
|
|
da47e9880f | ||
|
|
4f92e0d619 | ||
|
|
3a8f7d120b | ||
|
|
cf0a897ad0 | ||
|
|
418b604946 | ||
|
|
b93c320987 | ||
|
|
b24f7c0666 | ||
|
|
efe80fbc6b |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -2,6 +2,25 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [2.1.16](https://github.com/eiblog/eiblog/compare/v2.1.15...v2.1.16) (2022-11-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **backup:** error path in compressed file ([aa91997](https://github.com/eiblog/eiblog/commit/aa91997c0caca27e9979692879f8877765dabd9d))
|
||||||
|
* rss image path incorrect: data-src -> src ([4bfff2e](https://github.com/eiblog/eiblog/commit/4bfff2e5e9b0efb4112a5f2f6bc55eebcef1c6eb))
|
||||||
|
|
||||||
|
### [2.1.15](https://github.com/eiblog/eiblog/compare/v2.1.14...v2.1.15) (2022-09-28)
|
||||||
|
|
||||||
|
### [2.1.14](https://github.com/eiblog/eiblog/compare/v2.1.13...v2.1.14) (2022-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* cgo and sqlite build in alpine image closed [#28](https://github.com/eiblog/eiblog/issues/28) ([b93c320](https://github.com/eiblog/eiblog/commit/b93c320987a936db6e5ca50c547022de9ab9a0f1))
|
||||||
|
|
||||||
|
### [2.1.13](https://github.com/eiblog/eiblog/compare/v2.1.12...v2.1.13) (2022-09-27)
|
||||||
|
|
||||||
### [2.1.12](https://github.com/eiblog/eiblog/compare/v2.1.11...v2.1.12) (2022-08-09)
|
### [2.1.12](https://github.com/eiblog/eiblog/compare/v2.1.11...v2.1.12) (2022-08-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
74
README.md
74
README.md
@@ -6,9 +6,43 @@
|
|||||||
|
|
||||||
但它有着部署简单(上线复杂!)的特点,不推荐没有计算机知识的朋友搭建,欢迎咨询。该博客的个中优点(简洁、轻快,安全),等你体验。
|
但它有着部署简单(上线复杂!)的特点,不推荐没有计算机知识的朋友搭建,欢迎咨询。该博客的个中优点(简洁、轻快,安全),等你体验。
|
||||||
|
|
||||||
|
Docker镜像地址:
|
||||||
|
|
||||||
|
* 博客服务:[deepzz0/eiblog](https://hub.docker.com/r/deepzz0/eiblog)
|
||||||
|
* 博客搜索:[deepzz0/elasticsearch](https://hub.docker.com/r/deepzz0/elasticsearch)
|
||||||
|
* 数据备份:[deepzz0/backup](https://hub.docker.com/r/deepzz0/backup)
|
||||||
|
|
||||||
### 快速体验
|
### 快速体验
|
||||||
|
|
||||||
这里以 mongodb 为例,更多支持的后端存储服务如下:
|
**二进制**
|
||||||
|
|
||||||
|
1、下载压缩包,到 [这里](https://github.com/eiblog/eiblog/releases) 下载 eiblog(非backup) 相应系统压缩包,然后解压缩。
|
||||||
|
|
||||||
|
2、启动服务:`./backend`
|
||||||
|
|
||||||
|
**Docker**
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker run --name eiblog \
|
||||||
|
-p 9000:9000 \
|
||||||
|
deepzz0/eiblog:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
**Compose**
|
||||||
|
|
||||||
|
参考项目根目录下的 [docker-compose.yml](https://github.com/eiblog/eiblog/blob/v2/docker-compose.yml),修改相关配置:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker compose up -d
|
||||||
|
或
|
||||||
|
$ docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
然后访问 `localhost:9000` 就可以了,后台地址 `localhost:9000/admin/login`,默认账户密码 `deepzz/deepzz`。
|
||||||
|
|
||||||
|
> 默认情况下未开启博客搜索 `elasticsearch`,需要的话需要启动 es 服务并修改配置 `app.yml`。
|
||||||
|
|
||||||
|
**数据库支持**
|
||||||
|
|
||||||
| 类型(driver) | 地址(source)示例 |
|
| 类型(driver) | 地址(source)示例 |
|
||||||
| -------------- | ------------------------------------------------------------ |
|
| -------------- | ------------------------------------------------------------ |
|
||||||
@@ -19,42 +53,6 @@
|
|||||||
| sqlserver | sqlserver://user:password@localhost:9930?database=eiblog |
|
| sqlserver | sqlserver://user:password@localhost:9930?database=eiblog |
|
||||||
| clickhouse | tcp://localhost:9000?database=eiblog&username=user&password=password&read_timeout=10&write_timeout=20 |
|
| clickhouse | tcp://localhost:9000?database=eiblog&username=user&password=password&read_timeout=10&write_timeout=20 |
|
||||||
|
|
||||||
1、启动依赖服务,mongodb、elasticsearch:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ docker run --name mongodb \
|
|
||||||
-p 27017:27017 \
|
|
||||||
-v ${PWD}/mgodb:/data/db \
|
|
||||||
mongo:3.2
|
|
||||||
|
|
||||||
$ docker run --name elasticsearch \
|
|
||||||
-p 9200:9200 \
|
|
||||||
-v ${PWD}/esdata:/usr/share/elasticsearch/data \
|
|
||||||
deepzz0/elasticsearch:2.4.1
|
|
||||||
```
|
|
||||||
|
|
||||||
2、下载压缩包,到 [这里](https://github.com/eiblog/eiblog/releases) 下载 eiblog(非backup) 相应系统压缩包,然后解压缩。
|
|
||||||
|
|
||||||
3、修改配置,将数据库与ES地址修改为相应地址:
|
|
||||||
|
|
||||||
```
|
|
||||||
# 修改 conf/app.yml 数据库连接配置
|
|
||||||
database:
|
|
||||||
driver: mongodb
|
|
||||||
source: mongodb://localhost:27017
|
|
||||||
|
|
||||||
# 修改 conf/app.yml ES连接配置,如果不启用搜索功能可以置空
|
|
||||||
eshost: http://localhost:9200
|
|
||||||
```
|
|
||||||
|
|
||||||
4、启动服务:
|
|
||||||
|
|
||||||
```
|
|
||||||
./backend
|
|
||||||
```
|
|
||||||
|
|
||||||
然后访问 `localhost:9000` 就可以了,后台地址 `localhost:9000/admin/login`,默认账户密码 `deepzz/deepzz`。
|
|
||||||
|
|
||||||
### 功能特性
|
### 功能特性
|
||||||
|
|
||||||
本着博客本质用来分享知识的特点,`EiBlog` 不会有较强的定制功能(包括主题,CDN支持等),仅保持常用简单页面与功能:
|
本着博客本质用来分享知识的特点,`EiBlog` 不会有较强的定制功能(包括主题,CDN支持等),仅保持常用简单页面与功能:
|
||||||
@@ -85,7 +83,7 @@ eshost: http://localhost:9200
|
|||||||
|
|
||||||
### 博客页面
|
### 博客页面
|
||||||
|
|
||||||
可以容易的看到 [httpsecurityreport](https://httpsecurityreport.com/?report=deepzz.com) 评分`96`,[ssllabs](https://www.ssllabs.com/ssltest/analyze.html?d=deepzz.com&latest) 评分`A+`,[myssl](https://myssl.com/deepzz.com) 评分`A+`,堪称完美。这些安全的相关配置会在后面的部署过程中接触到。
|
可以容易的看到 [ssllabs](https://www.ssllabs.com/ssltest/analyze.html?d=deepzz.com&latest) 评分`A+`,[myssl](https://myssl.com/deepzz.com) 评分`A+`,堪称完美。这些安全的相关配置会在后面的部署过程中接触到。
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
appname: eiblog
|
appname: eiblog
|
||||||
database:
|
database:
|
||||||
driver: postgres
|
driver: sqlite
|
||||||
source: host=localhost port=5432 user=postgres dbname=eiblog sslmode=disable password=MTI3LjAuMC4x
|
source: ./db.sqlite
|
||||||
eshost:
|
eshost:
|
||||||
eiblogapp:
|
eiblogapp:
|
||||||
mode:
|
mode:
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ services:
|
|||||||
- elasticsearch
|
- elasticsearch
|
||||||
- mongodb
|
- mongodb
|
||||||
environment:
|
environment:
|
||||||
- GODEBUG=netdns=cgo
|
|
||||||
- RUN_MODE=prod
|
- RUN_MODE=prod
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:9000:9000
|
- 127.0.0.1:9000:9000
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func backupFromMongoDB(now time.Time) error {
|
|||||||
}
|
}
|
||||||
// tar
|
// tar
|
||||||
name := fmt.Sprintf("eiblog-%s.tar.gz", now.Format("2006-01-02"))
|
name := fmt.Sprintf("eiblog-%s.tar.gz", now.Format("2006-01-02"))
|
||||||
arg = fmt.Sprintf("tar czf /tmp/%s /tmp/eiblog", name)
|
arg = fmt.Sprintf("tar czf /tmp/%s -C /tmp eiblog", name)
|
||||||
cmd = exec.CommandContext(ctx, "sh", "-c", arg)
|
cmd = exec.CommandContext(ctx, "sh", "-c", arg)
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ func init() {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
xmlTmpl, err = template.New("").Funcs(template.FuncMap{
|
xmlTmpl, err = template.New("").Funcs(template.FuncMap{
|
||||||
"dateformat": tools.DateFormat,
|
"dateformat": tools.DateFormat,
|
||||||
|
"imgtonormal": tools.ImgToNormal,
|
||||||
}).ParseGlob(root)
|
}).ParseGlob(root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ for file in pkg/core/*; do
|
|||||||
# tar platform
|
# tar platform
|
||||||
for os in linux darwin windows; do
|
for os in linux darwin windows; do
|
||||||
_target="$app-$_tag.$os-$_arch.tar.gz"
|
_target="$app-$_tag.$os-$_arch.tar.gz"
|
||||||
CGO_ENABLED=0 GOOS=$os GOARCH=$_arch \
|
GOOS=$os GOARCH=$_arch \
|
||||||
go build -tags prod -o backend "./cmd/$app"
|
go build -tags prod -ldflags '-extldflags "-static"' -o backend "./cmd/$app"
|
||||||
if [ "$app" = "eiblog" ]; then
|
if [ "$app" = "eiblog" ]; then
|
||||||
tar czf $_target conf website assets backend
|
tar czf $_target conf website assets backend
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ mkdir -p ./bin
|
|||||||
# build demo app
|
# build demo app
|
||||||
for file in pkg/core/*; do
|
for file in pkg/core/*; do
|
||||||
app="$(basename $file)";
|
app="$(basename $file)";
|
||||||
CGO_ENABLED=0 go build -tags prod -o bin/backend "./cmd/$app"
|
go build -tags prod -ldflags '-extldflags "-static"' -o bin/backend "./cmd/$app"
|
||||||
# docker image
|
# docker image
|
||||||
docker buildx build --platform "$_platform" \
|
docker buildx build --platform "$_platform" \
|
||||||
-f "build/package/$app.Dockerfile" \
|
-f "build/package/$app.Dockerfile" \
|
||||||
|
|||||||
@@ -73,3 +73,8 @@ func GetAvatar(domain string) string {
|
|||||||
|
|
||||||
return avatar
|
return avatar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ImgToNormal replace lazy image attr data-src to src
|
||||||
|
func ImgToNormal(content string) string {
|
||||||
|
return strings.ReplaceAll(content, "data-src=", "src=")
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<comments>https://{{$.Host}}/post/{{.Slug}}.html#comments</comments>
|
<comments>https://{{$.Host}}/post/{{.Slug}}.html#comments</comments>
|
||||||
<guid>https://{{$.Host}}/post/{{.Slug}}.html</guid>
|
<guid>https://{{$.Host}}/post/{{.Slug}}.html</guid>
|
||||||
<description>
|
<description>
|
||||||
<![CDATA[<blockquote>{{.Content}}<p>本文链接:<a href="https://{{$.Host}}/post/{{.Slug}}.html">https://{{$.Host}}/post/{{.Slug}}.html</a>,<a href="https://{{$.Host}}/post/{{.Slug}}.html#comments">参与评论 »</a></p>]]>
|
<![CDATA[{{imgtonormal .Content}}<p>本文链接:<a href="https://{{$.Host}}/post/{{.Slug}}.html">https://{{$.Host}}/post/{{.Slug}}.html</a>,<a href="https://{{$.Host}}/post/{{.Slug}}.html#comments">参与评论 »</a></p>]]>
|
||||||
</description>
|
</description>
|
||||||
<pubDate>{{dateformat .CreatedAt "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>
|
<pubDate>{{dateformat .CreatedAt "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user