All Projects → sinksmell → Lanblog

sinksmell / Lanblog

Licence: mit
懒人博客,前后端分离,Vue+Beego Restful api 开箱即用,部署简单,后台管理系统简洁美观。好了,我编不下去了🤣

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Lanblog

Blogbackendproject
Backend code for my blogs, develop with Django Rest framework.
Stars: ✭ 204 (-3.77%)
Mutual labels:  restful, blog
Nodepress
😎 RESTful API service for Blog/CMS, powered by @nestjs
Stars: ✭ 829 (+291.04%)
Mutual labels:  restful, blog
Surmon.me
🆒 My personal website and blog, powered by @vuejs (3)
Stars: ✭ 1,767 (+733.49%)
Mutual labels:  restful, blog
Gridea Theme Chic
这个主题出自Hexo中的-Chic....我移植到了Gridea,喜欢的点个赞吧👍
Stars: ✭ 196 (-7.55%)
Mutual labels:  blog
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (-6.6%)
Mutual labels:  blog
Blog
📝 My blog / notes
Stars: ✭ 204 (-3.77%)
Mutual labels:  blog
Hugo Ink
Crisp, minimal personal website and blog theme for Hugo
Stars: ✭ 209 (-1.42%)
Mutual labels:  blog
Mxisd
Federated Matrix Identity Server
Stars: ✭ 194 (-8.49%)
Mutual labels:  restful
Typecho Theme Paul
🎈 一个适用于展示,写日记的 Typecho 博客主题。
Stars: ✭ 206 (-2.83%)
Mutual labels:  blog
Rust Blog
Educational blog posts for Rust beginners
Stars: ✭ 3,917 (+1747.64%)
Mutual labels:  blog
Liteblog
轻博客
Stars: ✭ 204 (-3.77%)
Mutual labels:  blog
My blog
My Django Blog
Stars: ✭ 198 (-6.6%)
Mutual labels:  blog
Blog Frontend Project
Web frontend code for my blogs, develop with Vue.
Stars: ✭ 206 (-2.83%)
Mutual labels:  blog
Slimcms
SlimCMS - lightweight CMS based on slim 3 framework
Stars: ✭ 201 (-5.19%)
Mutual labels:  blog
Typecho Theme Nexmoe
🔥 一个特别的 Typecho 主题
Stars: ✭ 196 (-7.55%)
Mutual labels:  blog
Vue Blog
🎉 基于vue全家桶 + element-ui 构建的一个后台管理集成解决方案
Stars: ✭ 208 (-1.89%)
Mutual labels:  blog
Micro Server Own
基于SpringCloud 的微服务,订单,支付,商场(活动),工作流,用户,短信,极光
Stars: ✭ 195 (-8.02%)
Mutual labels:  restful
Simplystats
Simply Statistics
Stars: ✭ 201 (-5.19%)
Mutual labels:  blog
My Blog Layui
layui 版本的 My-Blog : A simple & beautiful blogging system implemented with spring-boot & layui & thymeleaf & mybatis My Blog 是由 SpringBoot + Layui + Mybatis + Thymeleaf 等技术实现的 Java 博客系统,页面美观、功能齐全、部署简单及完善的代码,一定会给使用者无与伦比的体验
Stars: ✭ 204 (-3.77%)
Mutual labels:  blog
Openlivewriter
An open source fork of Windows Live Writer
Stars: ✭ 2,398 (+1031.13%)
Mutual labels:  blog

LanBlog 一站式个人博客解决方案

Go Report Card GoDoc Build Status Build Status

感谢以下开源项目作者及参与者的无私奉献

技术栈

Vue.js + axios(ajax) + Beego Restful api + Mysql + Nginx 目前已经进行初步容器化,可在 k8s 集群上快速部署 Snip20191012_5.png

项目介绍

效果图

  • 首页

  • 侧边栏

  • 阅读界面

  • 后台登录界面

  • 后台管理界面

安装&使用

  • 以Ubuntu为例
  • 必须要有能正常工作,拉取镜像的 k8s 集群

快速部署

  • 首先需要一个可以工作的 k8s 集群
  • Mysql 默认密码是 sinksmell
  • 后台管理账号和密码均是 sinksmell
  • 配置文件在 conf/app.conf 里面可以修改登录密码,但是要重新编译镜像,在yaml文件中替换镜像版本
# 1. 克隆项目
	cd /home
	git clone   https://github.com/sinksmell/lanblog.git
# 2. 进入项目根目录
	cd /home/lanblog

1. 部署mysql服务

ls
build  conf  controllers  front  go.mod  go.sum  LICENSE  main.go  makefile  models  README.md  routers  sql  swagger  vendor
-f build/mysql/lanblog-mysql.yaml
service/lanblog-mysql created
persistentvolumeclaim/mysql-pv-claim created
deployment.apps/lanblog-mysql created
persistentvolume/local-pv-1 created
[email protected]:/home/lanblog# kubectl get svc
NAME            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
kubernetes      ClusterIP   10.152.183.1   <none>        443/TCP    24h
lanblog-mysql   ClusterIP   None           <none>        3306/TCP   53s
[email protected]:/home/lanblog# kubectl get po
NAME                            READY   STATUS    RESTARTS   AGE
lanblog-mysql-bfb7c765f-hkd5n   1/1     Running   0          2m19s
[email protected]:/home/lanblog#

# 进入Mysql pod 内创建数据库 myblog

[email protected]:/home/lanblog# kubectl get po
NAME                               READY   STATUS    RESTARTS   AGE
lanblog-backend-6d86579456-zqvtg   1/1     Running   0          3m24s
lanblog-mysql-bfb7c765f-hkd5n      1/1     Running   0          9m3s
exec -it lanblog-mysql-bfb7c765f-hkd5n /bin/bash
-u root -p
# 默认密码 sinksmell
mysql> CREATE DATABASE `myblog` CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql>

# exit 退出容器

至此MySQL服务成功部署!

2. 部署backend

ls
build  conf  controllers  front  go.mod  go.sum  LICENSE  main.go  makefile  models  README.md  routers  sql  swagger  vendor
-f build/lanblog/lanblog.yaml
deployment.apps/lanblog-backend created
service/lanblog-backend created
[email protected]:/home/lanblog# kubectl get po
NAME                               READY   STATUS    RESTARTS   AGE
lanblog-backend-6d86579456-zqvtg   1/1     Running   0          10s
lanblog-mysql-bfb7c765f-hkd5n      1/1     Running   0          5m49s
[email protected]:/home/lanblog#
# 测试一下 能否正常访问
# ps 在node上要通过clusterIp来访问service
# 在pod里可以直接通过 service name
-v http://10.152.183.204:8088/v1/category/list
*   Trying 10.152.183.204...
* TCP_NODELAY set
* Connected to 10.152.183.204 (10.152.183.204) port 8088 (#0)
> GET /v1/category/list HTTP/1.1
> Host: 10.152.183.204:8088
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: Origin,Authorization,Access-Control-Allow-Origin,Access-Control-Allow-Headers,Content-Type
< Access-Control-Allow-Methods: GET,POST,OPTIONS
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: Content-Length,Access-Control-Allow-Origin,Access-Control-Allow-Headers,Content-Type
< Content-Length: 4
< Content-Type: application/json; charset=utf-8
< Server: beegoServer:1.12.0
< Date: Sat, 12 Oct 2019 06:52:47 GMT
<
* Connection #0 to host 10.152.183.204 left intact
# 正常访问

3. 部署gateway

ls
build  conf  controllers  front  go.mod  go.sum  LICENSE  main.go  makefile  models  README.md  routers  sql  swagger  vendor
-f build/gateway/lanblog-gateway.yaml
deployment.apps/lanblog-gateway created
service/gateway created
[email protected]:/home/lanblog# kubectl get svc
NAME              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)           AGE
gateway           ClusterIP   10.152.183.118   <none>        80/TCP,9090/TCP   7s
kubernetes        ClusterIP   10.152.183.1     <none>        443/TCP           24h
lanblog-backend   ClusterIP   10.152.183.204   <none>        8088/TCP          15m
lanblog-mysql     ClusterIP   None             <none>        3306/TCP          21m
[email protected]:/home/lanblog# kubectl get po
NAME                               READY   STATUS    RESTARTS   AGE
lanblog-backend-6d86579456-zqvtg   1/1     Running   0          15m
lanblog-gateway-bc89c665c-k4lfr    1/1     Running   0          19s
lanblog-mysql-bfb7c765f-hkd5n      1/1     Running   0          21m


# 判断gateway是否工作正常
-v http://10.152.183.118:80
* Rebuilt URL to: http://10.152.183.118:80/
*   Trying 10.152.183.118...
* TCP_NODELAY set
* Connected to 10.152.183.118 (10.152.183.118) port 80 (#0)
> GET / HTTP/1.1
> Host: 10.152.183.118
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.17.4
< Date: Sat, 12 Oct 2019 07:05:58 GMT
< Content-Type: text/html
< Content-Length: 22270
< Last-Modified: Sat, 12 Oct 2019 06:34:31 GMT
< Connection: keep-alive

4. 向外暴露服务

  • 借助nginx向外暴露服务,需要事先安装 nginx 和 80,9090 两个端口

  • 安装的Nginx有一个默认的Server 占用了 80 端口 手动删除

# 删除默认server
rm /etc/nginx/sites-enabled/default

# 拷贝lanblog.conf到 /etc/nginx/conf.d
 cp front/lanblog.conf /etc/nginx/conf.d/lanblog.conf
# 查看gateway服务的clusterIP 本例中是 10.152.183.118
kubectl  get svc
# 修改 /etc/nginx/conf.d/lanblog.conf 中的 proxy_pass 将 ip 替换为 上述ip
# 以下是修改后的结果
server {
    listen 80;
    server_name localhost;
    # access_log /root/blog.log  main;

    location / {
       proxy_pass http://10.152.183.118:80/ ;
    }
}

server {
    listen 9090;
    server_name localhost;
    # access_log /root/blog.log  main;

    location / {
       proxy_pass http://10.152.183.118:9090/ ;
    }

}

# 重新加载配置文件
nginx -s reload

5. 访问博客

1. 输入IP访问博客界面
2. 输入IP:9090访问后台管理界面

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].