Coder Social home page Coder Social logo

go-template's Introduction

Quick start

修改环境变量

依赖存在私有仓库,先配置环境变量

export GH_ACCESS_TOKEN=$git_user:$git_token

example:

export GH_ACCESS_TOKEN=zhangsan:ghp_xxxx

这里获取token,获取token的时候选择的scope为repo, workflow

准备 postgres 数据库

测试环境数据库(推荐)

可以使用测试环境 pg 实例, 每个开发者新建一个自己名字命名的 schema, 地址可以询问运维或者使用 k8s 命令查看

本地数据库

1. 使用docker安装 postgres

建议复用starter-guide下的postgres容器

## 手动起一个
docker-compose up -d postgres

创建表

使用go-migrate工具来维护db schema version

# 初始
make migrate-create
# 增量更新
make migrate-up

复制 .env 文件

cp .env.example .env

使用 docker 本地开发

make run-docker

查看日志

docker-compose logs -f

进入容器执行操作

# 进入容器
docker-compose exec app sh

# 在容器内执行 `protoc` 生成
make gen-proto

# 在容器内执行 `mock` 生成
make mock

也可以使用 vscode 容器内开发

生成文档

# 生成 proto 文件时会生成 html 文档
make gen-proto

# 打开 html 文档
open ./doc/index.html

APM

配置 .env 文件配置

- ELASTIC_APM_ENVIRONMENT=development
+ ELASTIC_APM_ENVIRONMENT=<yourname>-local

监控 tidb sql 查询

// 需要配置 ctx

r.getDB().WithContext(ctx).Find(...)

Project structure

cmd/app/main.go

启动 internal/app/app.go.

config

读取 config.yml 和 env 环境文件的环境变量,.env 中放一些运维需要修改的和敏感的信息,需要export

注意

1.rpc 2.代码review

go-template's People

Contributors

zbigbear avatar

Watchers

 avatar

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.