Giter Club home page Giter Club logo

tmux-compose's Introduction

tmux-compose

Orchestrate the creation of tmux sessions with dependencies between commands in windows and panes.

This project is like a mash-up of docker-compose and teamocil/tmuxinator for tmux, hence the name "tmux-compose".

You create YAML config files that detail what windows and panes should be created and any commands that should be run in them. Then, you can setup dependencies between panes and windows to orchestrate the order in which the commands are run.

example.yml

dir: ~/project
sessions:
  - name: example
    windows:

      # Start a database
      - name: database
        panes:
          - cmd: service postgresql start
            readycheck:
              test: pg_isready -h localhost -p 5432 -U postgres
              interval: 3s
              retries: 3

      # Run a program that must start after the database is ready
      - panes:
          - cmd: ./myprogram
            depends_on: ["database"]

Bring up a tmux session:

tmux-compose -f example.yml up

Teardown a tmux session:

tmux-compose -f example.yml down

Installation

Prebuilt binaries for stable releases

Prebuilt binaries for multiple platforms can be downloaded from the releases page.

Automated build from source

tmux-compose was built with Go. If you already have Go setup, you go get the utility:

go get github.com/kevinms/tmux-compose
Manually build from source
git clone https://github.com/kevinms/tmux-compose.git
cd tmux-compose
go install

Go code can easily compile for other OSes, but this has only been tested on Linux.

Project

Example showing all options for the root node of the config file

dir: /path/to/project
up_pre_cmd: (date; echo start) > run.log
up_post_cmd: (date; echo done) >> run.log
down_pre_cmd: touch example.tmp
down_post_cmd: rm example.tmp
sessions:
  - name: example
    windows:
      - name: code
        panes:
        - cmd: vim
      - panes:
        - cmd: top

Sessions

Example showing all options being used for a window:

sessions:
  - name: example
    dir: ~/project
    readycheck:
      test: ping -c1 domain.net
      interval: 3s
      retries: 10
    depends_on: ["thing1", "thing2"]
    windows:
      - name: code
        panes:
        - cmd: vim
      - panes:
        - cmd: top

Windows

Example showing all options being used for a window:

sessions:
  - name: example
    windows:
      - name: My Window
        dir: ~/project
        focus: true
        layout: main-vertical
        depends_on: ["thing1", "thing2"]
        panes:
          - cmd: vim
          - cmd: sleep 5

Panes

Example showing all options being used for a pane:

sessions:
  - name: example
    windows:
      - panes:
        - name: My Pane
          dir: ~/project
          cmd: python -m SimpleHTTPServer 8000
          focus: true
          readycheck:
            test: ping -c1 domain.net
            interval: 3s
            retries: 10
          depends_on: ["thing1", "thing2"]

Directly Inspired By:

  • docker-compose
  • teamocil
  • tmuxinator
  • tmuxstart

tmux-compose's People

Contributors

kevinms avatar wraybowling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wraybowling

tmux-compose's Issues

Remove .git from go get

change go get github.com/kevinms/tmux-compose.git to go get github.com/kevinms/tmux-compose in readme

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.