cabotapp / docker-cabot

Docker and docker-compose files for Cabot
https://hub.docker.com/r/cabotapp/cabot/
58 stars 31 forks source link

Missing manage.py from Docker image #43

Closed jakubgs closed 4 years ago

jakubgs commented 4 years ago

I'd like to create the first superuser at setup time in order to later create all the checks and services using Ansible.

To figure out how to do that I've opened https://github.com/arachnys/cabot/issues/697 in which it turned out that:

As far as I'm concerned I just want a way to create a superuser with a password in a programmatic way so I can use the API without needing human intervention. The lack of manage.py makes this impossible.

I was thinking of inserting the user directly into the PostgreSQL database, but for that to work I think I'd need to know the salt for the pbkdf2_sha256 algorithm.

jakubgs commented 4 years ago

It appears that django-admin can fulfill the same role as python manage.py:

/ # django-admin shell
Python 2.7.15 (default, Dec 21 2018, 03:51:20) 
[GCC 6.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> User.objects.create_superuser('admin', 'admin@example.com', 'pass')
<User: admin>