cvat icon indicating copy to clipboard operation
cvat copied to clipboard

Automatically create superuser

Open tadejsv opened this issue 3 years ago • 8 comments

I would suggest that the CVAT container automatically creates a superuser on startup, with username/password/email set by the DJANGO_SUPERUSER_* env variables.

Right now, users have to manually create the superuser account using docker exec after the container starts. But since they will always need a superuser, wouldn't it make more sense to just create one from the entrypoint script? This would also make automatically setting up CVAT much easier, as it eliminates all manual actions.

If this is something that you think would be a good addition to CVAT, I can take a shot at creating a PR.

tadejsv avatar Jul 18 '21 20:07 tadejsv

@tadejsv

IMHO If we have default settings for these variables, many users will not change them, it is less secure.

If we obligate a user to specify these variables before the build, UX is not really well, because the build will be failed without them. What is more, what is the difference if in both cases a user must do some additional steps?

bsekachev avatar Jul 19 '21 08:07 bsekachev

Regarding defaults: we can leave the default as it is now: so these new env variables unset, and no superuser created. So the user has an option to create a superuser automatically, but it is not an obligation.

As for the difference compared to now: let's take the use case where you want to set up all the infrastructure automatically, for example using Terraform (which I am using now), or some other IaaC product. Currently, after the setup is complete, you will need to somehow log into the instance that is running the container, and manually execute the shell command - it's an "annoying" step, and also forces you to open up your instance for SSH connections. You also need to manually note somewhere what the username/password of superuser will be (or where are they stored), because it is not evident from configuration.

If this is automated, I can just specify these environmental variables in my configuration (which also allows me to do it in a more organized way - for example to store/retrieve them using AWS Secrets Manager), and when the infrastructure is created, everything works out of the box.

tadejsv avatar Jul 19 '21 09:07 tadejsv

@bsekachev any update on this? If you still don't agree with the proposal feel free to close the issue

tadejsv avatar Jul 24 '21 14:07 tadejsv

@tadejsv , it is fine to have an alternative way to create super users. Could you please contribute the functionality?

nmanovic avatar Jul 26 '21 06:07 nmanovic

@nmanovic Can I take this issue. My Idea is basically to add the default arguments in cmd_init in backend_entrypoint.sh, is this feasible or should I try it some other way. We can then make another py file to delete the default superuser if the user wishes so.

AKxy4321 avatar Apr 01 '24 18:04 AKxy4321

I can add the environment variables feature if the changes in the code are approved

AKxy4321 avatar Apr 02 '24 16:04 AKxy4321

@nmanovic Are there any limitations on the Open Source Library FiftyOne for the importing and exporting datasets problem, because if there are no problems then I can automate the dataset conversion using that and add some other features to make it more convenient for the user to use.

AKxy4321 avatar Apr 03 '24 01:04 AKxy4321

@AKxy4321 , no limitations, but we are using Datumaro library for the purpose currently.

nmanovic avatar Apr 08 '24 20:04 nmanovic