defang icon indicating copy to clipboard operation
defang copied to clipboard

Handle "job-like" processes

Open raphaeltm opened this issue 1 year ago • 1 comments

I'm updating the django postgres sample to be ready for a workshop and there's a thing that I'm wondering... django kinda expects you to be able to run a command when you first get started to create a superadmin user. In the basic django sample, I did a bit of a hacky thing and run that command on startup... but ideally it would be a separate process / container. The real ideal would be to be able to run the command directly in a container, but I think we've determined elsewhere that that won't be happening.

Basically something like this would be helpful to run these kinds of maintenance commands that just need to run at the beginning of a deployment:

create-superuser:
    restart: no
runmigrations:
    restart: on-failure

Combined with depends_on this would really useful.

raphaeltm avatar Jan 21 '25 17:01 raphaeltm

Over the wekeend I decided to whip up a sample for Django + Celery because that's come up multiple times recently and this came up again. Just figured I'd leave that info here since Django is proving to be in high demand.

raphaeltm avatar Mar 17 '25 09:03 raphaeltm

Done

lionello avatar Sep 08 '25 17:09 lionello