Skip to content

Commit 9693895

Browse files
authored
Start a tmuxinator example for controlling running and debugging easier across multiple panes (#88)
* Start a tmuxinator example for controlling running and debugging easier across multiple panes * start looking at adding just to simplify the processes for each window. * feat(tmux): ✨ tmux example opening up windows and splits
1 parent a30d087 commit 9693895

File tree

5 files changed

+137
-0
lines changed

5 files changed

+137
-0
lines changed

50_tmux_and_screen/TMUX.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ tmux, short for "terminal multiplexer", is a powerful command-line tool used in
2727
TODO:
2828

2929
* tmux in iterm
30+
* Do a few examples of tmuxinator entering pipenv and also selecting nvm.
3031

3132
## Configuration
3233

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# ./.tmuxinator.yml
2+
3+
name: docker_test
4+
root: ./
5+
6+
# Optional tmux socket
7+
# socket_name: foo
8+
9+
# Note that the pre and post options have been deprecated and will be replaced by
10+
# project hooks.
11+
12+
# Project hooks
13+
14+
# Runs on project start, always
15+
# on_project_start: command
16+
17+
# Run on project start, the first time
18+
# on_project_first_start: command
19+
20+
# Run on project start, after the first time
21+
# on_project_restart: command
22+
23+
# Run on project exit ( detaching from tmux session )
24+
# on_project_exit: command
25+
26+
# Run on project stop
27+
# on_project_stop: command
28+
29+
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
30+
# pre_window: rbenv shell 2.0.0-p247
31+
32+
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
33+
# tmux_options: -f ~/.tmux.mac.conf
34+
35+
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
36+
# tmux_command: byobu
37+
38+
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
39+
# startup_window: editor
40+
41+
# Specifies (by index) which pane of the specified window will be selected on project startup. If not set, the first pane is used.
42+
# startup_pane: 1
43+
44+
# Controls whether the tmux session should be attached to automatically. Defaults to true.
45+
# attach: false
46+
47+
windows:
48+
- editor:
49+
layout: main-horizontal
50+
# Synchronize all panes of this window, can be enabled before or after the pane commands run.
51+
# 'before' represents legacy functionality and will be deprecated in a future release, in favour of 'after'
52+
# synchronize: after
53+
panes:
54+
- build:
55+
- pushd ../../07_detect_os
56+
- docker buildx build --progress=plain -f Dockerfile.os -t detect-os .
57+
- docker rm detect-os
58+
- docker run --name detect-os detect-os
59+
- logs:
60+
- nix-shell -p lnav --run "sleep 2 && lnav docker://detect-os"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# TMUXINATOR DOCKER TEST
2+
3+
Test tmuxinator building and showing logs from a container.
4+
5+
* Build a docker container
6+
* Run the docker container
7+
* Get logs in the bottom window
8+
9+
TODO:
10+
11+
* Build the container, run and get the logs.
12+
* Split the windows in the correct direction.
13+
* Wondering if it's best to mix with just to control what gets run in each pane.
14+
15+
## Run
16+
17+
Use the [07_detect_os/README.md](../../07_detect_os/README.md) as an example.
18+
19+
```sh
20+
cd 50_tmux_and_screen/tmuxinator_docker_test
21+
tmuxinator
22+
23+
ctrl+b d
24+
25+
tmux kill-session -t docker_test
26+
```
27+
28+
## Creation
29+
30+
```sh
31+
tmuxinator new --local docker_test
32+
33+
# use just
34+
just start-tmux
35+
```
36+
37+
## Kill window
38+
39+
`ctrl+b + &` Kill Window
40+
41+
42+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# lists recipes
2+
default:
3+
@just -f docker.justfile --list
4+
5+
# list docker images
6+
list-images:
7+
docker images
8+
9+
# build dockerfile.processor
10+
build:
11+
@echo 'Build container'
12+
docker buildx build --progress=plain -f Dockerfile.processor -t processor .
13+
14+
# run processor
15+
run:
16+
@echo 'Run container'
17+
docker run --rm -it processor
18+
19+
# logs
20+
logs:
21+
@echo 'Container logs'
22+
lnav docker://detect-os
23+
24+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set dotenv-load := true
2+
3+
# default lists actions
4+
default:
5+
@just -f {{ source_file() }} --list
6+
7+
start-tmux:
8+
#!/usr/bin/env bash
9+
tmuxinator start -p ./.tmuxinator.yml
10+

0 commit comments

Comments
 (0)