⭕ A *nix cross-platform (OS agnostic) supervisor

immortal

CircleCI Build Status Coverage Status codecov Go Report Card

A *nix cross-platform (OS agnostic) supervisor

https://immortal.run/

GitHub release GoDoc contributions welcome

Linux precompiled binaries

deb rpm

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 or macOS you can install using pkg/ports or homebrew, 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
$ make

To install/uninstall:

$ make install
$ make uninstall

configuration example

Content of file /usr/local/etc/immortal/www.yml:

# 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.yml

The 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.sock

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

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
Owner
immortal
A *nix cross-platform (OS agnostic) supervisor
immortal
Comments
  • Question - log throughput

    Question - log throughput

    When i run my app via immortal with yml config, if i don't specify the log option, i don't see any logs in my console, apart from process starts and exists. Is it possible to have the logs sent to the console from a running process?

  • Immortal on Raspberry

    Immortal on Raspberry

    Hi ! I'm using immortal with Linux Mint and the SSTV software since this program is buggy and exit itself whenever while it must receive SSTV pictures from ISS. So in order to avoid missing pictures from the International Space Station, Immortal is a must have software. I've just installed QSSTV on my raspberry and I didn't find any package for Raspbian and ARM device working for my Raspbian under Raspberry. I've passed many hours to try to compile the software but I never succeed.

    So can someone help me to get a working package or un very good tutorial about how to compile this software for my raspberry ? New pictures are being sent this week-end from ISS...

    Many thanks to all people who will help me.

    David.

  • Use service name derived from config when using `immortal -c service.yml`

    Use service name derived from config when using `immortal -c service.yml`

    This PR makes the processes started directly with immortal addressible by the service name as derived from the config filename. This mirrors the behaviour of immortaldir. I have a use case where I need to use the require directive for monitored processes which are not started by immortaldir but directly by immortal itself. Currently such process have the PID as name. This makes using require impossible. Feedback appreciated.

    To further elaborate on the use case. We are using this modified version of immortal in combination with https://github.com/Supervisor/supervisor which has pretty clumsy dependency support. Immortal solves this in a very simple in effective manner. Reason for using supervisor is that we can, at this time, better control the stdout/stderr redirection for monitored processes inside container environments. Ideally we would just use immortal so investigating this further.

  • Custom 'cleanup' action

    Custom 'cleanup' action

    Hi,

    Would it be possible to integrate some kind of custom cleanup action after the process from “cmd” finishes? Something to be executed with the exit code as a parameter, that could perform some extra actions before the main process is restarted (or just after it is shut down.)

    I have a 'cmd' script that uses “exec” to start the main service so that it can be managed properly, but when it stops I'm left with a few ifconfig commands to run to ensure the proper teardown sequence 😅

  •  Error looking up user:

    Error looking up user: "www". user: Lookup requires cgo

    When downloading the precompiled binaries, this error may appear:

     Error looking up user: "www". user: Lookup requires cgo
    

    Seems that is not currently possible to cross compile using cgo, therefore need to way to create the binaries on the native platforms.

    Compiling from sources solves this problem.

    https://golang.org/cmd/cgo/

  • Question - can we do one retry using `retries`

    Question - can we do one retry using `retries`

    We use immortal to configure some code insider our docker containers. Depending on some external configuration, we may want our service to always be restarted, or to run just once.

    I tried setting retries to 0 in immortal configuration but that didn't seem to do it.

    Any way i can use immortal so that supervisor exits if service exits, using run.yml approach?

  • improve documentation

    improve documentation

    Improve the overall documentation, for the example in the run.yml there is no explanation about how to avoid rotating logs, something that could be done by just omitting the options age, num, size etc.

    Be more clear, add more examples (avoid assumptions)

  • immortal 0.24.0/0.24.1 upgrade issue

    immortal 0.24.0/0.24.1 upgrade issue

    Relates to

    • https://github.com/Homebrew/homebrew-core/pull/45928
    • https://github.com/Homebrew/homebrew-core/pull/47622

    It looks like we cannot build immortal from the source code (I just tried on my local machine, I wonder if you can provide some instructions to keep the formula up to date). Thanks!

    cc @nbari

  • Nodaemon flag

    Nodaemon flag

    This adds a -n flag to immortal which does not make it fork to the background. This is useful for testing and also in cases immortal is executed from another processes which wants it to stay in the foreground.

  • immortaldir not starting services

    immortaldir not starting services

    immortaldir does not start services when running immortal entirely from a user $HOME -- with no access to root directories.

    Setup

    $HOME/local/bin/immortal
    $HOME/local/bin/immortaldir
    $HOME/local/bin/immortalctl
    $HOME/local/var/run/immortal
    $HOME/local/etc/immortal/app.yml
    

    Success with immortal

    cd $HOME/local
    ./bin/immortal -c etc/immortal/app.yml
    

    This works; bin/immortalctl status shows the service started & app is running. I can stop, restart, and otherwise control app through immortalctl as expected. However...

    Failure with immortaldir

    cd $HOME/local
    IMMORTAL_SDIR=$HOME/local/var/run/immortal ./bin/immortaldir etc/immortal
    

    results in

    2018/04/17 22:28:36 immortal scandir: /home/uzr/local/etc/immortal
    2018/04/17 22:28:36 Starting: app
    2018/04/17 22:28:36
    2018/04/17 22:28:41 Starting: app
    2018/04/17 22:28:41
    

    and so on, repeatedly. No errors, no logging, no way to figure out what's going wrong. app is not started nor is running.

    Expected behavior

    An app that can be successfully started with immortal should work when started with immortaldir.

  • Add homebrew release flow

    Add homebrew release flow

    • [x] Have you test the code?
    • [x] Have you check that the existing tests are passing?
    • [x] The destination branch is develop?

    @nbari you need to generate a PAT and encrypt the setting so that we can automate this flow.

    Ref: https://github.com/mislav/bump-homebrew-formula-action

  • Require network

    Require network

    Ref #12

    How do I ensure the network is configured by dhcp prior to running my command? The equivalent of systemd's After=network.target or After=network-online.target

  • Bump nix from 0.15.0 to 0.20.2 in /rust

    Bump nix from 0.15.0 to 0.20.2 in /rust

    Bumps nix from 0.15.0 to 0.20.2.

    Changelog

    Sourced from nix's changelog.

    [0.20.2] - 28 September 2021

    Added

    Changed

    Fixed

    • Fixed buffer overflow in unistd::getgrouplist. (#1545)

    [0.20.1] - 13 August 2021

    Added

    Changed

    Fixed

    • Locked bitflags to < 1.3.0 to fix the build with rust < 1.46.0.

    Removed

    • Removed a couple of termios constants on redox that were never actually supported. (#1483)

    [0.20.0] - 20 February 2021

    Added

    • Added a passwd field to Group (#1338)
    • Added mremap (#1306)
    • Added personality (#1331)
    • Added limited Fuchsia support (#1285)
    • Added getpeereid (#1342)
    • Implemented IntoIterator for Dir (#1333).

    Changed

    • Minimum supported Rust version is now 1.40.0. (#1356)
    • i686-apple-darwin has been demoted to Tier 2 support, because it's deprecated by Xcode. (#1350)
    • Fixed calling recvfrom on an AddrFamily::Packet socket (#1344)

    Fixed

    • TimerFd now closes the underlying fd on drop. (#1381)
    • Define *_MAGIC filesystem constants on Linux s390x (#1372)
    • mqueue, sysinfo, timespec, statfs, test_ptrace_syscall() on x32 (#1366)

    ... (truncated)

    Commits
    • 72d805a (cargo-release) version 0.20.2
    • 199acc7 [skip ci] update version in README
    • 94ccf88 Fix memory unsafety in unistd::getgrouplist
    • de534c1 Release 0.20.1
    • b13f73c Fix a non_fmt_panic warning with Rustc 1.52.0
    • c0a9fd7 Use memoffset::offset_of instead of homegrown macro
    • e266b7c Fix test_vsock failure on VMADDR_CID_LOCAL testing
    • feb8fe6 Remove some actually unsupported termios iflags on redox
    • 97f6ec5 Lock bitflags to < 1.3.0 to fix the build with rust < 1.46.0
    • 4c70217 Merge pull request #1389 from asomers/r0.20.0
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • improve tests for scandir.go

    improve tests for scandir.go

    improve tests for scandir.go and watchdir.go mainly the onew using kqueue (freebsd netbsd openbsd dragonfly darwin)

    func (s *ScanDir) Start(ctl Control) {}
    

    and

    func (s *ScanDir) Scandir(ctl Control) error {}
    
Cross platform gRPC client
Cross platform gRPC client

Cross platform gRPC client Features Automatic parsing of proto definitions to render services and input messages .proto file discovery Selection of mu

Jan 4, 2023
Brook is a cross-platform strong encryption and not detectable proxy. Zero-Configuration. Brook 是一个跨平台的强加密无特征的代理软件. 零配置.

Brook 中文 v20210401 [GUI] Block list(Ad Block) Bypass & Block rule [GUI] Forward DNS [GUI] OpenWrt GUI client [GUI] Fake DNS [CLI] $ brook tproxy Scrip

Jan 4, 2023
Packiffer is a lightweight cross-platform networking toolkit that let you sniff/analyze/inject/filter packets.
Packiffer is a lightweight cross-platform networking toolkit that let you sniff/analyze/inject/filter packets.

Packiffer is a lightweight cross-platform networking toolkit that let you sniff/analyze/inject/filter packets.

Dec 19, 2022
Cross platform local network clipboard sync.

clipSync Synchronize clipboard content across multiple devices. Features Rapidly synchronize clipboard content to all devices in same local network. S

Jan 3, 2022
Cross-platform, multi-server chat app built using Fyne
Cross-platform, multi-server chat app built using Fyne

Fibro Really early days proof of concept for a cross-platform multi-server chat. Feel free to play, but don't expect it to do much! Features Multiple

Sep 10, 2022
cross-platform library for sending desktop notifications

Golang-Toast cross-platform library for sending desktop notifications Installation go get

Nov 24, 2022
Paw: a cross platform application to manage your passwords and identities securely
Paw: a cross platform application to manage your passwords and identities securely

Paw Paw is a cross platform application to manage your passwords and identities securely. It is written in Go and uses Fyne as UI toolkit and age as e

Oct 13, 2022
🖥️ Fast, modern and cross-platform SSH client
🖥️ Fast, modern and cross-platform SSH client

??️ Fast, modern and cross-platform SSH client Installation Build from source Requirements for building the project from source: Node 16 Go >= 1.17 Wa

Mar 20, 2022
A fast, high performance Cross-platform lightweight Nat Tracker Server,
A fast, high performance Cross-platform lightweight Nat Tracker Server,

NatTrackerServer A fast, high performance Cross-platform lightweight Nat Tracker Server suport IPv4 and IPv6 Tracker Server protocol 1、get NAT public

Apr 15, 2022
A cross-platform, decentralized, chat app based on SaltyIM for functionality and GioUI for UI

This project is shifted at https://git.mills.io/saltyim/app Salty UI A cross-platform, decentralized, chat app based on SaltyIM for functionality and

Aug 30, 2022
ClashWebLite is a cross-platform lightweighted wrapper for Clash Premium on Desktop environment.
ClashWebLite is a cross-platform lightweighted wrapper for Clash Premium on Desktop environment.

ClashWebLite ClashWebLite is a cross-platform lightweighted wrapper for Clash Premium on Desktop environment. http://127.0.0.1:9090/ui: Features Suppo

Dec 29, 2022
Gos: Armed Golang 💪 ( solutions for go module, goproxy, cross compilation, etc.)
Gos: Armed Golang 💪 ( solutions for go module, goproxy, cross compilation, etc.)

The current gos is still an alpha version, welcome more heroes to comment and improve it ?? , you can add more commands to it, or modify something to make it perform better.

Sep 15, 2022
Cross check makes health checks on PostgreSQL and MySQL database servers

Cross Check Cross check makes health checks on PostgreSQL and MySQL database servers, it also performs master & slave control for clusters in H/A Acti

Jan 14, 2022
Wrapper around bufcli to make it do cross-repo compiles for private repos and use full paths.
Wrapper around bufcli to make it do cross-repo compiles for private repos and use full paths.

Bufme A tool for compiling protos with full directory paths and cross repo compiles. Introduction Protocol buffers rock, but protoc should die in a fi

Feb 5, 2022
Zero Trust Network Communication Sentinel provides peer-to-peer, multi-protocol, automatic networking, cross-CDN and other features for network communication.
Zero Trust Network Communication Sentinel provides peer-to-peer, multi-protocol, automatic networking, cross-CDN and other features for network communication.

Thank you for your interest in ZASentinel ZASentinel helps organizations improve information security by providing a better and simpler way to protect

Nov 1, 2022
Seesaw v2 is a Linux Virtual Server (LVS) based load balancing platform.

Seesaw v2 Note: This is not an official Google product. About Seesaw v2 is a Linux Virtual Server (LVS) based load balancing platform. It is capable o

Jan 3, 2023
The Avalanche Platform Go Library

avalanchego-client The Avalanche Platform Go Library TODO's Admin API Auth API AVM API (X-Chain) EVM API (C-Chain) Health API Info API Keystore API Me

Jun 24, 2022
A major platform Remote Access Terminal Tool based by Blockchain/P2P.
A major platform Remote Access Terminal Tool based by Blockchain/P2P.

NGLite A major platform Remote Access Terminal Tool based by Blockchain/P2P. No public IP address required.More anonymity Example Detection Warning!!!

Jan 2, 2023
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Connecting the Next Billion People Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core

Dec 31, 2022