Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/immortal/immortal
⭕ A *nix cross-platform (OS agnostic) supervisor
https://github.com/immortal/immortal
daemon http nix-cross-platform os-agnostic process supervisor unix unix-socket
Last synced: 2 months ago
JSON representation
⭕ A *nix cross-platform (OS agnostic) supervisor
- Host: GitHub
- URL: https://github.com/immortal/immortal
- Owner: immortal
- License: bsd-3-clause
- Created: 2016-06-30T17:02:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-21T19:15:39.000Z (6 months ago)
- Last Synced: 2024-08-02T15:47:41.833Z (5 months ago)
- Topics: daemon, http, nix-cross-platform, os-agnostic, process, supervisor, unix, unix-socket
- Language: Go
- Homepage: https://immortal.run
- Size: 1.7 MB
- Stars: 798
- Watchers: 17
- Forks: 54
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-go - immortal - ⭕ A *nix cross-platform (OS agnostic) supervisor - ★ 542 (Utilities)
- awesome-go-extra - immortal - platform (OS agnostic) supervisor|747|50|3|2016-06-30T17:02:27Z|2022-06-06T18:56:49Z| (Utilities / Fail injection)
- awesome-discoveries - immortal - a *nix cross-platform (OS agnostic) supervisor _(`Go`)_ (CLI Utilities)
README
# ⭕ immortal
[![CircleCI](https://circleci.com/gh/immortal/immortal.svg?style=svg)](https://circleci.com/gh/immortal/immortal)
[![Build Status](https://travis-ci.org/immortal/immortal.svg?branch=develop)](https://travis-ci.org/immortal/immortal)
[![Coverage Status](https://coveralls.io/repos/github/immortal/immortal/badge.svg?branch=master)](https://coveralls.io/github/immortal/immortal?branch=master)
[![codecov](https://codecov.io/gh/immortal/immortal/branch/master/graph/badge.svg)](https://codecov.io/gh/immortal/immortal)
[![Go Report Card](https://goreportcard.com/badge/github.com/immortal/immortal)](https://goreportcard.com/report/github.com/immortal/immortal)A *nix cross-platform (OS agnostic) supervisor
https://immortal.run/
[![GitHub release](https://img.shields.io/github/release/immortal/immortal.svg)](https://github.com/immortal/immortal/releases)
[![GoDoc](https://godoc.org/github.com/immortal/immortal?status.svg)](https://godoc.org/github.com/immortal/immortal)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/immortal/immortal/blob/master/CONTRIBUTING.md)Linux precompiled binaries
[![deb](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/immortal/immortal)
[![rpm](https://img.shields.io/badge/rpm-packagecloud.io-844fec.svg)](https://packagecloud.io/immortal/immortal)## run on behalf other system user
If services need to run on behalf other system user `www, nobody, www-data`,
not `root`, **immortal** should be compiled from source for the desired
target/architecture, otherwise, this error may be returned:Error looking up user: "www". user: Lookup requires cgo
See more: https://golang.org/cmd/cgo/
If using [FreeBSD](https://github.com/freebsd/freebsd-ports/tree/master/sysutils/immortal)
or [macOS](https://github.com/immortal/homebrew-tap)
you can install using [pkg/ports](http://immortal.run/freebsd/)
or [homebrew](http://immortal.run/mac/), for other platforms work is in
progress, any help for making the port/package for other systems would be
appreciated.## Compile from source
Setup go environment https://golang.org/doc/install
> go >= 1.12 is required
For example using $HOME/go for your workspace
$ export GOPATH=$HOME/go
Create the directory:
$ mkdir -p $HOME/go/src/github.com/immortal
Clone project into that directory:
$ git clone [email protected]:immortal/immortal.git $HOME/go/src/github.com/immortal/immortal
Build by just typing make:
$ cd $HOME/go/src/github.com/immortal/immortal
$ makeTo install/uninstall:
$ make install
$ make uninstall# configuration example
Content of file `/usr/local/etc/immortal/www.yml`:
```yaml
# pkg install go-www
cmd: www
cwd: /usr/ports
log:
file: /var/log/www.log
age: 10 # seconds
num: 7 # int
size: 1 # MegaBytes
wait: 1
require:
- foo
- bar
```If `foo` and `bar` are not running, the service `www` will not be started. Skip `age`, `num` & `size` options to avoid `log-rotation` completely.
> `foo` and `bar` are the names for the services defined on the same path www.yaml is located, foo.yml & bar.yml
# Paths
When using immortaldir:
/usr/local/etc/immortal
|--foo.yml
|--bar.yml
`--www.ymlThe name of the `file.yml` will be used to reference the service to be
daemonized excluding the extension `.yml`.:foo
bar
www## /var/run/immortal/
/var/run/immortal
|--foo
| |-lock
| `-immortal.sock
|--bar
| |-lock
| `-immortal.sock
`--www
|-lock
`-immortal.sock## immortal like non-root user
Any service launched like not using using ``immortaldir`` will follow this
structure:~/.immortal
|--(pid)
| |--lock
| `--immortal.sock
|--(pid)
| |--lock
| `--immortal.sock
`--(pid)
|--lock
`--immortal.sockThe `-name` argument takes a non-path (e.g., "myservice"), and the argument will be used instead of the pid in the directory structure. For example, `immortal -ctl myservice sleep 1000` will be:
~/.immortal
|--myservice
| |--lock
| `--immortal.sockThe `-ctl` argument takes precedence over the `-name` argument.
# immortalctl
Will print current status and allow to manage the services
# debug
pgrep -fl "immortal -ctl" | awk '{print $1}' | xargs watch -n .1 pstree -p
# Test status using curl & [jq](https://stedolan.github.io/jq/)
status:
curl --unix-socket immortal.sock http:/status -s | jq
> note the single '/' https://superuser.com/a/925610/284722
down:
curl --unix-socket immortal.sock http://im/signal/d -s | jq
up:
curl --unix-socket immortal.sock http://im/signal/u -s | jq