Skip to content

Commit

Permalink
Add support for triple ttys in showroom (#8850)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonykay authored Nov 22, 2024
1 parent 0a5d8b5 commit 132efd0
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
tty-triple-top:
image: {{ showroom_tty_image }}:{{ showroom_tty_image_tag }}
container_name: tty-triple-top
hostname: tty-triple-top
{% if showroom_ssh_method == 'sshkey' %}
volumes:
- "{{ showroom_user_home_dir }}/.ssh:{{ showroom_user_home_dir }}/.ssh"
{% endif %}
command:
- "--ssh-user={{ showroom_tab_double_tty_top_username }}"
{% if showroom_ssh_method == 'sshkey' %}
- "--ssh-config={{ showroom_user_home_dir }}/.ssh/config"
- "--ssh-key={{ showroom_user_home_dir }}/.ssh/id_{{ showroom_ssh_key_type }}"
- "--ssh-auth=publickey"
{% elif showroom_ssh_method == 'password' %}
- "--ssh-pass={{ showroom_ssh_password | default(f_user_data.default_ssh_password) | default(f_user_data.ssh_password) }}"
{% endif %}
- "--ssh-host={{ showroom_ssh_host | default(f_user_data.targethost) }}"
- "--ssh-port={{ showroom_ssh_port | default(f_user_data.targetport) | default(22) }}"
- "--base=/tty-triple-top"
{% if showroom_ttys_enable_tmux %}
- "--command=/usr/local/bin/showroom-tmux top"
{% endif %}
- "--allow-iframe=true"
labels:
- "traefik.enable=true"
- "traefik.http.services.tty-triple-top.loadbalancer.server.port=3000"
- "traefik.http.routers.tty-triple-topentrypoints=terminalsecure"
- "traefik.http.routers.tty-triple-top.tls.certresolver=le"
- "traefik.http.routers.tty-triple-top.rule=Host(`{{ showroom_host }}`) && PathPrefix(`/tty-triple-top`)"
- "traefik.http.routers.tty-triple-top.middlewares=terminal-stripprefix"
- "traefik.http.routers.tty-triple-top.middlewares=tty-triple-toptheader"
- "traefik.http.middlewares.tty-triple-top-stripprefix.stripprefix.prefixes=/tty-triple-top"
- "traefik.http.middlewares.tty-triple-toptheader.headers.customrequestheaders.X-Content-Type-Options=false"


tty-triple-middle:
image: {{ showroom_tty_image }}:{{ showroom_tty_image_tag }}
container_name: tty-triple-middle
hostname: tty-triple-middle
{% if showroom_ssh_method == 'sshkey' %}
volumes:
- "{{ showroom_user_home_dir }}/.ssh:{{ showroom_user_home_dir }}/.ssh"
{% endif %}
command:
- "--ssh-user={{ showroom_tab_double_tty_bottom_username }}"
{% if showroom_ssh_method == 'sshkey' %}
- "--ssh-config={{ showroom_user_home_dir }}/.ssh/config"
- "--ssh-key={{ showroom_user_home_dir }}/.ssh/id_{{ showroom_ssh_key_type }}"
- "--ssh-auth=publickey"
{% elif showroom_ssh_method == 'password' %}
- "--ssh-pass={{ showroom_ssh_password | default(f_user_data.default_ssh_password) | default(f_user_data.ssh_password) }}"
{% endif %}
- "--ssh-host={{ showroom_ssh_host | default(f_user_data.targethost) }}"
- "--ssh-port={{ showroom_ssh_port | default(f_user_data.targetport) | default(22) }}"
- "--base=/tty-triple-middle"
{% if showroom_ttys_enable_tmux %}
- "--command=/usr/local/bin/showroom-tmux middle"
{% endif %}
- "--allow-iframe=true"
labels:
- "traefik.enable=true"
- "traefik.http.services.tty-triple-middle.loadbalancer.server.port=3000"
- "traefik.http.routers.tty-triple-middleentrypoints=terminalsecure"
- "traefik.http.routers.tty-triple-middle.tls.certresolver=le"
- "traefik.http.routers.tty-triple-middle.rule=Host(`{{ showroom_host }}`) && PathPrefix(`/tty-triple-middle`)"
- "traefik.http.routers.tty-triple-middle.middlewares=terminal-stripprefix"
- "traefik.http.routers.tty-triple-middle.middlewares=tty-triple-middletheader"
- "traefik.http.middlewares.tty-triple-middle-stripprefix.stripprefix.prefixes=/tty-triple-middle"
- "traefik.http.middlewares.tty-triple-middletheader.headers.customrequestheaders.X-Content-Type-Options=false"


tty-triple-bottom:
image: {{ showroom_tty_image }}:{{ showroom_tty_image_tag }}
container_name: tty-triple-bottom
hostname: tty-triple-bottom
{% if showroom_ssh_method == 'sshkey' %}
volumes:
- "{{ showroom_user_home_dir }}/.ssh:{{ showroom_user_home_dir }}/.ssh"
{% endif %}
command:
- "--ssh-user={{ showroom_tab_double_tty_bottom_username }}"
{% if showroom_ssh_method == 'sshkey' %}
- "--ssh-config={{ showroom_user_home_dir }}/.ssh/config"
- "--ssh-key={{ showroom_user_home_dir }}/.ssh/id_{{ showroom_ssh_key_type }}"
- "--ssh-auth=publickey"
{% elif showroom_ssh_method == 'password' %}
- "--ssh-pass={{ showroom_ssh_password | default(f_user_data.default_ssh_password) | default(f_user_data.ssh_password) }}"
{% endif %}
- "--ssh-host={{ showroom_ssh_host | default(f_user_data.targethost) }}"
- "--ssh-port={{ showroom_ssh_port | default(f_user_data.targetport) | default(22) }}"
- "--base=/tty-triple-bottom"
{% if showroom_ttys_enable_tmux %}
- "--command=/usr/local/bin/showroom-tmux bottom"
{% endif %}
- "--allow-iframe=true"
labels:
- "traefik.enable=true"
- "traefik.http.services.tty-triple-bottom.loadbalancer.server.port=3000"
- "traefik.http.routers.tty-triple-bottomentrypoints=terminalsecure"
- "traefik.http.routers.tty-triple-bottom.tls.certresolver=le"
- "traefik.http.routers.tty-triple-bottom.rule=Host(`{{ showroom_host }}`) && PathPrefix(`/tty-triple-bottom`)"
- "traefik.http.routers.tty-triple-bottom.middlewares=terminal-stripprefix"
- "traefik.http.routers.tty-triple-bottom.middlewares=tty-triple-bottomtheader"
- "traefik.http.middlewares.tty-triple-bottom-stripprefix.stripprefix.prefixes=/tty-triple-bottom"
- "traefik.http.middlewares.tty-triple-bottomtheader.headers.customrequestheaders.X-Content-Type-Options=false"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div id="terminal_tab" class="tabcontent">
<div class="split top">
<iframe
id="tty-triple-top"
src="https://{{ showroom_host }}:{{ showroom_primary_port }}/tty-top/"
width="100%"
style="border:none;">
</iframe>
</div>
<div class="split middle">
<iframe
id="tty-triple-middle"
src="https://{{ showroom_host }}:{{ showroom_primary_port }}/tty-top/"
width="100%"
style="border:none;">
</iframe>
</div>
<div class="split bottom">
<iframe id="tty-triple-bottom"
src="https://{{ showroom_host }}:{{ showroom_primary_port }}/tty-bottom/"
width="100%"
style="border:none;">
</iframe>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<button class="tablinks" onclick="openTerminal(event, 'terminal_tab')" id="defaultOpen" tabindex="0">Terminals</button>

0 comments on commit 132efd0

Please sign in to comment.