调整 Docker 容器相关的部分配置
This commit is contained in:
parent
964612c5d8
commit
a696933aa6
10
README.md
10
README.md
|
|
@ -24,7 +24,7 @@ RepoStats 致力于解决的痛点问题是:
|
|||
|
||||
### 1. 使用 Docker 环境
|
||||
启动 Docker 镜像前请注意查看 `docker/vars.env` 文件,并根据自己的实际情况调整需要的参数(eg:本地端口号等)。启动 `docker/start_docker_repostats.sh` 可以通过 Docker 环境将所有依赖安装并启动。该命令将:
|
||||
1. 拉取 [repostats-app](https://hub.docker.com/r/baratsemet/repostats-app) 镜像(本地构建可查看 `docker/repostats.Dockerfile` 文件)
|
||||
1. 拉取 [repostats](https://hub.docker.com/r/baratsemet/repostats) 镜像(本地构建可查看 `docker/repostats.Dockerfile` 文件)
|
||||
1. 通过 `docker/pull_build.yml` 其他描述内容构建 `Grafana` 和 `PostgreSQL` 镜像及服务,并对其运行状态做判断,再启动其他必要服务 (本地构建镜像请查阅 `local_build.yml`)
|
||||
1. 构建名为 `network_repostats` 的虚拟网络供上述服务使用
|
||||
1. 开启本机 `9103` 端口应对 RepoStats 工具、启动 `13000` 端口应对 Grafana 工具,启动 `15432` 应对 PostgreSQL 数据库
|
||||
|
|
@ -142,10 +142,10 @@ Pull Request 总数、Pull Request 人数、打开状态的 Pull Request 总数
|
|||
- Issue 趋势图
|
||||
指定时间范围内,新增 Issue 数的变化趋势
|
||||
|
||||
- Pull Request 趋势图
|
||||
- Pull Request 趋势图
|
||||
指定时间范围内,新增 Pull Request 数的变化趋势
|
||||
|
||||
- Pull Request 合并时间分析
|
||||
- Pull Request 合并时间分析
|
||||
指定时间范围内,`可合并的` Pull Request 从 `created_at` 到 `merged_at` 的最小耗时、平均耗时、最大耗时,单位:小时
|
||||
|
||||
- Issue 处理时间分析
|
||||
|
|
@ -161,10 +161,10 @@ Pull Request 总数、Pull Request 人数、打开状态的 Pull Request 总数
|
|||
- Commit 列表
|
||||
Commit 明细列表
|
||||
|
||||
- Issue 列表
|
||||
- Issue 列表
|
||||
Issue 明细列表
|
||||
|
||||
- Pull Request 列表
|
||||
- Pull Request 列表
|
||||
Pull Request 明细列表
|
||||
|
||||
- Commit Author 排行
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ version: '3'
|
|||
services:
|
||||
|
||||
repostats:
|
||||
image: baratsemet/repostats-app:${REPOSTATS_VERSION}
|
||||
image: baratsemet/repostats:${REPOSTATS_VERSION}
|
||||
container_name: ${REPOSTATS_CONTAINER_NAME}
|
||||
hostname: repostats
|
||||
build:
|
||||
|
|
@ -10,6 +10,7 @@ services:
|
|||
dockerfile: docker/repostats.Dockerfile
|
||||
volumes:
|
||||
- ../docker/docker_repostats.ini:/app/repostats.ini
|
||||
- ../docker/container-data/repostats:/root/.repostats
|
||||
ports:
|
||||
- ${REPOSTATS_LOCAL_PORT}:9103
|
||||
networks:
|
||||
|
|
@ -37,8 +38,8 @@ services:
|
|||
healthcheck:
|
||||
test: [ "CMD", "psql", "-U","${PG_SUPER_USER}","-d","repostats" ]
|
||||
timeout: 10s
|
||||
interval: 3s
|
||||
retries: 10
|
||||
interval: 5s
|
||||
retries: 20
|
||||
networks:
|
||||
- network_repostats
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ version: '3'
|
|||
services:
|
||||
|
||||
repostats:
|
||||
image: baratsemet/repostats-app:${REPOSTATS_VERSION}
|
||||
image: baratsemet/repostats:${REPOSTATS_VERSION}
|
||||
container_name: ${REPOSTATS_CONTAINER_NAME}
|
||||
hostname: repostats
|
||||
volumes:
|
||||
- ../docker/docker_repostats.ini:/app/repostats.ini
|
||||
- ../docker/container-data/repostats:/root/.repostats
|
||||
ports:
|
||||
- ${REPOSTATS_LOCAL_PORT}:9103
|
||||
networks:
|
||||
|
|
@ -34,8 +35,8 @@ services:
|
|||
healthcheck:
|
||||
test: [ "CMD", "psql", "-U","${PG_SUPER_USER}","-d","repostats" ]
|
||||
timeout: 10s
|
||||
interval: 3s
|
||||
retries: 10
|
||||
interval: 5s
|
||||
retries: 20
|
||||
networks:
|
||||
- network_repostats
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
docker-compose -p repostats -f dependances.yml --env-file vars.env up -d --build --force-recreate
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
docker-compose -p repostats -f dependances.yml --env-file vars.env down
|
||||
1
go.mod
1
go.mod
|
|
@ -17,6 +17,7 @@ require (
|
|||
github.com/lib/pq v1.10.5
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/remeh/sizedwaitgroup v1.0.0
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
gopkg.in/guregu/null.v4 v4.0.0
|
||||
gopkg.in/ini.v1 v1.66.4
|
||||
)
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -95,6 +95,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||
golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM=
|
||||
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
|
|||
20
repostats.go
20
repostats.go
|
|
@ -18,11 +18,13 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"repostats/controller"
|
||||
"repostats/schedule"
|
||||
"repostats/storage"
|
||||
"repostats/utils"
|
||||
|
||||
"github.com/Masterminds/sprig"
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -30,6 +32,8 @@ var (
|
|||
FS embed.FS
|
||||
|
||||
cmdConfig string
|
||||
|
||||
group errgroup.Group
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -56,8 +60,18 @@ func main() {
|
|||
|
||||
initRouter(router)
|
||||
|
||||
log.Println(fmt.Sprintf("[RepoStats v%s build:%s] starts at http://localhost:%d", utils.Version, utils.Build, utils.RepoStatsConfig.AdminPort))
|
||||
router.Run(fmt.Sprintf(":%d", utils.RepoStatsConfig.AdminPort))
|
||||
group.Go(func() error {
|
||||
log.Println(fmt.Sprintf("[RepoStats v%s build:%s] starts at http://localhost:%d", utils.Version, utils.Build, utils.RepoStatsConfig.AdminPort))
|
||||
return router.Run(fmt.Sprintf(":%d", utils.RepoStatsConfig.AdminPort))
|
||||
})
|
||||
|
||||
group.Go(func() error {
|
||||
log.Println(fmt.Sprintf("[RepoStats v%s build:%s] schedule started. ", utils.Version, utils.Build))
|
||||
return schedule.StartGiteeSchedule()
|
||||
})
|
||||
|
||||
err = group.Wait()
|
||||
utils.ExitOnError(err)
|
||||
}
|
||||
|
||||
func initRouter(router *gin.Engine) {
|
||||
|
|
@ -97,7 +111,7 @@ func initRouter(router *gin.Engine) {
|
|||
|
||||
admin.GET("/issues", controller.IssuesPage)
|
||||
|
||||
public := router.Group("/admin") //Same url path with /admin WITHOUT auth handler
|
||||
public := router.Group("/admin") //Same url path WITHOUT admin auth handler
|
||||
public.POST("/gitee/token", controller.GiteeTokenRetrieve)
|
||||
|
||||
router.SetHTMLTemplate(tmpl)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
-- Database Structure For RepoStats
|
||||
CREATE DATABASE repostats ENCODING 'UTF8';
|
||||
|
||||
\c repostats
|
||||
|
||||
CREATE TABLE public.users (
|
||||
id serial4 NOT NULL,
|
||||
account varchar(200) NOT NULL,
|
||||
password text NOT NULL,
|
||||
CONSTRAINT users_pk PRIMARY KEY (id),
|
||||
CONSTRAINT users_account_un UNIQUE (account)
|
||||
);
|
||||
);
|
||||
|
||||
INSERT INTO public.users(account, "password") VALUES('repostats', 'EZ2zQjC3fqbkvtggy9p2YaJiLwx1kKPTJxvqVzowtx6t');
|
||||
|
|
|
|||
Loading…
Reference in New Issue