Overmind
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.
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!
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
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
Connecting to a process
If you need to gain access to process input, you can connect to its tmux
window:
$ overmind connect [process_name]
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 and/or your home directory. The file should contain variable=value
pairs, one per line:
PATH=$PATH:/additional/path
OVERMIND_CAN_DIE=npm_install
OVERMIND_PORT_BASE=3000
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
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.