diff --git a/configs/containers/systemd/dev-databases.pod b/configs/containers/systemd/dev-databases.pod index c11ff1b..f547b3e 100644 --- a/configs/containers/systemd/dev-databases.pod +++ b/configs/containers/systemd/dev-databases.pod @@ -1,4 +1,3 @@ [Pod] PodName=databases -PublishPort=9090:3000 PublishPort=5432:5432 diff --git a/configs/containers/systemd/dev-dbui.container b/configs/containers/systemd/dev-dbui.container index 6a8b0f1..259e832 100644 --- a/configs/containers/systemd/dev-dbui.container +++ b/configs/containers/systemd/dev-dbui.container @@ -1,14 +1,11 @@ [Container] -Image=docker.io/dbgate/dbgate +Image=docker.io/adminneoorg/adminneo AutoUpdate=registry -Pod=dev-databases.pod -Environment=CONNECTIONS=POSTGRES -Environment=LABEL_POSTGRES="Localhost Postgres" -Environment=ENGINE_POSTGRES=postgres@dbgate-plugin-postgres -Environment=SERVER_POSTGRES=localhost -Environment=PORT_POSTGRES=5432 -Environment=USER_POSTGRES=postgres -Environment=PASSWORD_POSTGRES=1234 - -[Service] -ExecStartPost=/usr/bin/xdg-open http://localhost:9090 +Network=host +Environment=NEO_THEME=default +Environment=NEO_COLOR_VARIANT=green +Environment=NEO_JSON_VALUES_DETECTION=true +Environment=NEO_JSON_VALUES_AUTO_FORMAT=true +Environment=NEO_NAVIGATION_MODE=dual +Environment=NEO_PREFER_SELECTION=true +Environment=NEO_RELATION_LINKS=true diff --git a/configs/fish/functions/ssh-tunnel.fish b/configs/fish/functions/ssh-tunnel.fish new file mode 100644 index 0000000..fca446c --- /dev/null +++ b/configs/fish/functions/ssh-tunnel.fish @@ -0,0 +1,28 @@ +function ssh-tunnel + set -l label "Select SSH tunnel to activate:" + + set -l tunnel (fd . ~/.ssh/tunnels.d/ | fzf -d / --with-nth=6 --accept-nth=6 --nth=6 --preview='bat {}' --input-label=foo --input-label-pos=bottom | cut -d "." -f 1) + + if test -z $tunnel + return + end + + envsource "$HOME/.ssh/tunnels.d/$tunnel.conf" + + echo "Activating connection $tunnel..." + + if not systemctl --user is-active "database-ssh-tunnel@$tunnel.service" -q + systemctl --user start "database-ssh-tunnel@$tunnel.service" + end + + if test (string lower $DB_START_EXPLORER) = "true" + echo "Opening Databse in browser, password will be copied to the clipboard..." + + if not systemctl --user is-active "dev-dbui.service" -q + systemctl --user start "dev-dbui.service" + end + + wl-copy "$DB_PASSWORD" + xdg-open "http://localhost:8080?$DB_DRIVER=$TUNNEL_LOCAL_ADDRESS:$TUNNEL_LOCAL_PORT&username=$DB_USER&db=$DB_NAME&ns=public" + end +end diff --git a/configs/systemd/user/database-ssh-tunnel@.service b/configs/systemd/user/database-ssh-tunnel@.service new file mode 100644 index 0000000..7c1ce0e --- /dev/null +++ b/configs/systemd/user/database-ssh-tunnel@.service @@ -0,0 +1,10 @@ +[Unit] +Description=SSH Persistent port forward for %i, makes available remote port locally +After=network-online.target +Wants=network-online.target + +[Service] +EnvironmentFile=%h/.ssh/tunnels.d/%i.conf +ExecStart=/usr/bin/ssh -NT -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -L ${TUNNEL_LOCAL_ADDRESS}:${TUNNEL_LOCAL_PORT}:${TUNNEL_REMOTE_ADDRESS}:${TUNNEL_REMOTE_PORT} ${TUNNEL_SSH_HOST} +RestartSec=3 +Restart=always