shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

[Improvement]: Container databases for local runs of projects with db resources receive a random host port

Open iulianbarbu opened this issue 1 year ago • 1 comments

Describe the improvement

Starting locally projects that use resources like shared-db or aws-rds will spin up associated databases in docker containers, if not using local_uri. The setup maps the container's internal database port to a host port which is picked randomly. This is causing a few problems to users who rely on a standard db connection string set in an environment variable since they don't get a guarantee for the same host port and same connection strings between consecutive runs (with the db container deleted in between) or when starting the project with a version-controlled dev environment on another machine.

We want to fix this by enabling users to pick their host port when doing cargo shuttle run or enforce the port through the code.

Duplicate declaration

  • [X] I have searched the issues and this improvement has not been requested before.

iulianbarbu avatar Oct 04 '23 14:10 iulianbarbu

I would love this feature! I've been developing with Shuttle in a Rust Dev Container: https://github.com/microsoft/vscode-dev-containers/tree/main/containers/rust-postgres

but when I try to use the shuttle_shared_db::Postgres I run into this issue!

Butch78 avatar Dec 01 '23 23:12 Butch78