Skip to content

GlitchTip: Add ansible task to create initial superuser #52

Description

@magent-cryptograss

Problem

GlitchTip deployment doesn't create an initial admin user. Currently relies on ENABLE_OPEN_USER_REGISTRATION: "True" and manual registration, which violates the no-touch server philosophy.

When we went to check error logs today, we found no users existed in GlitchTip at all.

Solution

Add an ansible task that creates a superuser idempotently:

- name: Create GlitchTip superuser
  command: >
    docker exec glitchtip-web ./manage.py shell -c
    "from django.contrib.auth import get_user_model; 
     User = get_user_model();
     User.objects.filter(email='{{ glitchtip_admin_email }}').exists() or 
     User.objects.create_superuser('{{ glitchtip_admin_email }}', '{{ glitchtip_admin_password }}')"
  changed_when: false

Store credentials in vault alongside other secrets.

Also consider

  • Should we disable open registration once an admin exists?
  • Configure real email (currently EMAIL_URL: "consolemail://" just logs to console)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions