diff options
author | Zach White <skullydazed@gmail.com> | 2021-08-10 07:47:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-10 07:47:53 -0700 |
commit | 9a0118c603e8a773ca468c2382204e475e5bf7d4 (patch) | |
tree | 338adb5d7a41edbe90c4f8f5d7c0dc049b552cd6 /docs/configurator_architecture.md | |
parent | aeff347a074495f5aea77612bb083f79f7fcaf17 (diff) | |
download | qmk_firmware-9a0118c603e8a773ca468c2382204e475e5bf7d4.tar.gz qmk_firmware-9a0118c603e8a773ca468c2382204e475e5bf7d4.zip |
Architecture documentation for Configurator and API (#13935)
* Architecture documentation for the configurator and api
* Apply suggestions from code review
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'docs/configurator_architecture.md')
-rw-r--r-- | docs/configurator_architecture.md | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/docs/configurator_architecture.md b/docs/configurator_architecture.md new file mode 100644 index 000000000..0d7fc8a73 --- /dev/null +++ b/docs/configurator_architecture.md | |||
@@ -0,0 +1,61 @@ | |||
1 | # QMK Configurator Architecture | ||
2 | |||
3 | This page describes the web architecture behind QMK Configurator at a high level. If you are interested in the architecture of the QMK Configurator code itself you should start at the [qmk_configurator](https://github.com/qmk/qmk_configurator) repository. | ||
4 | |||
5 | # Overview | ||
6 | |||
7 |  | ||
8 | |||
9 | # Detailed Description | ||
10 | |||
11 | QMK Configurator is a [Single Page Application](https://en.wikipedia.org/wiki/Single-page_application) that allows users to create custom keymaps for their QMK-compatible keyboard. They can export JSON representation of their keymaps and compile firmware binaries that can be flashed to their keyboard using a tool like [QMK Toolbox](https://github.com/qmk/qmk_toolbox). | ||
12 | |||
13 | Configurator gets metadata about keyboards from the Keyboard Metadata store and submits compile requests to the QMK API. The results of those compile requests will be made available on [Digital Ocean Spaces](https://www.digitalocean.com/products/spaces/), an S3-compatible data store. | ||
14 | |||
15 | ## Configurator Frontend | ||
16 | |||
17 | Address: <https://config.qmk.fm> | ||
18 | |||
19 | The [Configurator Frontend](https://config.qmk.fm) is compiled into a set of static files that are served by Github Pages. This action happens every time a commit is pushed to the [qmk_configurator `master`](https://github.com/qmk/qmk_configurator) branch. You can view the status of these jobs on the [qmk_configurator actions tab](https://github.com/qmk/qmk_configurator/actions/workflows/build.yml). | ||
20 | |||
21 | ## Keyboard Metadata | ||
22 | |||
23 | Address: <https://keyboards.qmk.fm> | ||
24 | |||
25 | The Keyboard Metadata is generated every time a keyboard in [qmk_firmware](https://github.com/qmk/qmk_firmware) changes. The resulting JSON files are uploaded to Spaces and used by Configurator to generate UI for each keyboard. You can view the status of this job on the [qmk_firmware actions tab](https://github.com/qmk/qmk_firmware/actions/workflows/api.yml). If you are a QMK Collaborator you can manually run this job using the `workflow_dispatch` event trigger. | ||
26 | |||
27 | ## QMK API | ||
28 | |||
29 | Address: <http://api.qmk.fm> | ||
30 | |||
31 | The QMK API accepts `keymap.json` files for compilation. These are the same files you can use directly with `qmk compile` and `qmk flash`. When a `keymap.json` is submitted the browser will poll the status of the job periodically (every 2 seconds or longer, preferably) until the job has completed. The final status JSON will contain pointers to source and binary downloads for the keymap. | ||
32 | |||
33 | QMK API always presents the source and binary downloads side-by-side to comply with the GPL. | ||
34 | |||
35 | There are 3 non-error status responses from the API- | ||
36 | |||
37 | 1. Compile Job Queued | ||
38 | 2. Compile Job Running | ||
39 | 3. Compile Job Finished | ||
40 | |||
41 | ### Compile Job Queued | ||
42 | |||
43 | This status indicates that the job has not yet been picked up by a [QMK Compiler](#qmk-compiler) node. Configurator shows this status as "Waiting for an oven". | ||
44 | |||
45 | ### Compile Job Running | ||
46 | |||
47 | This status indicates that the job has started compiling. Configurator shows this status as "Baking". | ||
48 | |||
49 | ### Compile Job Finished | ||
50 | |||
51 | This status indicates that the job has completed. There will be keys in the status JSON for source and binary downloads. | ||
52 | |||
53 | ## Redis/RQ | ||
54 | |||
55 | QMK API uses RQ to distribute jobs to the available [QMK Compiler](#qmk-compiler) nodes. When a `keymap.json` is received it's put into the RQ queue, where a `qmk_compiler` node will pick it up from. | ||
56 | |||
57 | ## QMK Compiler | ||
58 | |||
59 | [QMK Compiler](https://github.com/qmk/qmk_compiler) is what actually performs the compilation of the `keymap.json`. It does so by checking out the requested `qmk_firmware` branch, running `qmk compile keymap.json`, and then uploading the resulting source and binary to Digital Ocean Spaces. | ||
60 | |||
61 | When users download their source/binary, API will redirect them to the authenticated Spaces download URL. | ||