Skip to content

devops-metalflow/metalflow

Repository files navigation

metalflow

Build Status codecov Go Report Card License Tag

English | 中文

Introduction

metalflow is the server of metalflow written in Go.

Prerequisites

  • Go >= 1.18.0

Preparation

  • Install
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
apt update
apt install -y consul
  • Run
consul agent -dev -ui -client=0.0.0.0

MySQL

  • Deploy
docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=db_admin mysql:latest
  • Init
mysql -h 10.34.56.78 -u root -p
mysql> CREATE DATABASE metalflow;

Redis

  • Deploy
docker run -itd --name redis-test -p 6379:6379 redis:latest

OR

docker run -itd --name redis-test -p 6379:6379 redis:latest --requirepass "123456"

Run

make build
./metalflow --config-file=config.yml

Visit http://127.0.0.1:8089/api/ping in browser to check status as below

{
  "code": 201,
  "result": "pong",
  "msg": "操作成功"
}

Usage

usage: metalflow [<flags>]

MetalBeat

Flags:
  --help                     Show context-sensitive help (also try --help-long and --help-man).
  --version                  Show application version.
  --config-file=CONFIG-FILE  Config file (.yml)

Settings

metalflow parameters can be set in the directory conf.

An example of configuration in config.yml:

License

Project License can be found here.

Reference

  • casbin: An authorization library that supports access control models like ACL, RBAC, ABAC in Golang.
  • Consul: a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
  • cronlib: golang crontab scheduler.
  • Machinery: an asynchronous task queue/job queue based on distributed message passing.
  • Gin: a web framework written in Go (Golang).
  • gin-jwt: JWT Middleware for Gin framework.
  • gin-web: Golang version of RBAC permission management scaffolding.
  • Gorm: The fantastic ORM library for Golang.
  • logrus: a structured logger for Go (golang), completely API compatible with the standard library logger.
  • lumberjack: a log rolling package for Go.
  • validator: Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving.
  • viper: Go configuration with fangs.
  • zap: Blazing fast, structured, leveled logging in Go.

About

Metal server

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages