IETF Datatracker

repository·main·Indexed 21 days ago

https://github.com/ietf-tools/datatracker

The primary web interface for the IETF database, used to manage and view IETF processes and documents. This Django-based application utilizes Vue 3/Vite and jQuery/Parcel frontend architectures. The repository includes documentation for local development via Docker and VS Code, frontend testing with Playwright, and various utility tools such as the Datatracker Diff Tool, Deploy to Container Tool, and k8s-get-deploy-name.

Tokens
27.2K
Snippets
115
Records
139
Agent score
75%

What's inside ietf-tools-datatracker

  1. Use the del-packages tool to clean up GitHub Packages

    main
    The del-packages tool automates the deletion of old container images in the GitHub Packages registry. It specifically targets the datatracker-db and datatracker-db-pg packages. The tool identifies and deletes any versions that are not the latest version and are older than 7 days.
  2. Use the Datatracker Diff Tool to compare instances

    main

    The Datatracker Diff Tool allows you to compare two different Datatracker instances (each with its own database) to identify changes. The tool runs entirely within Docker containers.

    When comparing:

    • The source instance uses the code from the current directory where the tool is executed.
    • The target instance can be a remote Git reference (tag, branch, or commit) or a local directory.
  3. Interact with local blob storage (MinIO)

    main

    The development and test environments use MinIO for local blob storage. The app container communicates with the blobstore container automatically.

    To interact with the MinIO API or console from outside the containers, use docker compose to find the ephemeral port:

    1. Find the port:
      docker compose port blobstore 9001
    2. The MinIO container exposes:
      • API: port 9000
      • Console: port 9001
    $ docker compose port blobstore 9001
    0.0.0.0:<some ephemeral port>
    
    $ curl -I http://localhost:<some ephemeral port>
    HTTP/1.1 200 OK
    ...
  4. UI Development with Bootstrap

    main

    The Datatracker uses Twitter Bootstrap for its UI.

    Best Practices

    • Use existing Bootstrap UI elements and CSS classes instead of custom styles.
    • Avoid tweaking Bootstrap CSS to prevent upgrade difficulties.
    • No <style> tags in HTML: Use the "morecss" block of a template instead.
    • CSS Organization: Shared CSS goes in static/css/ietf.css. Template-specific CSS goes in the template's "morecss" block.
    • Javascript Organization: Template-specific JS goes in the template's "js" block. Shared JS goes in static/js/ietf.js.
    • Avoid logic in templates: Do not put CSS, HTML styling, or Javascript inside Python code.
  5. Configure Kustomize deployment secrets

    main

    When performing a Kustomize deployment, the provided secrets.yaml file serves as a reference only. You must manually add a reference to this file within your kustomization.yaml configuration to ensure secrets are included in the deployment process.

    # Example kustomization.yaml entry
    resources:
      - secrets.yaml
      - deployment.yaml
  6. Run Python tests

    main

    To run the Python test suite, execute the manage.py test command from within a running datatracker container. You must specify the settings_test configuration.

    You can use the --pattern argument to filter and run only specific tests.

    ./ietf/manage.py test --settings=settings_test
  7. Run Playwright tests

    main

    You can run the frontend tests using predefined npm scripts or directly via the Playwright CLI.

    Predefined scripts:

    • npm test: Runs all tests in headless mode.
    • npm run test:visual: Runs all tests serially in visual (headed) mode.
    • npm run test:debug: Runs all tests in debug mode.
    # Running all tests headless
    npm test
    
    # Running all tests serially in visual mode (headed)
    npm run test:visual
    
    # Running all tests in debug mode
    npm run test:debug
  8. Use Datatracker with other editors or generic Docker

    main

    If not using VS Code, you can run the environment manually via the terminal from the project root.

    Linux / macOS

    ./docker/run

    Use ./docker/run -r to force a rebuild of the containers (useful when switching branches).

    Windows (PowerShell)

    Copy-Item "docker/docker-compose.extend.yml" -Destination "docker/docker-compose.extend-custom.yml"
    (Get-Content -path docker/docker-compose.extend-custom.yml -Raw) -replace 'CUSTOM_PORT','8000' | Set-Content -Path docker/docker-compose.extend-custom.yml
    docker compose -f docker-compose.yml -f docker/docker-compose.extend-custom.yml up -d
    docker compose exec app /bin/sh /docker-init.sh

    Running the server

    Once initialized, you will be dropped into a shell. Start the server with:

    ietf/manage.py runserver 8001

    Note: A debug SMTP server is launched automatically in this mode; emails are logged to the shell and discarded.

  9. Run Vue component and page tests

    main

    Vue tests run natively without external dependencies.

    Prerequisites:

    • Node.js 16.x or later installed on your machine.
    • A running yarn preview process in a separate terminal from the project root.

    Setup and Execution:

    1. Install dependencies (run once from the ./playwright directory):
      npm install
      npm run install-deps
    2. Start the preview server (run from the project root):
      yarn preview
    3. Execute tests (run from the ./playwright directory):
      • Headless mode: npm test
      • Visual mode (cannot run in Docker): npm run test:visual
      • Debug mode (cannot run in Docker): npm run test:debug
    # From ./playwright
    npm install
    npm run install-deps
    
    # From project root
    yarn preview
    
    # From ./playwright
    npm test