mirror of https://github.com/hak5/overseer.git
update docs, update silly bootstrap program
parent
2e4decb22e
commit
7516f44481
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Jaime Pillora
|
||||
Copyright (c) 2017 Jaime Pillora
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
45
README.md
45
README.md
|
@ -11,7 +11,7 @@ Commonly, graceful restarts are performed by the active process (*dark blue*) cl
|
|||
### Features
|
||||
|
||||
* Simple
|
||||
* Works with process managers
|
||||
* Works with process managers (systemd, upstart, supervisor, etc)
|
||||
* Graceful, zero-down time restarts
|
||||
* Easy self-upgrading binaries
|
||||
|
||||
|
@ -77,35 +77,34 @@ See [Config](https://godoc.org/github.com/jpillora/overseer#Config)uration optio
|
|||
|
||||
### More examples
|
||||
|
||||
* See the [example/](example/) directory and run `example.sh`, you should see the following output:
|
||||
See the [example/](example/) directory and run `example.sh`, you should see the following output:
|
||||
|
||||
```sh
|
||||
$ cd example/
|
||||
$ sh example.sh
|
||||
serving . on port 5002
|
||||
BUILT APP (1)
|
||||
RUNNING APP
|
||||
app#1 (1cd8b9928d44b0a6e89df40574b8b6d20a417679) listening...
|
||||
app#1 (1cd8b9928d44b0a6e89df40574b8b6d20a417679) says hello
|
||||
app#1 (1cd8b9928d44b0a6e89df40574b8b6d20a417679) says hello
|
||||
app#1 (031c802ee74f00b2a5c52f2fe647523973c09441) listening...
|
||||
app#1 (031c802ee74f00b2a5c52f2fe647523973c09441) says hello
|
||||
app#1 (031c802ee74f00b2a5c52f2fe647523973c09441) says hello
|
||||
BUILT APP (2)
|
||||
app#2 (b9b251f1be6d0cc423ef921f107cb4fc52f760b3) listening...
|
||||
app#2 (b9b251f1be6d0cc423ef921f107cb4fc52f760b3) says hello
|
||||
app#2 (b9b251f1be6d0cc423ef921f107cb4fc52f760b3) says hello
|
||||
app#1 (1cd8b9928d44b0a6e89df40574b8b6d20a417679) says hello
|
||||
app#1 (1cd8b9928d44b0a6e89df40574b8b6d20a417679) exiting...
|
||||
app#2 (25d19f139f50f39fadbd066b438ebdc28d818eb1) listening...
|
||||
app#2 (25d19f139f50f39fadbd066b438ebdc28d818eb1) says hello
|
||||
app#2 (25d19f139f50f39fadbd066b438ebdc28d818eb1) says hello
|
||||
app#1 (031c802ee74f00b2a5c52f2fe647523973c09441) says hello
|
||||
app#1 (031c802ee74f00b2a5c52f2fe647523973c09441) exiting...
|
||||
BUILT APP (3)
|
||||
app#3 (248f80ea049c835e7e3714b7169c539d3a4d6131) listening...
|
||||
app#3 (248f80ea049c835e7e3714b7169c539d3a4d6131) says hello
|
||||
app#3 (248f80ea049c835e7e3714b7169c539d3a4d6131) says hello
|
||||
app#2 (b9b251f1be6d0cc423ef921f107cb4fc52f760b3) says hello
|
||||
app#2 (b9b251f1be6d0cc423ef921f107cb4fc52f760b3) exiting...
|
||||
app#3 (248f80ea049c835e7e3714b7169c539d3a4d6131) says hello
|
||||
app#3 (5ed8170e5bbd6947cc514c87ac29e7acfba5cffc) listening...
|
||||
app#3 (5ed8170e5bbd6947cc514c87ac29e7acfba5cffc) says hello
|
||||
app#3 (5ed8170e5bbd6947cc514c87ac29e7acfba5cffc) says hello
|
||||
app#2 (25d19f139f50f39fadbd066b438ebdc28d818eb1) says hello
|
||||
app#2 (25d19f139f50f39fadbd066b438ebdc28d818eb1) exiting...
|
||||
app#3 (5ed8170e5bbd6947cc514c87ac29e7acfba5cffc) says hello
|
||||
```
|
||||
|
||||
**Note:** `app#1` stays running until the last request is closed.
|
||||
|
||||
* Only use graceful restarts:
|
||||
#### Only use graceful restarts
|
||||
|
||||
```go
|
||||
func main() {
|
||||
|
@ -118,7 +117,7 @@ See [Config](https://godoc.org/github.com/jpillora/overseer#Config)uration optio
|
|||
|
||||
Send `main` a `SIGUSR2` (`Config.RestartSignal`) to manually trigger a restart
|
||||
|
||||
* Only use auto-upgrades, no restarts
|
||||
#### Only use auto-upgrades, no restarts
|
||||
|
||||
```go
|
||||
func main() {
|
||||
|
@ -135,7 +134,7 @@ See [Config](https://godoc.org/github.com/jpillora/overseer#Config)uration optio
|
|||
|
||||
Your binary will be upgraded though it will require manual restart from the user, suitable for creating self-upgrading command-line applications.
|
||||
|
||||
* Multi-platform binaries using a dynamic fetch `URL`
|
||||
#### Multi-platform binaries using a dynamic fetch `URL`
|
||||
|
||||
```go
|
||||
func main() {
|
||||
|
@ -161,8 +160,10 @@ See [Config](https://godoc.org/github.com/jpillora/overseer#Config)uration optio
|
|||
|
||||
* [Core `overseer` package](https://godoc.org/github.com/jpillora/overseer)
|
||||
* [Common `fetcher.Interface`](https://godoc.org/github.com/jpillora/overseer/fetcher#Interface)
|
||||
* [HTTP fetcher type](https://godoc.org/github.com/jpillora/overseer/fetcher#HTTP)
|
||||
* [S3 fetcher type](https://godoc.org/github.com/jpillora/overseer/fetcher#S3)
|
||||
* [File fetcher](https://godoc.org/github.com/jpillora/overseer/fetcher#File)
|
||||
* [HTTP fetcher](https://godoc.org/github.com/jpillora/overseer/fetcher#HTTP)
|
||||
* [S3 fetcher](https://godoc.org/github.com/jpillora/overseer/fetcher#S3)
|
||||
* [Github fetcher](https://godoc.org/github.com/jpillora/overseer/fetcher#Github)
|
||||
|
||||
### Third-party Fetchers
|
||||
|
||||
|
|
|
@ -4,25 +4,23 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/jpillora/opts"
|
||||
"github.com/jpillora/overseer"
|
||||
"github.com/jpillora/overseer/fetcher"
|
||||
"github.com/jpillora/opts"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c := struct {
|
||||
URL string `type:"arg" help:"<url> of where to GET the binary"`
|
||||
Port int `help:"listening port"`
|
||||
Log bool `help:"enable logging"`
|
||||
NoDebug bool `help:"disable debug mode"`
|
||||
}{
|
||||
Port: 3000,
|
||||
Log: true,
|
||||
}
|
||||
opts.Parse(&c)
|
||||
overseer.Run(overseer.Config{
|
||||
Log: c.Log,
|
||||
Program: func(state overseer.State) {
|
||||
//noop
|
||||
//block forever
|
||||
select {}
|
||||
},
|
||||
Address: ":" + strconv.Itoa(c.Port),
|
||||
|
@ -30,5 +28,6 @@ func main() {
|
|||
URL: c.URL,
|
||||
Interval: 1 * time.Second,
|
||||
},
|
||||
Debug: !c.NoDebug,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue