Skip to content

ietf-tools/rpc

RPC

License Python Version Django Version Node Version Nuxt Version Vue Version

Web tool for the RFC Production Center

Development

Prerequisites

Getting Started

  1. Clone this repository locally.
  2. Clone the ietf-tools/datatracker repository into another directory. Check out the feat/rpc-api branch, start the Docker environment, and start the dev server.
  3. Continue using the steps for your preferred IDE:
  4. Create demo data if you have not already

Using VS Code

  1. Open the project in VS Code
  2. When prompted, in the lower right corner, click Reopen in container
  3. Wait for the devcontainer to initialize. (This can take a few seconds/minutes the first time)
  4. The editor will automatically open 2 side-by-side terminals, running both the backend API server and the client dev server.
  5. Open http://localhost:8088 in your browser and login using some Datatracker user.

Using Generic

  1. In a terminal, from the project root folder, run the command:
    docker/run
  2. Wait for the containers to initialize. (This can take a few seconds/minutes the first time)
  3. A tmux session will automatically be started with the backend API server running on the left and the client dev server running on the right.
  4. Open http://localhost:8088 in your browser and login using some Datatracker user.

Tips

  • The tmux default prefix binding is set to Ctrl+Space and mouse control is enabled by default.
  • If you exit tmux, you'll land in a normal zsh prompt. Type exit again to quit and stop the containers.

Commands

Django Backend API (/workspace)

  • Start Server: ./manage.py runserver 8001

Nuxt Client (/workspace/client)

  • Run Dev Server: npm run dev
  • Generate Production Build: npm run build

Create demo data

To create demo data, open an app container shell and run the management command

./manage.py create_demo_data

This requires that the Datatracker dev server be running.

To remove all data and start afresh, you can run

./manage.py purge --yes-im-sure

and all data in the RPC tool's database will be reset. The Datatracker will not be reset, but running create_demo_data again will work as intended.

APIs

This project uses two distinct HTTP APIs. Both are accessed using clients generated from OpenAPI specifications. The clients are generated using OpenAPI Generator.

Front-end to Back-end: rpctracker_api

This API is used by the Nuxt Client front end to communicate with the Django back end. This API is defined by this project through an OpenAPI specification in rpctracker_api.json. The API is implemented using the django-rest-framework and the spec is generated using drf-spectacular.

Back-end to Datatracker: rpcapi

This API is used by the Django back end to communicate with the Datatracker. It is implemented in the Datatracker code and described (as of Jan 2024) by a hand-written OpenAPI spec in rpcapi.json. The current version of the spec is fetched from the Datatracker's feat/rpc-api branch when starting this project's Docker environment. If the API is updated on the Datatracker side, you must manually copy the new rpcapi.json into the root of this project and update the clients as described in the next section.

Updating the API clients

If changes are made to the APIs, you will need to update the clients. If this includes changes to the Datatracker's rpcapi.json file you must first copy the new version of that file into this project's root. Then, from inside this project's Docker shell, run

./update=rpcapi

This uses OpenAPI Generator to regenerate rpctracker_api.json and builds both the API clients. It may take a minute or two. When it is done, restart the Django dev server. The Nuxt server normally picks up the changes automatically.

Cleanup

To fully tear down the containers created in either of the VS Code or Generic steps, run the following command from the project root folder:

docker/cleanall

Press Y to confirm.