Giter Site home page Giter Site logo

vicanso / tiny-site Goto Github PK

View Code? Open in Web Editor NEW
72.0 5.0 18.0 4.6 MB

图片优化

Home Page: https://tiny.npmtrend.com/

License: Apache License 2.0

Dockerfile 0.18% Makefile 0.14% Go 65.02% HTML 0.06% JavaScript 3.36% Shell 0.08% TypeScript 31.07% CSS 0.09%
optimization image tiny png jpeg webp elton resize-images crop-image avif

tiny-site's Introduction

tiny-site

Build Status

基于elton的脚手架,实现了数据校验、行为统计等功能。

特性

简单的应用配置

  • 应用配置通过加载default.yml + 当前GO_ENV所对应的yml组合生成,简化配置
  • 支持配置参数的校验,保证应用启动时的参数准确性
  • 支持优先从ENV中获取配置参数,若获取失败再使用yml配置

多类缓存模块

缓存模块支持三类缓存:LRU+TTL的高速缓存,redis+ttl的共有缓存以及redis+lru+ttl的多级缓存

// redis缓存中简化的struct读取与保存
err := cache.GetRedisCache().SetStruct(context.Background(), "key", &map[string]string{
  "name": "my name",
}, time.Minute)
data := make(map[string]string)
err = cache.GetRedisCache().GetStruct(context.Background(), "key", &data)

支持多类自定义配置

  • 黑名单IP配置,允许设置黑名单IP禁止访问
  • 路由Mock配置,允许自定义路由的响应
  • 路由并发配置,允许限制路由的最大并发数及访问频率
  • Session拦截配置,允许将session的读取拦截,返回出错信息,用于系统禁止客户使用

详尽的性能指标

性能指标中包括以下的相关指标:

  • goMaxProcs 程序使用的最大CPU数量
  • threadCount 程序当前线程数
  • memSys 系统申请内存
  • memHeapSys 系统申请heap
  • memHeapInuse 使用中的heap
  • memFrees heap对象释放的数量
  • routineCount goroutine的数量
  • cpuUsage CPU使用率
  • lastGC 上一次GC的时间
  • numGC GC的次数
  • recentPause 最近一次GC暂停的时长
  • pauseTotal GC暂停的总时长
  • connProcessing 当前处理中的连接数(http.Server)
  • connProcessedCount 处理过的连接总数
  • connAlive 当前活跃的连接数
  • connCreatedCount 被创建的连接总数
  • concurrency 请求并发数
  • requestProcessedTotal 处理过的请求总数

Redis

redis模块记录了当前并发请求以及pipeline请求量,可以设置最大并发请求量,提供简单的熔断处理。

entc

编译schema对应代码

make install && make generate

commit

feat:新功能(feature)

fix:修补bug

docs:文档(documentation)

style: 格式(不影响代码运行的变动)

refactor:重构(即不是新增功能,也不是修改bug的代码变动)

test:增加测试

chore:构建过程或辅助工具的变动

启动数据库

postgres

docker pull postgres:alpine

docker run -d --restart=always \
  -v $PWD/tiny-site:/var/lib/postgresql/data \
  -e POSTGRES_PASSWORD=A123456 \
  -p 5432:5432 \
  --name=tiny-db \
  postgres:alpine

docker exec -it tiny-db sh

psql -c "CREATE DATABASE tiny;" -U postgres
psql -c "CREATE USER vicanso WITH PASSWORD 'A123456';" -U postgres
psql -c "GRANT ALL PRIVILEGES ON DATABASE tiny to vicanso;" -U postgres

redis

docker pull redis:alpine

docker run -d --restart=always \
  -p 6379:6379 \
  --name=redis \
  redis:alpine

规范

  • 所有自定义的error都必须为hes.Error
  • 数值类的展示需要使用专用组件
  • 用户点击类的操作需要使用专用组件

常见问题

  • esbuild提示未成功安装,执行node node_modules/esbuild/install.js

tiny-site's People

Contributors

dependabot[bot] avatar vicanso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tiny-site's Issues

middleware session 问题

middleware 目录下的 session 程序好像有错误.

middleware/session.go:39:3: unknown field 'CookieKeys' in struct literal of type session.Options
middleware/session.go:40:3: unknown field 'CookieMaxAge' in struct literal of type session.Options
middleware/session.go:41:3: unknown field 'CookiePath' in struct literal of type session.Options
middleware/session.go:46:22: too many arguments in call to session.New
have (*http.Request, "github.com/kataras/iris/context".ResponseWriter, *session.Options)
want (cookies.ReadWriter, *session.Options)
middleware/static_serve.go:150:9: assignment mismatch: 2 variables but 1 values

请问这个错误跟iris版本有关系吗?

用dep装完又有报错,请问怎么继续了?

github.com/vicanso/tiny-site/vendor/github.com/kataras/iris/view

vendor/github.com/kataras/iris/view/django.go:225:27: pongo2.RegisterTag(tagName, fn) used as value
vendor/github.com/kataras/iris/view/django.go:253:19: undefined: pongo2.NewLocalFileSystemLoader
vendor/github.com/kataras/iris/view/django.go:258:22: too many arguments in call to pongo2.NewSet
vendor/github.com/kataras/iris/view/django.go:311:22: too many arguments in call to pongo2.NewSet
have (string, *tDjangoAssetLoader)
want (string)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.