Giter Site home page Giter Site logo

tmate-master's People

Contributors

aparcar avatar nicopace avatar nviennot avatar pini-gh avatar xordspar0 avatar zllovesuki avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

tmate-master's Issues

Internationalization of the websockets interface

Hello @nviennot (and all that contribute to the project!),
Thanks for such an amazing project!

We are integrating tmate to the LibreRouter.org, a Mesh Wireless Router that is Free/Libre open source software and hardware, and it is targetted at an international audience.

For now we are using tmate (that itself is in english, but that's fine), and making available the websocket interface through a mobile webapp that is embedded in this routers.

We would like for the strings within the websocket interface (the "session starting", "reconnecting", ...) to be localizable.

I've been checking the possibilities offered by Elixir's Phoenix, and there seems to be a library that enables localization of those strings: https://phrase.com/blog/posts/i18n-for-phoenix-applications-with-gettext/

It could be applied to the rest of the interface... but for us it would be enough to work on the websockets part.

We would contribute with the translation to spanish and portuguese once it comes to be.

thanks!

Run migrations

Hi. How to resolve this:

$ kubectl exec -it sts/master bash
bash-4.4$ bin/tmate remote_console
Node [email protected] is not running!
bash-4.4$ bin/tmate rpc 'Mix.Task.rerun("ecto.migrate", ["-r", Tmate.Repo, "--migrations-path", "./lib/tmate-0.1.1/priv/repo/migrations"])'
▸  Remote call failed with: :nodedown

Docker image - argument error - :erlang.binary_to_integer

Hi,

Still trying to setup a working docker-compose configuration. Here is my snippet for tmate-master:

  tmate-master:
    image: tmate/tmate-master:latest
    container_name: tmate-master
    restart: unless-stopped
    expose:
    - 4000
    environment:
      MASTER_BASE_URL: https://master-tmate.example.com/
      SECRET_KEY_BASE: secretkeybase
      INTERNAL_API_AUTH_TOKEN: internalapitoken
      PG_URI: postgres://tmate:postgrespassword@tmate-db:5432/tmate
      PG_POOLSIZE: 1
      ERL_COOKIE: erlcookie
      ERL_NODE_NAME: master-tmate.example.com
    networks:
      bridge:
      internal:

  tmate-db:
    image: postgres:12-alpine
    container_name: tmate-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: tmate
      POSTGRES_PASSWORD: postgrespassword
      POSTGRES_DB: tmate
    volumes:
    - pgdata:/var/lib/postgresql/data
    networks:
      internal:

Environment variables guessed from [1] and [2].
|1] https://github.com/tmate-io/tmate-kube/blob/master/prod/master.yaml
[2] https://github.com/tmate-io/tmate-master/blob/master/config/prod.exs

As I understand it, PG_SSL_CA_CERT and MAILGUN_* variables are not mandatory.

With these settings, tmate-master fails at startup with:

init terminating in do_boot ({,[{erlang,binary_to_integer,[],[]},{erl_eval,do_apply,6,[{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{erl_eval,exprs,5,[{_},{_}]},{elixir,eval_forms,4,[{_},{_}]},{Elixir.Code,e
                                             
=INFO REPORT==== 28-Feb-2021::15:07:50.086563 ===  
    application: mix                           
    exited: stopped                             
    type: temporary                                  
argument error                                  
    :erlang.binary_to_integer("5b33eff2b1cf")                              
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6               
    (stdlib) erl_eval.erl:449: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5                                                                                                                                                                       (elixir) src/elixir.erl:275: :elixir.eval_forms/4                                                                                                                                                                  (elixir) lib/code.ex:240: Code.eval_string/3                                                                                                                                                                       (mix) lib/mix/config.ex:158: anonymous fn/2 in Mix.Config.__import__!/2
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
                                                                                                                                                                                                                   {"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.ArgumentError',message=><<"argument error">>},[{erlang,binary_to_integer,[<<"5b33eff2b1cf">>],[]},{erl_eval,do_apply,6,[{file,"erl_ev
al.erl"},{line,680}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,449}]},{erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,126}]},{elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,275}]},{'Elixir.Code',eval_str
ing,3,[{file,"lib/code.ex"},{line,240}]},{'Elixir.Mix.Config','-__import__!/2-fun-0-',2,[{file,"lib/mix/config.ex"},{line,158}]},{'Elixir.Enum','-reduce/3-lists^foldl/2-0-',3,[{file,"lib/enum.ex"},{line,1948}]}]
}}                  
Unable to configure release!

What could be missing?

Thanks in advance.

Postgrex.Protocol failed to connect: ** (DBConnection.ConnectionError) tcp connect (tmate-db:5432): timeout

The server was running fine for 2 months before it suddenly stopped working. Whenever I try to run the container, after initializing I get the following error.

tmate-master      | 09:41:22.932 [error] Postgrex.Protocol (#PID<0.2044.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (tmate-db:5432): timeout
tmate-master      | 09:41:39.181 [error] Postgrex.Protocol (#PID<0.2045.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (tmate-db:5432): timeout
tmate-master      | 09:41:56.813 [error] Postgrex.Protocol (#PID<0.2041.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (tmate-db:5432): timeout

These errors come a while after the postgres db is accepting connections, so its not that either. It keeps retrying and failing continuously.

I have tried a lot of things, most of them point to the fact that its the tmate-master container which is unable to make the connection, the db is hosted fine.

The following is my docker-compose.yml Most of it is irrelevant I think, except for tmate-master and PG_URI

version: "3.5"

services:
  tmate-ssh-server:    
    image: tmate/tmate-ssh-server:latest    
    container_name: tmate-ssh-server    
    restart: unless-stopped    
    cap_add:    
    - SYS_ADMIN    
    ports:    
    - "2200:22"    
    environment:      
      WEBSOCKET_HOSTNAME: tmate-websocket      
      SSH_KEYS_PATH: "/etc/tmate-keys"      
      SSH_HOSTNAME: tmate.example.com      
      SSH_PORT_LISTEN: 22      
      SSH_PORT_ADVERTISE: 2200    
    volumes:    
    - ssh-keys:/etc/tmate-keys    
    - unix-sockets:/tmp/tmate/sessions    
    networks:      
      bridge:

  tmate-websocket:    
    image: tmate/tmate-websocket:latest    
    container_name: tmate-websocket    
    restart: unless-stopped    
    environment:      
      VIRTUAL_HOST: tmate-ws.example.com      
      VIRTUAL_PORT: 4001      
      CERT_NAME: example.com      
      WEBSOCKET_BASE_URL: wss://tmate-ws.example.com/      
      MASTER_BASE_URL: https://tmate.example.com/      
      USER_FACING_BASE_URL: https://tmate.example.com/      
      ERL_NODE_NAME: tmate.example.com      
      ERL_COOKIE: myerlcookie      
      DAEMON_HMAC_KEY: mydaemonhmackey      
      INTERNAL_API_AUTH_TOKEN: myinternalapiauthtoken    
    volumes:    
    - unix-sockets:/tmp/tmate/sessions    
    networks:      
      bridge:

  tmate-master:    
    image: tmate/tmate-master:latest    
    container_name: tmate-master    
    # https://github.com/tmate-io/tmate-master/issues/13#issuecomment-787470427    
    hostname: tmate-1    
    domainname: example.com    
    restart: unless-stopped    
    expose:    
    - 4000    
    environment:      
      VIRTUAL_HOST: tmate.example.com      
      VIRTUAL_PORT: 4000      
      CERT_NAME: example.com      
      MASTER_BASE_URL: 
      https://tmate.example.com/      
      ERL_COOKIE: myerlcookie      
      # Must match <hostname>.<domainname>      
      ERL_NODE_NAME: tmate-1.example.com      
      # ** (ArgumentError) cookie store expects conn.secret_key_base to be at least 64 bytes      
      SECRET_KEY_BASE: 0123456789abcdefghijklmnopqrstuvwxyz=0123456789abcdefghijklmnopqrstuvwxyz      
      INTERNAL_API_AUTH_TOKEN: myinternalapiauthtoken      
      PG_URI: postgres://tmate:postgrespassword@tmate-db:5432/tmate      
      # Muste be >= 2      
      PG_POOLSIZE: 5    
    networks:      
      bridge:
      internal:  
      
  tmate-db:    
    image: postgres:12-alpine    
    container_name: tmate-db    
    restart: unless-stopped    
    environment:      
      POSTGRES_USER: tmate      
      POSTGRES_PASSWORD: postgrespassword      
      POSTGRES_DB: tmate    
    volumes:
    - pgdata:/var/lib/postgresql/data
    networks:      
      internal:
      
volumes:  
  ssh-keys:  
  unix-sockets:  
  pgdata:
  
networks:  
  bridge:  
  internal:    
    internal: true

If anyone has any ideas as to why the server is failing the connection, please help.

I have tried a lot of changes

  • I have tried different versions of postgres for tmate-db. Everything from 11-alpine3.15 to 15. None of them work, all result in the same timeout
  • revert docker to an older snap. Same error still
  • Run the server from an old instance backup, still same error
  • Host a new postgres db on AWS RDS and connect to that instead. I still get the timeout, the server was looking in the right place since I got nxdomain after deleting that server
  • Connect to tmate-db through psql on host machine. Connection was made properly without issues
  • Ping tmate-db from tmate-master. Ping returned without issues
  • change networks on the docker compose. No changes still timed out

I am currently all out of ideas except for forking the original repo and trying to make a build myself. Which would be pretty challenging since I have no experience with Elixer. The project was working fine and suddenly stopped working, so I am very unsure on how to proceed.

Any ideas about even what to look into will be appreciated.

Database migration - Node [email protected] is not running!

Hi,

I'm trying to run database migration as instructed at #1 (comment). But it fails at lauching an elixir shell:

$ docker exec -it tmate-master bash
bash-4.4$ bin/tmate remote_console
Node [email protected] is not running!

The master instance's logs don't give any clue:

$ docker logs -f tmate-master
16:37:45.752 [info] [swarm on [email protected]] [tracker:init] started
16:37:45.871 [info] Running TmateWeb.Endpoint with cowboy 2.7.0 at 0.0.0.0:4000 (http)
16:37:45.876 [info] Access TmateWeb.Endpoint at https://tmate.example.com
16:37:50.754 [info] [swarm on [email protected]] [tracker:cluster_wait] joining cluster..
16:37:50.754 [info] [swarm on [email protected]] [tracker:cluster_wait] no connected nodes, proceeding without sync

The web interface shows up correctly at https://tmate.example.com.

Here is the related docker-compose snippet:

  tmate-master:
    image: tmate/tmate-master:latest
    container_name: tmate-master
    # https://github.com/tmate-io/tmate-master/issues/13#issuecomment-787470427
    hostname: tmate-1
    restart: unless-stopped
    expose:
    - 4000
    environment:
      MASTER_BASE_URL: https://tmate.example.com/
      ERL_COOKIE: myerlcookie
      ERL_NODE_NAME: tmate.example.com
      # ** (ArgumentError) cookie store expects conn.secret_key_base to be at least 64 bytes
      SECRET_KEY_BASE: 0123456789abcdefghijklmnopqrstuvwxyz=0123456789abcdefghijklmnopqrstuvwxyz
      INTERNAL_API_AUTH_TOKEN: myinternalapiauthtoken
      PG_URI: postgres://tmate:postgrespassword@tmate-db:5432/tmate
      PG_POOLSIZE: 1
    networks:
      bridge:
      internal:

Thanks in advance.

The demos videos aren't working

The video demos on the front page do not play. I see this error in the javascript console:

Source map error: Error: request failed with status 404
Resource URL: https://tmate.io/js/jquery-2.0.2.min.js
Source Map URL: jquery-2.0.2.min.map

I've tried with both Firefox and Chrome and my phone as well.

Help with master setup

Hello,
First of all thank you for the great job and for making it open source.

I am trying to deploy a self hosted version of tmate-master on Kubernetes and, as for now, I was able to deploy both tmate-websocket-server and tmate-ssh-server, but I really do not find a way to get the tmate-master working. I am getting an error on do_boot:

{"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.ArgumentError',message=><<"argument error">>},[{erlang,binary_to_integer,[<<"cjntv">>],[]},{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,680}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,449}]},{erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,126}]},{elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,275}]},{'Elixir.Code',eval_string,3,[{file,"lib/code.ex"},{line,240}]},{'Elixir.Mix.Config','-__import__!/2-fun-0-',2,[{file,"lib/mix/config.ex"},{line,158}]},{'Elixir.Enum','-reduce/3-lists^foldl/2-0-',3,[{file,"lib/enum.ex"},{line,1948}]}]}}
Unable to configure release!
Crash dump is being written to: erl_crash.dump...init terminating in do_boot ({,[{erlang,binary_to_integer,[],[]},{erl_eval,do_apply,6,[{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{erl_eval,exprs,5,[{_},{_}]},{elixir,eval_forms,4,[{_},{_}]},{Elixir.Code,e

=INFO REPORT==== 6-Dec-2019::11:20:31.189362 ===
    application: mix
    exited: stopped
    type: temporary
argument error
    :erlang.binary_to_integer("cjntv")
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:449: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5
    (elixir) src/elixir.erl:275: :elixir.eval_forms/4
    (elixir) lib/code.ex:240: Code.eval_string/3
    (mix) lib/mix/config.ex:158: anonymous fn/2 in Mix.Config.__import__!/2
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3

I suppose it could be related with migrations, but I can be wrong.
In tmate-kube/prod there is a txt file with this content:

# run twice. first time will fail with cannot find migrations
Mix.Task.rerun("ecto.migrate", ["-r", Tmate.Repo, "--migrations-path", "./lib/tmate-0.1.1/priv/repo/migrations"])

When should I call this command?

Unattended database migration

Hi,

I've now fully automated my tmate instance deployment, but for the database migration step. Is there a way to run it unattended in a production environment?

Thanks,

(FunctionClauseError) in master

Log from Kubernetes:

2020-03-15T11:22:00.001786074Z 11:22:00.001 [info] Checking for disconnected sessions
2020-03-15T11:22:00.001822426Z 11:22:00.001 [info] Pruning dead sessions older than 1 week
2020-03-15T11:22:00.091545475Z 11:22:00.091 [error] Task #PID<0.3345.0> started from #PID<0.3343.0> terminating
2020-03-15T11:22:00.091576961Z ** (FunctionClauseError) no function clause matching in Access.get/3
2020-03-15T11:22:00.091581334Z     (elixir) lib/access.ex:265: Access.get("{\"stale_ids\":[]}", "stale_ids", nil)
2020-03-15T11:22:00.091585115Z     (tmate) lib/tmate/ws_api.ex:11: Tmate.WsApi.get_stale_sessions/2
2020-03-15T11:22:00.091588367Z     (tmate) lib/tmate/session_cleaner.ex:58: Tmate.SessionCleaner.check_for_disconnected_sessions/2
2020-03-15T11:22:00.09159162Z     (elixir) lib/enum.ex:789: anonymous fn/3 in Enum.each/2
2020-03-15T11:22:00.091594817Z     (stdlib) maps.erl:232: :maps.fold_1/3
2020-03-15T11:22:00.091597854Z     (elixir) lib/enum.ex:1964: Enum.each/2
2020-03-15T11:22:00.091600817Z     (tmate) lib/tmate/session_cleaner.ex:35: Tmate.SessionCleaner.check_for_disconnected_sessions/0
2020-03-15T11:22:00.091603937Z     (quantum) lib/quantum/executor.ex:141: anonymous fn/3 in Quantum.Executor.run/4
2020-03-15T11:22:00.091606992Z Function: #Function<7.12665260/0 in Quantum.Executor.run/4>
2020-03-15T11:22:00.091610313Z     Args: []

Running the docker image from the lastest commit 5a30905

Database was populated via:

MIX_ENV=prod PG_URI='postgres://[redacted]' PG_POOLSIZE=1 mix ecto.migrate

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.