You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gosuv/README.md

172 lines
4.0 KiB

9 years ago
# gosuv
9 years ago
[![Build Status](https://travis-ci.org/codeskyblue/gosuv.svg)](https://travis-ci.org/codeskyblue/gosuv)
8 years ago
[中文README](README_ZH.md) 不是很全,能看懂英文的还是尽量看英文
## current is in beta
8 years ago
Process management writtern by golang, inspired by python-supervisor
8 years ago
## So why write another supervisor?
I have been using python-supervisor for many years and there are something uncomfortable feelings.
1. Log can't contains ANSI color chars
1. The configuration file can add on the web, often forgot some settings.
1. `supervisorctl reload` will cause supervisord restarted
1. Hard to set status change to fatal notifications.
1. No process performance monitor page.
1. Program starts with no common environ, eg, missing HOME and USER variable
1. Kill process default is not group kill which make sub process still running.
1. More... will added when I think of it.
## Features
8 years ago
* [x] Web control page
* [x] Start, Stop, Tail, Reload
* [x] Realtime log
* [x] Add program support
7 years ago
* [x] Edit support
8 years ago
* [x] Delete support
* [x] Memory and CPU monitor
8 years ago
* [ ] Path auto complete <https://github.com/twitter/typeahead.js>
* [x] HTTP Basic auth
* [x] Github webhook
* [ ] Single log page, include search support
8 years ago
* [ ] 中文文档
9 years ago
## Requirements
8 years ago
Go version at least `1.6+`
8 years ago
## Installation
7 years ago
### Binaries
The fastest way is run with. Default install location is `/usr/local/bin`, change env-var `BINDIR` will also change install location.
```
curl https://raw.githubusercontent.com/codeskyblue/gosuv/master/get.sh | bash
```
Or just download binaries
7 years ago
<https://github.com/codeskyblue/gosuv/releases>
Thanks to [goreleaser](https://github.com/goreleaser/goreleaser) which makes publish binaries automaticly.
7 years ago
### Build from source
8 years ago
```sh
go get -d github.com/codeskyblue/gosuv
cd $GOPATH/src/github.com/codeskyblue/gosuv
7 years ago
go generate # package html resources into go
go build -tags vfs
8 years ago
```
9 years ago
## Quick start
After you installed gosuv, the first thing is to start server.
8 years ago
```sh
gosuv start-server
```
Basic operations
8 years ago
8 years ago
```sh
$ gosuv status
PROGRAM NAME STATUS
test running
test_again stopped
$ gosuv stop test
$ gosuv start test
```
Open web <http://localhost:11313> to see the manager page. And follow the gif to add a program to gosuv.
8 years ago
![gosuv web](docs/gosuv.gif)
8 years ago
## Configuration
Default config file stored in directory `$HOME/.gosuv/`, Set env-var `GOSUV_HOME_DIR` can change config file store directory.
- file `programs.yml` contains all program settings.
- file `config.yml` contains server config
File `config.yml` can be generated by `gosuv conftest`
Example config.yaml
```
server:
httpauth:
enabled: true
username: admin
password: admin
addr: :8083
name: 10.10.99.177
notifications:
dingtalk:
groups:
- secret: c1b8032******************aa736a
mobile:
- "153********"
client:
server_url: http://admin:admin@localhost:8083
```
Logs can be found in `$HOME/.gosuv/log/`
Edit config file(default located in `$HOME/.gosuv/programs.yml`) and run `gosuv reload` will take effect immediately.
8 years ago
## Design
8 years ago
HTTP is follow the RESTFul guide.
Get or Update program
8 years ago
`<GET|PUT> /api/programs/:name`
8 years ago
Add new program
8 years ago
`POST /api/programs`
8 years ago
Del program
8 years ago
`DELETE /api/programs/:name`
## State
9 years ago
Only 4 states. [ref](http://supervisord.org/subprocess.html#process-states)
9 years ago
8 years ago
![states](docs/states.png)
9 years ago
## Notification
8 years ago
Configuration example
```yaml
8 years ago
- demo-program:
command: ...
notifications:
pushover:
api_key: [token]
users:
- [user1]
- [user2]
8 years ago
```
8 years ago
Now only support [pushover](https://pushover.net/api), and only status change to fatal will get notified.
8 years ago
## Integrate with github (todo)
This is feature that will helps update your deployment environment once your updated in the github.
This part is set in the `programs.yml`, take look the example
```yml
- demo-program:
command: python app.py
directory: /opt/demo
webhook:
github:
secret: 123456
command: git pull origin master
```
9 years ago
## LICENSE
[MIT](LICENSE)