Skip to content

BetterCorp/BetterTunnels

Repository files navigation

BetterTunnels

HTTP/HTTPS development tunnels using BSB, H3, AnyVali, websocket clients, Prisma, and PostgreSQL 18.

Dev Setup

npm install
copy .env.example .env
npm run prisma:generate
npm run build

Start PostgreSQL 18 with the included compose file when Docker is available:

docker compose up -d postgres
npm run prisma:migrate

Run the server:

npm run dev

Server startup goes through BSB. Do not start a standalone src/server.ts.

Run a tunnel:

npm run cli -- http 3300

Build the release CLI:

cd cli
go build -o ..\dist\btunnel.exe .

Notes

  • Default domain: tunnels.betterportal.dev.
  • Anonymous configured prefixes are ignored.
  • Authenticated prefix handling is designed but auth is not in the first runtime slice.
  • The H3/WS runtime is owned by the service-tunnels-proxy BSB plugin.
  • The release CLI lives in cli/ and builds to single-file Go binaries for Windows, Linux, and macOS.

Docker

Build the BSB runtime image with this plugin preloaded:

docker build -t better-tunnels:dev .

Run it with a production DATABASE_URL:

docker run --rm -p 8080:8080 -p 8081:8081 -e DATABASE_URL="postgresql://..." better-tunnels:dev

Swarm Deploy

On the server, build local images, run migrations, then deploy the stack:

docker swarm init
docker build -t bettertunnels-app:latest .
docker build -t bettertunnels-migrate:latest --target build .
docker build -t bettertunnels-caddy:latest -f Dockerfile.caddy .
docker stack deploy -c docker-stack.yml bettertunnels

app runs two replicas with start-first rolling updates. Caddy and Postgres are singletons on this one-node swarm. The stack reuses the original Compose volumes by external name.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors