basti-app / basti

✨ Securely connect to RDS, Elasticache, and other AWS resources in VPCs with no idle cost
https://www.basti.app
MIT License
351 stars 18 forks source link

Support multiple simultaneous connections #40

Open BohdanPetryshyn opened 1 year ago

BohdanPetryshyn commented 1 year ago

Summary

Sometimes you need to connect to multiple resources in your remote environment simultaneously. Currently, you need to run Basti multiple times in separate terminal windows. Being able to connect to multiple targets with a single Basti command would be useful.

Solution

UX

In interactive (basti connect) and automatic (basti connect <options>) modes, multiple target selection will become cumbersome. Multiconnect should only be supported in the predefined connection mode, when all the connection targets are defined in a configuration file.

A new top-level field "connection-groups" (the name is discussable) has to be introduced. The field will reference multiple connections. The connections might also be inlined like with target inlining.

connection-groups:
  prod:
    connections:
      - database-prod
      - cache-prod
  dev:
    connections:
      - database-dev
      - cache-dev

connections:
  database-dev:
    ...
  database-prod:
    ...
  cache-dev:
    ...
  cache-prod:
    ...

Connection groups and connection names must be unique. In other words, a connection group can't have the same name as a connection. This will allow to keep the connection command concise:

basti connect <connection | connection-group>

Tracking multiple connections

Basti must track and display the statuses of all the simultaneous connections. The application must exit when at least one of the connections dies.