djangoplay-cli / Architecture / Architecture Diagrams
DocsDjangoPlay CLIArchitectureArchitecture Diagrams

Architecture Diagrams

2 min readApplies to v1.0.6
On this page ▾
  1. 1. CLI command routing
  2. 2. HTTP startup flow
  3. 3. HTTPS startup flow
  4. 4. SSL certificate architecture
  5. 5. Logs architecture
  6. 6. Requested architecture style

1. CLI command routing

text
                         dplay
                           │
                           ▼
                    Typer application
                           │
             ┌─────────────┴─────────────┐
             │                           │
        root commands               system group
             │                           │
    ┌────────┼────────┬──────┐       ┌───┴────┐
    ▼        ▼        ▼      ▼       ▼        ▼
   http     ssl     worker  certs  doctor   reset
    │        │
    └────┬───┘
         │
         ▼
   shared startup services

2. HTTP startup flow

text
dplay http

    │
    ▼
ensure_repo()
    │
    ▼
ensure_venv()
    │
    ▼
load_config()
    │
    ▼
site configuration
    │
    ├───────────────┐
    ▼               ▼
set SITE_*      print_environment()
    │
    ▼
encrypt_env()
    │
    ▼
flush_redis()
    │
    ▼
collect_static()
    │
    ▼
restart_celery()
    │
    ▼
wait_for_celery()
    │
    ▼
stop_django()
    │
    ▼
open_browser(login URL)
    │
    ▼
python manage.py runserver host:port

3. HTTPS startup flow

text
dplay ssl

    │
    ▼
ensure_repo()
    │
    ▼
ensure_venv()
    │
    ▼
load_config()
    │
    ▼
set HTTPS SITE_* variables
    │
    ▼
encrypt_env()
    │
    ▼
flush_redis()
    │
    ▼
collect_static()
    │
    ▼
ensure_ssl_certificates()
    │
    ├── existing cert + matching SAN?
    │             │
    │             ├── yes ──► reuse
    │             │
    │             └── no ───► OpenSSL generate
    │
    ▼
restart_celery()
    │
    ▼
wait_for_celery()
    │
    ▼
stop_django()
    │
    ▼
open_browser(login URL)
    │
    ▼
python manage.py runserver_plus
       + --cert-file
       + --key-file

4. SSL certificate architecture

text
~/.dplay/config.yaml
          │
          ▼
      _build_san()
          │
          ├── DNS:localhost
          ├── DNS:*.localhost
          ├── IP:127.0.0.1
          ├── configured host
          └── configured subdomains
                    │
                    ▼
             SAN comparison
                    │
              ┌─────┴─────┐
              │           │
           matches      mismatch
              │           │
              ▼           ▼
            reuse       OpenSSL
                          │
                          ▼
              ~/.dplay/ssl/localhost.crt
              ~/.dplay/ssl/localhost.key
                          │
              ┌───────────┼────────────┐
              ▼           ▼            ▼
           macOS        Linux          WSL
         Keychain     CA store      Windows store

5. Logs architecture

text
webapp/logs/
    │
    ├── django.log
    ├── users.log
    ├── mailer.log
    └── ...
          │
          ▼
     get_available_apps()
          │
          ▼
     resolve_log_file()
          │
          ▼
       tail file
          │
          ▼
      parse format
          │
          ▼
    level filtering
          │
          ▼
   ANSI pretty printing
          │
          ▼
       terminal

6. Requested architecture style

text
DjangoPlay repository

        │

        ▼

    Repo Detector

        │

        ├── Git repository?
        │
        └── DjangoPlay path?

                │

                ▼

        Active virtualenv

                │

                ▼

        ~/.dplay/config.yaml

                │

                ▼

       Command Orchestrator

                │

        ┌───────┼────────┐
        │       │        │
        ▼       ▼        ▼
      Redis   Static   Celery
      flush   collect  restart

                │

                ▼

          Django server

                │

                ▼

             DISPLAY