overmind

command module
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2018 License: MIT Imports: 13 Imported by: 0

README

Overmind

Build Status

Overmind is a process manager for Procfile-based applications and tmux. With Overmind, you can easily run several processes from your Procfile in a single terminal.

Procfile is a simple format to specify types of processes your application provides (such as web application server, background queue process, front-end builder) and commands to run those processes. It can significantly simplify process management for developers and is used by popular hosting platforms, such as Heroku and Deis. You can learn more about the Procfile format here or here.

There are some good Procfile-based process management tools, including foreman by David Dollar, which started it all. The problem with most of those tools is that processes you want to manage start to think they are logging their output into a file, and that can lead to all sorts of problems: severe lagging, losing or breaking colored output. Tools can also add vanity information (unneeded timestamps in logs). Overmind was created to fix those problems once and for all.

See this article for a good intro and all the juicy details! Introducing Overmind and Hivemind

Sponsored by Evil Martians

Overmind features

You may know several Procfile process management tools, but Overmind has some unique, extraterrestrial powers others don't:

  • Overmind starts processes in a tmux session, so you can easily connect to any process and gain control over it;
  • Overmind can restart a single process on the fly — you don't need to restart the whole stack;
  • Overmind allows a specified process to die without interrupting all of the other ones;
  • Overmind uses pty to capture process output — so it won't be clipped, delayed, and it won't break colored output;
  • Overmind can read environment variables from a file and use them as parameters so that you can configure Overmind behavior globally and/or per directory.

If a lot of those features seem like overkill for you, especially the tmux integration, you should take a look at Overmind's little sister — Hivemind!

Overmind screenshot

Installation

Note: At the moment, Overmind supports Linux, *BSD, and macOS only.

Overmind works with tmux, so you need to install it first:

# on macOS (with homebrew)
$ brew install tmux

# on Ubuntu
$ apt-get install tmux

Note: You can find installation manual for other systems here: https://github.com/tmux/tmux

There are three ways to install Overmind:

With Homebrew (macOS)
brew install overmind
Download the latest Overmind release binary

You can download the latest release here.

Build Overmind from source

You need Go 1.6 or later to build the project.

$ go get -u -f github.com/DarthSim/overmind

Note: You can update Overmind the same way.

Usage

In short: You can get help by running overmind -h and overmind help [command].

Running processes

Overmind reads the list of processes you want to manage from a file named Procfile. It may look like this:

web: bin/rails server
worker: bundle exec sidekiq
assets: gulp watch

To get started, you just need to run Overmind from your working directory containing a Procfile:

$ overmind start

You can also use the short alias:

$ overmind s
Specifying a Procfile

If a Procfile isn't located in your working directory, you can specify the exact path:

$ overmind start -f path/to/your/Procfile
$ OVERMIND_PROCFILE=path/to/your/Procfile overmind start
Specifying the ports

Overmind sets environment variable PORT for each process in your Procfile so that you can do things like this:

web: bin/rails server -p $PORT

Overmind assigns the port base (5000 by default) to PORT for the first process and increases PORT by port step (100 by default) for the each next one. You can specify port base and port step like this:

$ overmind start -p 3000 -P 10
$ OVERMIND_PORT=3000 OVERMIND_PORT_STEP=10 overmind start
Running only the specified processes

You can specify the names of processes you want to run:

$ overmind start -l web,sidekiq
$ OVERMIND_PROCESSES=web,sidekiq overmind start
Processes that can die

Usually, when a process dies, Overmind will interrupt all other processes. However, you can specify processes that can die without interrupting all other ones:

$ overmind start -c assets,npm_install
$ OVERMIND_CAN_DIE=assets,npm_install overmind start
Specifying the colors

Overmind colorizes process names with different colors. May happen that these colors don't match well with your color scheme. In this case, you can define your own colors using xterm color codes:

$ overmind start -b 123,123,125,126,127
$ OVERMIND_COLORS=123,123,125,126,127 overmind start

If you want Overmind to always use these colors, you can specify them in the environment file located in your home directory.

Connecting to a process

If you need to gain access to process input, you can connect to its tmux window:

$ overmind connect [process_name]

You can safely disconnet from the window by hitting Ctrl b and then d.

Restarting a process

You can restart a single process without restarting all the other ones:

$ overmind restart sidekiq

You can restart multiple processes the same way:

$ overmind restart sidekiq assets
Killing processes

If something goes wrong, you can kill all running processes:

$ overmind kill
Overmind environment

If you need to set specific environment variables before running a Procfile, you can specify them in the .overmind.env file in the current working directory, your home directory, or/and in the .env file in in the current working directory. The file should contain variable=value pairs, one per line:

PATH=$PATH:/additional/path
OVERMIND_CAN_DIE=npm_install
OVERMIND_PORT=3000

You can specify additional env file to load with OVERMIND_ENV variable:

$ OVERMIND_ENV=path/to/env overmind s
Specifying a socket

Overmind receives commands via a Unix socket. Usually, it opens a socket named .overmind.sock in a working directory, but you can specify the full path:

$ overmind start -s path/to/socket
$ OVERMIND_SOCKET=path/to/socket overmind start

All other commands support the same flag:

$ overmind connect -s path/to/socket web
$ overmind restart -s path/to/socket sidekiq
$ overmind kill -s path/to/socket

Author

Sergey "DarthSim" Aleksandrovich

Highly inspired by Foreman.

Many thanks to @antiflasher for the awesome logo.

License

Overmind is licensed under the MIT license.

See LICENSE for the full license text.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL