asynqmon/README.md

177 lines
5.7 KiB
Markdown
Raw Normal View History

2021-04-15 01:36:21 +08:00
<img src="https://user-images.githubusercontent.com/11155743/114745460-57760500-9d57-11eb-9a2c-43fa88171807.png" alt="Asynqmon logo" width="360px" />
2021-01-31 11:10:10 +08:00
2021-04-15 01:36:21 +08:00
# A modern web based tool for monitoring & administrating [Asynq](https://github.com/hibiken/asynq) queues, tasks and message broker
2021-01-31 11:10:10 +08:00
2021-09-08 08:03:15 +08:00
## Version Compatibility
| Asynq version | WebUI (asynqmon) version |
| -------------- | ------------------------ |
| 0.18.x | 0.2.x |
| 0.16.x, 0.17.x | 0.1.x |
2021-02-01 13:50:46 +08:00
2021-04-07 12:03:14 +08:00
## Install
2021-01-31 11:10:10 +08:00
### Release binaries
2021-04-15 01:36:21 +08:00
You can download the release binary for your system from the [releases page](https://github.com/hibiken/asynqmon/releases).
2021-01-31 11:10:10 +08:00
2021-04-07 12:03:14 +08:00
### Docker image
2021-04-15 01:36:21 +08:00
To pull the Docker image:
2021-04-07 12:03:14 +08:00
```bash
# Pull the latest image
docker pull hibiken/asynqmon
# Or specify the image by tag
docker pull hibiken/asynqmon[:tag]
```
2021-01-31 11:10:10 +08:00
### Building from source
2021-04-15 01:36:21 +08:00
To build Asynqmon from source code, make sure you have Go installed ([download](https://golang.org/dl/)). Version `1.16` or higher is required. You also need [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/) installed in order to build the frontend assets.
2021-01-31 11:10:10 +08:00
2021-04-15 01:36:21 +08:00
Download the source code of this repository and then run:
2021-01-31 11:10:10 +08:00
```bash
make build
2021-01-31 11:10:10 +08:00
```
The `asynqmon` binary should be created in the current directory.
2021-04-15 01:36:21 +08:00
### Building Docker image locally
2021-01-31 11:10:10 +08:00
2021-04-15 01:36:21 +08:00
To build Docker image locally, run:
2021-01-31 11:10:10 +08:00
```bash
2021-04-07 12:03:14 +08:00
make docker
2021-01-31 11:10:10 +08:00
```
2021-10-03 10:04:21 +08:00
### Importing into projects
You can import `asynqmon` into other projects and create a single binary to serve other components of `asynq` and `asynqmon` from a single binary.
<details><summary>Example</summary>
<p>
> `staticContents` can be embedded by using the pre-built UI bundle from the Releases section.
```go
package main
import (
"embed"
"log"
"net/http"
2021-10-05 14:09:11 +08:00
"github.com/gorilla/mux"
2021-10-03 10:04:21 +08:00
"github.com/hibiken/asynq"
"github.com/hibiken/asynqmon"
)
//go:embed ui-assets/*
var staticContents embed.FS
func main() {
2021-10-04 23:18:00 +08:00
h := asynqmon.New(asynqmon.Options{
2021-10-03 10:04:21 +08:00
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
})
2021-10-04 23:18:00 +08:00
defer h.Close()
2021-10-03 10:04:21 +08:00
2021-10-05 14:09:11 +08:00
r := mux.NewRouter()
r.PathPrefix("/api").Handler(h)
// Add static content handler or other handlers
// r.PathPrefix("/").Handler( /* &staticContentHandler{staticContents} */ )
2021-10-03 10:04:21 +08:00
srv := &http.Server{
2021-10-05 14:09:11 +08:00
Handler: r,
2021-10-03 10:04:21 +08:00
Addr: ":8080",
}
log.Fatal(srv.ListenAndServe())
}
```
</p>
</details>
2021-04-07 12:03:14 +08:00
## Run
2021-01-31 11:10:10 +08:00
2021-04-07 12:03:14 +08:00
To use the defaults, simply run and open http://localhost:8080.
2021-02-01 13:50:46 +08:00
```bash
2021-04-07 12:03:14 +08:00
# with a local binary
./asynqmon
2021-04-07 12:03:14 +08:00
# with docker
docker run --rm \
--name asynqmon \
-p 8080:8080 \
hibiken/asynqmon
```
2021-09-08 08:03:15 +08:00
By default, Asynqmon web server listens on port `8080` and connects to a Redis server running on `127.0.0.1:6379`.
2021-09-08 08:03:15 +08:00
To see all available flags, run:
```bash
2021-04-07 12:03:14 +08:00
# with a local binary
2021-09-08 08:03:15 +08:00
./asynqmon --help
# with Docker
docker run hibiken/asynqmon --help
```
Here's the available flags:
_Note_: Use `--redis-url` to specify address, db-number, and password with one flag value; Alternatively, use `--redis-addr`, `--redis-db`, and `--redis-password` to specify each value.
| Flag | Description | Default |
| ------------------------------- | ------------------------------------------------------------------- | ---------------- |
| `--port`(int) | port number to use for web ui server | 8080 |
| `---redis-url`(string) | URL to redis server | "" |
| `--redis-addr`(string) | address of redis server to connect to | "127.0.0.1:6379" |
| `--redis-db`(int) | redis database number | 0 |
| `--redis-password`(string) | password to use when connecting to redis server | "" |
| `--redis-cluster-nodes`(string) | comma separated list of host:port addresses of cluster nodes | "" |
| `--redis-tls`(string) | server name for TLS validation used when connecting to redis server | "" |
| `--redis-insecure-tls`(bool) | disable TLS certificate host checks | false |
### Examples
```bash
# with a local binary; custom port and connect to redis server at localhost:6380
2021-05-09 13:12:16 +08:00
./asynqmon --port=3000 --redis-addr=localhost:6380
2021-04-07 12:03:14 +08:00
2021-04-15 01:36:21 +08:00
# with Docker (connect to a Redis server running on the host machine)
docker run --rm \
--name asynqmon \
-p 3000:3000 \
2021-05-09 13:12:16 +08:00
hibiken/asynqmon --port=3000 --redis-addr=host.docker.internal:6380
2021-04-15 01:36:21 +08:00
# with Docker (connect to a Redis server running in the Docker container)
docker run --rm \
--name asynqmon \
--network dev-network \
-p 8080:8080 \
2021-05-09 13:12:16 +08:00
hibiken/asynqmon --redis-addr=dev-redis:6379
2021-02-01 13:50:46 +08:00
```
2021-04-07 12:03:14 +08:00
Next, go to [localhost:8080](http://localhost:8080) and see Asynqmon dashboard:
2021-04-15 01:36:21 +08:00
![Web UI Queues View](https://user-images.githubusercontent.com/11155743/114697016-07327f00-9d26-11eb-808c-0ac841dc888e.png)
2021-05-09 13:12:16 +08:00
**Tasks view**
2021-04-15 01:36:21 +08:00
![Web UI TasksView](https://user-images.githubusercontent.com/11155743/114697070-1f0a0300-9d26-11eb-855c-d3ec263865b7.png)
**Settings and adaptive dark mode**
![Web UI Settings and adaptive dark mode](https://user-images.githubusercontent.com/11155743/114697149-3517c380-9d26-11eb-9f7a-ae2dd00aad5b.png)
2021-04-07 12:03:14 +08:00
2021-01-31 11:10:10 +08:00
## License
2021-04-15 01:36:21 +08:00
Copyright (c) 2019-present [Ken Hibino](https://github.com/hibiken) and [Contributors](https://github.com/hibiken/asynqmon/graphs/contributors). `Asynqmon` is free and open-source software licensed under the [MIT License](https://github.com/hibiken/asynq/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/publicdomain/zero/1.0/) license (CC0 1.0 Universal).