Skip to content

Commit

Permalink
Cleanup docs (#394)
Browse files Browse the repository at this point in the history
* Small updates to pipeline.md

* Clarifying and adjusting readme

* Moving version to a cleaner spot.

* Added some clarification

---------

Co-authored-by: BuildTools <[email protected]>
  • Loading branch information
augustjohnson and BuildTools authored Dec 29, 2023
1 parent b16e3d1 commit f52cc9c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,19 @@ Smaller edits such as spelling mistakes can be edited directly in Github. For la

## Editing existing sources

Game Content is stored in the `data` directory. It is first split according to which document/source books it originated from and further into JSON files split by category e.g. "monsters.json", "spells.json". These can be edited directly. You can also add new categories to existing sources by creating the required JSON file. See an existing source, such as the 5.1 SRD to see how these should be structured.
Game Content is stored in the `data` directory. It is first split according `v1` and `v2`, which are distinct API versions. As of 2023-12-06, `v1` is the dataset exclusively used in production, but it's a good idea to check for the same data inside of v2. We use [fixtures](https://docs.djangoproject.com/en/4.2/topics/db/fixtures/) as our primary way of populating the database because of strong built-in support. Each fixture in v1 has been split out by Document Slug, and then Model. Find the one you'd like to edit inside of the appropriate ModelName.json file.

## Adding a new source

To add a new source, create new directory inside `data` and a `document.json` file that credits the source and links to the license it was published under. An example of this can be found [here](/data/a5e_srd/document.json). You can then add a json file for each category of content. See an existing source, such as the 5.1 SRD to see how these should be structured.
To add a new source, create new directory inside `data/v1` and a `Document.json` file that credits the source and links to the license it was published under. An example of this can be found [here](/data/v1/wotc-srd/Document.json). You can then add a json file for each Model Fixture of content. See an existing source, such as the 5.1 SRD to see how these should be structured.

A PK (or Primay Key) is text based slug for all game content, and it's used in the URL for getting that item. In the majority of cases, the PK should be the slugified version of the name. In the cases where an object PK would conflict with an existing PK, prepend a clear identifier to the PK.

**TODO SET CONVENTIONS FOR WHAT THE IDENTIFIER IS**

To load this new source, it must be added to the `SOURCE_DIRS` in [quickload.py](/api/management/commands/quickload.py). Rebuild the project to see the new Game Content.
## Change existing models

Models such as Monsters and Classes are stored in the [api/models](/api/models) directory. These define fields (hp, str, speed) and how they are output. The import of Game Content from `data` is handled by an [ImportSpec](/api/management/commands/importer.py)
Models such as Monsters and Classes are stored in the [api/models](/api/models) directory. These define fields (hp, str, speed) and how they are output. The import of Game Content from `data` is handled by django's built-in [loaddata](https://docs.djangoproject.com/en/4.2/ref/django-admin/#django-admin-loaddata).
# Tests
Expand All @@ -149,9 +152,6 @@ Recieved files shall not be included in the git repo.
# Deployment
The API is normally deployed via [Docker](https://docs.docker.com/get-started/). You can either build and host it yourself, or use one of the tested providers below:


## DigitalOcean
This deployment has been tested using [DigitalOcean Apps](https://www.digitalocean.com/go/cloud-hosting) with Docker Hub.
Expand All @@ -166,7 +166,6 @@ cd open5e-api/
docker-compose up
```

## Railway.app
1. Create a fork on Github. This is used to automatically deploy whenever you make a change.
2. Login with your Github account on [Railway.app](https://railway.app) and give it access to manage your forked repository.
Expand Down
2 changes: 1 addition & 1 deletion api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_version(_):
"""
API endpoint for data and api versions.
"""
import version
import server.version as version

return Response({
"DATA_V1":version.DATA_V1_HASH,
Expand Down
7 changes: 4 additions & 3 deletions docs/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ Digital Ocean is used for production and beta environments. We are using Digital
The root repository is https://github.com/open5e/open5e-api.

### Monitoring / Analytics
None (beyond Cloudflare's built-in analytics).
New Relic is being used, as well as cloudflare's built in analytics.

## Pipelines
We have four major flows.
| Pipeline | Trigger | Result |
| --- | --- | --- |
| PR Validation | pull_request, push (except to staging, main) | Python tests are run, and docker image is built. |
| Build and Deploy (Staging) | push (staging)| Docker image is built and pushed to DO staging app.|
| Build and Deploy (Production) | push (main) | Docker image is built and pushed to DO production app.|
| Build and Deploy (Staging) | push (staging)| Docker image is built and pushed to DO staging app, as well as docker hub.|
| Build and Deploy (Production) | push (main) | Docker image is built and pushed to DO production app, as well as docker hub.|
| Deploy Readme OpenAPI | push (main) | openAPI schema is pushed to readme.io.|


We have controls around the ***staging*** branch (no one is allowed to merge directly). We have similar controls around the ***main*** branch, but we also require that merges come from staging.
File renamed without changes.

0 comments on commit f52cc9c

Please sign in to comment.