osreapi

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

README

OS Remote Executor Api

FOSSA Status Go

一个无任何第三方依赖的跨平台自定义编排执行步骤的API, 基于DAG实现了依赖步骤依次顺序执行、非依赖步骤并发执行的调度功能.

特性

  • 支持Windows/Linux/Mac
  • 动态调整工人数量
  • 基于有向无环(DAG)编排执行
  • 支持任务或步骤的强制终止
  • 支持任务或步骤的挂起与恢复
  • 支持任务或步骤单独的超时
  • 任务级的Workspace隔离
  • 任务Workspace的浏览与文件上传及下载
  • Dashboard UI
  • 自更新
  • 任务或步骤执行前/后发送通知/事件
  • 任务或步骤插件实现
  • WebShell
  • 文件浏览/上传/下载/编辑

Help

usage: remote_executor-amd64 [<flags>] <command> [<args> ...]


Flags:
  -h, --[no-]help         Show context-sensitive help (also try --help-long and
                          --help-man).
      --addr=":2376"      host:port for execution.
      --[no-]normal       Normal wait for all task execution to complete
      --[no-]debug        Enable debug messages
      --timeout=30s       Timeout for calling endpoints on the engine
      --max_requests=0    Maximum number of concurrent requests. 0 to disable.
      --pool_size=30      Set the size of the execution work pool.
      --script_dir="$TEMP/remote_executor-amd64/scripts"  
                          Script directory
      --log_dir="$TEMP/remote_executor-amd64/logs"  
                          Log directory
      --workspace_dir="$TEMP/remote_executor-amd64/workspace"  
                          Workspace directory
      --data_dir="$TEMP/remote_executor-amd64/data"  
                          Data directory
      --exec_timeout=24h  Set the exec command expire time. Example:
                          "exec_timeout=30m"
      --db_type="bolt"    Database type. [badger|bolt|leveldb]
      --[no-]version      Show application version.

Commands:
help [<command>...]
    Show help.

run
    Run server

Router

[GIN-debug] GET    /debug/pprof/             --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/cmdline      --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/profile      --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
[GIN-debug] POST   /debug/pprof/symbol       --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/symbol       --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/trace        --> github.com/gin-gonic/gin.WrapF.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/allocs       --> github.com/gin-gonic/gin.WrapH.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/block        --> github.com/gin-gonic/gin.WrapH.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/goroutine    --> github.com/gin-gonic/gin.WrapH.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/heap         --> github.com/gin-gonic/gin.WrapH.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/mutex        --> github.com/gin-gonic/gin.WrapH.func1 (5 handlers)
[GIN-debug] GET    /debug/pprof/threadcreate --> github.com/gin-gonic/gin.WrapH.func1 (5 handlers)
[GIN-debug] GET    /swagger/*any             --> github.com/swaggo/gin-swagger.CustomWrapHandler.func1 (5 handlers)
[GIN-debug] GET    /version                  --> github.com/xmapst/osreapi/internal/handlers.version (5 handlers)
[GIN-debug] GET    /healthyz                 --> github.com/xmapst/osreapi/internal/handlers.healthyz (5 handlers)
[GIN-debug] GET    /metrics                  --> github.com/xmapst/osreapi/internal/handlers.metrics (5 handlers)
[GIN-debug] GET    /heartbeat                --> github.com/xmapst/osreapi/internal/handlers.heartbeat (5 handlers)
[GIN-debug] HEAD   /heartbeat                --> github.com/xmapst/osreapi/internal/handlers.heartbeat (5 handlers)
[GIN-debug] GET    /api/v1/task              --> github.com/xmapst/osreapi/internal/handlers/api/v1/task.List (6 handlers)
[GIN-debug] POST   /api/v1/task              --> github.com/xmapst/osreapi/internal/handlers/api/v1/task.Post (6 handlers)
[GIN-debug] GET    /api/v1/task/:task        --> github.com/xmapst/osreapi/internal/handlers/api/v1/task.Detail (6 handlers)
[GIN-debug] PUT    /api/v1/task/:task        --> github.com/xmapst/osreapi/internal/handlers/api/v1/task.Manager (6 handlers)
[GIN-debug] PUT    /api/v1/task/:task/:step  --> github.com/xmapst/osreapi/internal/handlers/api/v1/task.ManagerStep (6 handlers)
[GIN-debug] GET    /api/v1/task/:task/:step/console --> github.com/xmapst/osreapi/internal/handlers/api/v1/task.StepDetail (6 handlers)
[GIN-debug] GET    /api/v1/pool              --> github.com/xmapst/osreapi/internal/handlers/api/v1/pool.Detail (6 handlers)
[GIN-debug] POST   /api/v1/pool              --> github.com/xmapst/osreapi/internal/handlers/api/v1/pool.Post (6 handlers)
[GIN-debug] GET    /api/v1/state             --> github.com/xmapst/osreapi/internal/handlers/api/v1/status.Detail (6 handlers)
[GIN-debug] POST   /api/v2/task              --> github.com/xmapst/osreapi/internal/handlers/api/v2/task.Post (6 handlers)

服用方式

以windows服务形式部署运行

用管理模式打开powershell执行
New-Service -Name remote_executor -BinaryPathName "C:\remote_executor.exe run --addr=:2376" -DisplayName  "Remote Executor " -StartupType Automatic
sc.exe failure remote_executor reset= 0 actions= restart/0/restart/0/restart/0
sc.exe start remote_executor

本地编译

git clone https://github.com/xmapst/osreapi.git
cd osreapi
make

Swagger

swagger

DashboardUI

dashboard tasks steps logs

[注释]

  • code:
    • 0: success
    • 1001: in progress
    • 1002: execution failed
    • 1003: data not found or destroyed
    • 1004: pending
    • 1005: paused
  • state:
    • 0: stop
    • 1: running
    • 2: pending
    • 3: paused
    • -997: killed
    • -998: timeout
    • -999: system error

License

FOSSA Status

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   string
	GitUrl    string
	GitBranch string
	GitCommit string
	BuildTime string
	UserName  string
	UserEmail string
)

Functions

func File added in v1.0.10

func File(prefixs ...string) gin.HandlerFunc

File 使用go.16新的特性embed 到包前端编译后的代码. 替代nginx. one binary rules them all

func PrintHeadInfo

func PrintHeadInfo()

func VersionInfo

func VersionInfo() string

Types

This section is empty.

Directories

Path Synopsis
internal
dao
docs
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
pkg
binarydist
Package binarydist implements binary diff and patch as described on http://www.daemonology.net/bsdiff/.
Package binarydist implements binary diff and patch as described on http://www.daemonology.net/bsdiff/.
dag
osext
Package osext Extensions to the standard "os" package.
Package osext Extensions to the standard "os" package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL