All Projects → wrfly → Container Web Tty

wrfly / Container Web Tty

Licence: apache-2.0
Connect your containers via a web-tty

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Container Web Tty

Gritty
web terminal emulator
Stars: ✭ 63 (-59.62%)
Mutual labels:  terminal, tty
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-37.18%)
Mutual labels:  terminal, tty
Tty Prompt
A beautiful and powerful interactive command line prompt
Stars: ✭ 1,210 (+675.64%)
Mutual labels:  terminal, tty
Gors
go实现的终端录屏程序
Stars: ✭ 19 (-87.82%)
Mutual labels:  terminal, tty
Dksnap
Docker Snapshots for Development and Test Data
Stars: ✭ 122 (-21.79%)
Mutual labels:  terminal, containers
Tty Pager
Terminal output paging - cross-platform, major ruby interpreters
Stars: ✭ 37 (-76.28%)
Mutual labels:  terminal, tty
Zui
⬢ Zsh User Interface library – CGI+DHTML-like rapid application development with Zsh
Stars: ✭ 95 (-39.1%)
Mutual labels:  terminal, tty
Upterm
A terminal emulator for the 21st century.
Stars: ✭ 19,441 (+12362.18%)
Mutual labels:  terminal, tty
Xterm.js
A terminal for the web
Stars: ✭ 12,019 (+7604.49%)
Mutual labels:  terminal, tty
Termion
Mirror of https://gitlab.redox-os.org/redox-os/termion
Stars: ✭ 1,654 (+960.26%)
Mutual labels:  terminal, tty
Ruby jard
Just Another Ruby Debugger. Provide a rich Terminal UI that visualizes everything your need, navigates your program with pleasure, stops at matter places only, reduces manual and mental efforts. You can now focus on real debugging.
Stars: ✭ 669 (+328.85%)
Mutual labels:  terminal, tty
Asciinema Player
asciinema player is an open-source terminal session player written in Javascript and Rust/WASM. Unlike other video players asciinema player doesn't play heavy-weight video files (.mp4, .webm etc) and instead plays light-weight terminal session files called asciicasts.
Stars: ✭ 1,948 (+1148.72%)
Mutual labels:  terminal, tty
Tio
tio - A simple TTY terminal I/O application
Stars: ✭ 489 (+213.46%)
Mutual labels:  terminal, tty
Tty Font
Terminal fonts
Stars: ✭ 44 (-71.79%)
Mutual labels:  terminal, tty
Tty Spinner
A terminal spinner for tasks that have non-deterministic time frame.
Stars: ✭ 386 (+147.44%)
Mutual labels:  terminal, tty
Awesome Terminals
Terminal Emulators
Stars: ✭ 80 (-48.72%)
Mutual labels:  terminal, tty
Ttyd
Share your terminal over the web
Stars: ✭ 4,030 (+2483.33%)
Mutual labels:  terminal, tty
Tty Progressbar
Display a single or multiple progress bars in the terminal.
Stars: ✭ 377 (+141.67%)
Mutual labels:  terminal, tty
Tty Exit
Terminal exit codes.
Stars: ✭ 101 (-35.26%)
Mutual labels:  terminal, tty
Galacritty
WIP GTK terminal emulator based on Alacritty
Stars: ✭ 136 (-12.82%)
Mutual labels:  terminal, tty

Container web TTY

Go Report Card Master Build Status GoDoc license Docker Pulls MicroBadger Size GitHub release Github All Releases

中文

Tired of typing docker ps | grep xxx && docker exec -ti xxxx sh ? Try me!

Although I like terminal, I still want a better tool to get into the containers to do some debugging or checking. So I build this container-web-tty. It can help you get into the container and execute commands via a web-tty, based on yudai/gotty with some changes.

Both docker and kubectl are supported.

Usage

Of cause you can run it by downloading the binary, but thare are some Copy-and-Paste ways.

Using docker

You can start container-web-tty inside a container by mounting docker.sock:

docker run -dti --restart always --name container-web-tty \
    -p 8080:8080 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    wrfly/container-web-tty

# tail logs
docker logs -f container-web-tty

Using kubernetes

Or you can mount the kubernetes config file:

docker run -dti --restart always --name container-web-tty \
    -p 8080:8080 \
    -e WEB_TTY_BACKEND=kube \
    -e WEB_TTY_KUBE_CONFIG=/kube.config \
    -v ~/.kube/config:/kube.config \
    wrfly/container-web-tty

Using local <-> remote (gRPC)

You can deploy container-web-tty in remote servers, and connect to it via a local container-web-tty. They use gRPC for communication.

This is useful when you cannot get the remote servers or there are more than one server that you need to connect to.

Remote

Host 192.168.66.1 and 192.168.66.2 both running:

docker run -dti --restart always --name container-web-tty \
    -p 8080:8080 \
    -p 8090:8090 \
    -e WEB_TTY_GRPC_PORT=8090 \
    -e WEB_TTY_GRPC_AUTH=96ssW0rd \
    -v /var/run/docker.sock:/var/run/docker.sock \
    wrfly/container-web-tty

Notes:

  • You can disable the HTTP server by setting WEB_TTY_PORT=-1
  • The WEB_TTY_GRPC_AUTH must be the same between all hosts

Local

docker run -dti --restart always --name container-web-tty \
    -p 8080:8080 \
    -e WEB_TTY_BACKEND=grpc \
    -e WEB_TTY_GRPC_AUTH=96ssW0rd \
    -e WEB_TTY_GRPC_SERVERS=192.168.66.1:8090,192.168.66.2:8090 \
    wrfly/container-web-tty

Now you will see all the containers of all the servers via http://localhost:8080

Keyboard Shortcuts (Linux)

  • Cut the word before the cursor Ctrl+w => You cannot do it for now (I'll working on it for Ctrl+Backspace, but I know little about js)
  • Copy: Ctrl+Shift+c => Ctrl+Insert
  • Paste: Ctrl+Shift+v => Shift+Insert

Features

  • [x] it works
  • [x] docker backend
  • [x] kubectl backend
  • [x] beautiful index
  • [x] support docker ps options
  • [x] start|stop|restart container(docker backend only)
  • [x] proxy mode (client -> server's containers)
  • [x] auth(only in proxy mode)
  • [x] TTY timeout (idle timeout)
  • [x] history audit (just cat the history logs after enable this feature)
  • [x] real time sharing (like screen sharing)
  • [x] container logs (click the container name)
  • [x] exec arguments (append an extra "?cmd=xxx" argument in URL)
  • [x] connect to gRPC servers via HTTP/Socks5 proxy

Audit exec history and container outputs

docker run -dti --restart always --name container-web-tty \
    -p 8080:8080 \
    -e WEB_TTY_AUDIT=true \
    -v `pwd`/container-audit:/audit \
    -v /var/run/docker.sock:/var/run/docker.sock \
    wrfly/container-web-tty

After you exec some commands, you will see the inputs and outputs under the container-audit directory, you can use cat or tail -f to see the changes.

Real-time sharing

You can always share the container's inputs and outputs with others via the exec link, just share the /exec/<exec-ID> to them!

Collaborate

docker run -dti --restart always --name container-web-tty \
    -p 8080:8080 \
    -e WEB_TTY_COLLABORATE=true \
    -v /var/run/docker.sock:/var/run/docker.sock \
    wrfly/container-web-tty

By enabling this feature, once you exec into the container, you can share your process with others, that means anyone got the shareable link would type the command to the tty you are working on. You can edit the same file, type the same code, in the same TTY! Just share the exec link to your friend!

Options

GLOBAL OPTIONS:
   --addr value                 server binding address (default: "0.0.0.0")
   --audit-dir value            container audit log dir path (default: "audit")
   --backend value, -b value    backend type, 'docker' or 'kube' or 'grpc'(remote) (default: "docker")
   --control-all, --ctl-a       enable container control (default: false)
   --control-restart, --ctl-r   enable container restart (default: false)
   --control-start, --ctl-s     enable container start   (default: false)
   --control-stop, --ctl-t      enable container stop    (default: false)
   --debug, -d                  debug mode (log-level=debug enable pprof) (default: false)
   --docker-host value          docker host path (default: "/var/run/docker.sock")
   --docker-ps value            docker ps options
   --enable-audit, --audit      enable audit the container outputs (default: false)
   --enable-collaborate, --clb  collaborate on the same TTY process (default: false)
   --grpc-auth value            grpc auth token (default: "password")
   --grpc-port value            grpc server port, -1 for disable the grpc server (default: -1)
   --grpc-proxy value           grpc proxy address, in the format of http://127.0.0.1:8080 or socks5://127.0.0.1:1080
   --grpc-servers value         upstream servers, for proxy mode(grpc address and port), use comma for split
   --help, -h                   show help (default: false)
   --idle-time value            time out of an idle connection
   --kube-config value          kube config path (default: "/home/mr/.kube/config")
   --port value, -p value       HTTP server port, -1 for disable the HTTP server (default: 8080)
   --version, -v                print the version (default: false)

Show-off

List the containers on your machine:

list

It will execute /bin/sh if there is no /bin/bash inside the container:

/bin/bash:

Run custom command:

Get container logs:

logs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].