# flygoose-api
**Repository Path**: small-universe/flygoose-api
## Basic Information
- **Project Name**: flygoose-api
- **Description**: 飞鸽博客后端,使用Go+Iris进行构建
- **Primary Language**: Go
- **License**: Not specified
- **Default Branch**: dev
- **Homepage**: http://www.dreamagain.top
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-08-26
- **Last Updated**: 2024-09-18
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
UKnow博客服务端
## 简介
此项目 fork 自[飞鸽博客 flygoose-api](https://github.com/helloworld-Co/flygoose-api) 并进行了二次开发,跟原项目差异较大,仅供学习参考
该项目使用 Go 语言开发的,本地运行需要安装 Go 语言环境,这里推荐一个 SDK 多版本管理工具 [vfox](https://vfox.lhan.me/zh-hans/) ,可以轻松切换 Go 版本
其他相关的两个前后台项目:
1. 博客前台:[https://github.com/small-universe/flygoose-blog](https://github.com/small-universe/flygoose-blog)
2. 博客后台:[https://github.com/small-universe/flygoose-blog-admin](https://github.com/small-universe/flygoose-blog-admin)
## 技术栈
1. 编程语言:Go 1.22+
2. Web框架:[Iris](https://www.iris-go.com/)
3. 数据库:MySQL 8.0+、SQLite3、PostgreSQL 三选一
4. 部署工具:Docker、Docker-Compose
## 开发计划
- [x] 支持 SQLite 数据库
- [x] 支持 Docker 部署
- [ ] 博客后台,文章中图片上传功能不可用(考虑更换组件)
- [ ] 文章导入导出功能
- [ ] 博客备份功能
- [ ] 评论功能
## IDE中运行
### 克隆项目
```bash
git clone https://github.com/small-universe/flygoose-api.git
# 或
git clone https://gitee.com/small-universe/flygoose-api.git
```
### 安装依赖
进入到根目录下执行如下命令
```bash
go mod tidy
```
### 运行
本地IDE(推荐使用Goland)中运行,执行如下命令
```bash
go run main.go
```
服务启动成功,将在控制台看到如下信息
```text
Iris Version: 12.2.11
Now listening on:
> Network: http://172.23.224.1:29090
> Network: http://192.168.160.1:29090
> Network: http://192.168.2.113:29090
> Local: http://localhost:29090
Application started. Press CTRL+C to shut down.
```
## 博客效果展示
接着去下载博客前端和后台的代码,参照各自的 `README.md` 文档进行启动
博客前台,[https://github.com/small-universe/flygoose-blog](https://github.com/small-universe/flygoose-blog)
博客后台,[https://github.com/small-universe/flygoose-blog-admin](https://github.com/small-universe/flygoose-blog-admin)
如果顺利的话,你应该能考到如下的效果:
| 博客首页 | 博客后台 |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
|  |  |
| 文章 | 专栏 |
|  |  |
## Docker 部署
在执行如下步骤之前,请先安装 `docker-compose`,如果是 Windows 用户,安装 `docker-desktop` 即可
安装教程可参考:[Windows安装Docker Desktop,详细步骤](https://juejin.cn/post/7404858270509121588)
### 启动 flygoose-api
使用 `docker-compose` 在本地启动应用,执行如下命令
```bash
cd ./docker
docker-compose -f docker-compose.yaml up -d
```
整个博客项目的 Docker 部署请移步:[https://gitee.com/small-universe/docker-compose-deploy/tree/master/flygoose](https://gitee.com/small-universe/docker-compose-deploy/tree/master/flygoose)
### Docker 镜像上传
1. 上传阿里云容器镜像服务
```shell
docker login --username=[阿里云账号] crpi-tt09nizgy20ynr8y.cn-shenzhen.personal.cr.aliyuncs.com
docker tag [ImageId] crpi-tt09nizgy20ynr8y.cn-shenzhen.personal.cr.aliyuncs.com/small-universe/flygoose-api:[镜像版本号]
docker push crpi-tt09nizgy20ynr8y.cn-shenzhen.personal.cr.aliyuncs.com/small-universe/flygoose-api:[镜像版本号]
```
当前制作的最新版本镜像为 `v1`,可以直接使用
```shell
docker pull crpi-tt09nizgy20ynr8y.cn-shenzhen.personal.cr.aliyuncs.com/small-universe/flygoose-api:v1
```
## 原生部署
可以参考飞鸽官方文档:[飞鹅博客如何部署](https://www.helloworld.net/p/4790426995)