#Stopping a service after using 'up'

1 messages · Page 1 of 1 (latest)

ebon path
#

I have a function that returns a service:

@func()
  serve(@argument({ defaultPath: "/backend" }) source: Directory): Service {
    return this.buildEnv(source)
      .withServiceBinding("db", this.postgres())
      .withEnvVariable("DATABASE_URL", `postgresql://postgres:postgres@db:5432/todo?schema=public`)
      .withEnvVariable("PORT", "3001")
      .withExposedPort(3001)
      .withExec(["bun", "run", "migrate"])
      .withEntrypoint(["bun", "run", "dev"])
      .asService()
  }

I can start the service with:

serve | up

And it starts, with me being able to query it from localhost in another terminal. However, I don't know how to properly stop it. It looks like the Dagger CLI is stuck counting at the asService step and it doesn't respond to any command I type in.

Am I going about this wrong?

ebon path
#

To provide more clarity, I'm wondering if it's possible to use Dagger to assist in local development. It seems redundant to have a docker-compose file and Dagger at the same time (maybe they serve two different functions).

My hope was that I can have a developer just call dagger call ... and have a local development version of the app (complete with its dependent services) running locally for the developer to use.

visual lichen
ebon path
#

Yeah, that's basically what I am seeing. It's feeling like I might be putting a round peg in a square hole, though. Perhaps it's best to keep local development with docker-compose.

visual lichen