Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Expand `ov` documentation and replace environment setup docs with `ov` instructions (#4567)

sarayourfriend90f87b8712b5
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 9e809fba5..6454f343c 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -9,7 +9,6 @@
// More info: https://containers.dev/features
// List of features and their default options: https://github.com/devcontainers/features/tree/main/src
"features": {
- // Openverse development environment requirement matrix: https://docs.openverse.org/general/general_setup.html#requirement-matrix
"ghcr.io/guiyomh/features/just:0": {},
"ghcr.io/devcontainers/features/python:1": {
// Match the Python version defined in `*/Pipfile`.
diff --git a/.github/ISSUE_TEMPLATE/new_source_suggestion.yml b/.github/ISSUE_TEMPLATE/new_source_suggestion.yml
index f225685b8..7eb2a87fa 100644
--- a/.github/ISSUE_TEMPLATE/new_source_suggestion.yml
+++ b/.github/ISSUE_TEMPLATE/new_source_suggestion.yml
@@ -71,7 +71,7 @@ body:
- The script must not use anything from `catalog/dags/retired/providers/provider_api_scripts/modules/etlMods.py`, since that module is deprecated.
- If the provider API has can be queried by 'upload date' or something similar, the script should take a `--date` parameter when run as a script, giving the date for which we should collect images. The form should be `YYYY-MM-DD` (so, the script can be run via `python my_favorite_provider.py --date 2018-01-01`).
- The script must provide a main function that takes the same parameters as from the CLI. In our example from above, we'd then have a main function `my_favorite_provider.main(date)`. The main should do the same thing calling from the CLI would do.
- - The script *must* conform to [PEP8][pep8]. Please use `./ov just lint` before committing.
+ - The script *must* conform to [PEP8][pep8]. Please use `ov just lint` before committing.
- The script should use small, testable functions.
- The test suite for the script may break PEP8 rules regarding long lines where appropriate (e.g., long strings for testing).
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 340be3a8b..d2e1f1497 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -24,9 +24,9 @@ Fixes #[issue number] by @[issue author]
- [ ] I added or updated tests for the changes I made (if applicable).
- [ ] I added or updated documentation (if applicable).
- [ ] I tried running the project locally and verified that there are no visible errors.
-- [ ] I ran the DAG documentation generator (`./ov just catalog/generate-docs` for catalog
- PRs) or the media properties generator (`./ov just catalog/generate-docs media-props`
- for the catalog or `./ov just api/generate-docs` for the API) where applicable.
+- [ ] I ran the DAG documentation generator (`ov just catalog/generate-docs` for catalog
+ PRs) or the media properties generator (`ov just catalog/generate-docs media-props`
+ for the catalog or `ov just api/generate-docs` for the API) where applicable.
[best_practices]:
https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_commit_guidelines
diff --git a/.gitignore b/.gitignore
index b9d3c693f..2ed8a4f76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,7 +13,7 @@ logs/
# Environment
.env
-.ov_aliases.json
+.ov_profile.json
# Python environments
env/
diff --git a/.vale/README.md b/.vale/README.md
index 3dabd518a..ce9441ad8 100644
--- a/.vale/README.md
+++ b/.vale/README.md
@@ -12,7 +12,7 @@ the Openverse monorepo, refer to the README at
To run Vale with Openverse's configuration, use the just recipe:
```bash
-./ov just .vale/run
+ov just .vale/run
```
This recipe _always_ builds Vale. The Openverse Vale docker image is fast to
diff --git a/api/justfile b/api/justfile
index 361aa978f..0df97fc80 100644
--- a/api/justfile
+++ b/api/justfile
@@ -87,11 +87,11 @@ recreate:
########
# Make a cURL GET request to service at the given path
-_curl-get path origin="http://localhost:50280":
+@_curl-get path origin="http://localhost:50280":
curl "{{ origin }}/v1/{{ path }}"
# Make a test cURL GET request to the API
-stats media="images" origin="http://localhost:50280":
+@stats media="images" origin="http://localhost:50280":
just _curl-get "{{ media }}/stats/" {{ origin }}
# Launch a `pgcli` shell in the web container
diff --git a/catalog/templates/template_test.py_template b/catalog/templates/template_test.py_template
index 733cd3ba9..4beb4d4bd 100644
--- a/catalog/templates/template_test.py_template
+++ b/catalog/templates/template_test.py_template
@@ -3,7 +3,7 @@ TODO: Add additional tests for any methods you added in your subclass.
Try to test edge cases (missing keys, different data types returned, Nones, etc).
You may also need to update the given test names to be more specific.
-Run your tests locally with `./ov just catalog/test -k {provider_underscore}`
+Run your tests locally with `ov just catalog/test -k {provider_underscore}`
"""
import json
diff --git a/catalog/tests/dags/providers/provider_api_scripts/test_cc_mixter.py b/catalog/tests/dags/providers/provider_api_scripts/test_cc_mixter.py
index 935b8ba67..c92a8319c 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/test_cc_mixter.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/test_cc_mixter.py
@@ -1,4 +1,4 @@
-"""Run these tests locally with `./ov just catalog/test -k cc_mixter`"""
+"""Run these tests locally with `ov just catalog/test -k cc_mixter`"""
import json
from pathlib import Path
diff --git a/catalog/tests/dags/providers/provider_api_scripts/test_inaturalist.py b/catalog/tests/dags/providers/provider_api_scripts/test_inaturalist.py
index 2767aee1b..377093b30 100644
--- a/catalog/tests/dags/providers/provider_api_scripts/test_inaturalist.py
+++ b/catalog/tests/dags/providers/provider_api_scripts/test_inaturalist.py
@@ -37,7 +37,7 @@ from providers.provider_api_scripts import inaturalist
# to pull a sample of records without breaking referential integrity.
# - Putting your final zipped test files in /tests/s3-data/inaturalist-open-data
# so that they will be synced over to minio.
-# - Run `./ov just down -v` and then `./ov just recreate` to make sure that the test data gets to
+# - Run `ov just down -v` and then `ov just recreate` to make sure that the test data gets to
# the test s3 instance. That process may take on the order of 15 minutes for the full
# dataset. You'll know that it's done when the s3-load container in docker exits.
# - Then, in airflow, trigger the dag possibly with configuration
diff --git a/docker/dev_env/exec.py b/docker/dev_env/exec.py
index a9d24f012..cf0c7806c 100644
--- a/docker/dev_env/exec.py
+++ b/docker/dev_env/exec.py
@@ -2,24 +2,100 @@ import json
import os
import sys
from pathlib import Path
+from textwrap import dedent
SHARED_ALIASES = {
- "j": ["just"],
- "nuxt": ["j", "p", "frontend", "dev"],
+ "j": {
+ "cmd": ["just"],
+ "doc": "A common alias for `just` to save three keystrokes (it adds up!)",
+ },
+ "nuxt": {
+ "cmd": ["j", "p", "frontend", "dev"],
+ "doc": "Run the Openverse frontend local development site",
+ },
}
+# Document alias usage and configuration here. Including it
+# in the command makes it easy to discover and noticeable when
+# making changes, so it will not go out of sync.
+# ov aliases is included in the root `ov` script to help make this visible
+# and is mentioned in the general setup documentation
+ALIAS_USAGE = """
+ov aliases
+
+USAGE
+ ov ALIAS [...args]
+ Run an aliased command configured for ov.
+
+ ov aliases [--help|-h]
+ List all available aliases. If --help is passed, display this help message instead.
+
+DESCRIPTION
+ `ov init` creates a ./ov_profile.json file at the root of the repository.
+ The "aliases" key of this JSON file should be a dictionary, with alias
+ configuration objects as the keys. The configuration object is a dictionary with
+ a "cmd" key assigned to a list of command arguments to expand the alias to.
+ You may also provide a "doc" key to document the alias. The documentation for
+ each alias is displayed by running `ov aliases`.
+
+ To run an alias, pass it as the command argument to ov. To run the built-in "j"
+ alias, run `ov j`.
+
+ Only the first argument passed to ov will be expanded using aliases. Aliases can
+ stack (that is, repeatedly expand the first argument, if an alias refers to another alias)
+ but only ever the leading argument of the expanded alias. For example, the built-in
+ alias "nuxt" expands to "j p frontend dev", and ov will expand "j" to "just". However,
+ if an alias "p", "frontend", or "dev" existed, ov will not expand those, as they are
+ not the leading argument of the expanded arguments list.
+""".strip()
+
+
+def alias_info(aliases: dict, args: list[str]):
+ if "--help" in args or "-h" in args:
+ print(ALIAS_USAGE)
+ return
+
+ # else, assume --list
+ output = "ov aliases\n"
+ longest_alias = len(sorted(aliases.keys())[-1])
+ for alias, cmd in aliases.items():
+ if isinstance(cmd, dict):
+ doc = cmd["doc"]
+ cmd = cmd["cmd"]
+ else:
+ doc = "No documentation found."
+
+ joined = " ".join(cmd)
+ output += dedent(
+ f"""
+ {alias}{' ' * (longest_alias - len(alias))} -> {joined}
+ {doc}
+ {'(Built-in alias)' if alias in SHARED_ALIASES else '(Personal alias)'}
+ """
+ )
+
+ print(output)
+
+
def expand_aliases(args: list[str]):
- ov_aliases = Path(os.getenv("OPENVERSE_PROJECT")) / ".ov_aliases.json"
- aliases = SHARED_ALIASES
- if ov_aliases.is_file():
- aliases |= json.loads(ov_aliases.read_text())
+ ov_profile = Path(os.getenv("OPENVERSE_PROJECT")) / ".ov_profile.json"
+ aliases = SHARED_ALIASES.copy()
+ if ov_profile.is_file():
+ aliases |= json.loads(ov_profile.read_text()).get("aliases", {})
args = sys.argv[1:]
+ if args[0] == "aliases":
+ return alias_info(aliases, args)
+
while args[0] in aliases:
- args = aliases.pop(args[0]) + args[1:]
+ alias = aliases.pop(args[0])
+ if isinstance(alias, dict):
+ args = alias["cmd"] + args[1:]
+ else:
+ args = alias + args[1:]
return args
@@ -27,6 +103,10 @@ def expand_aliases(args: list[str]):
if __name__ == "__main__":
args = expand_aliases(sys.argv[1:])
try:
- os.execvp(args[0], args)
+ if args is not None:
+ os.execvp(args[0], args)
except FileNotFoundError:
- sys.stdout.buffer.write(args[0].encode() + b": command not found\n")
+ print(f"{args[0]}: command not found")
+ exit(1)
+ else:
+ exit(0)
diff --git a/docker/dev_env/run.sh b/docker/dev_env/run.sh
index 8ca3a8f49..4adcce196 100755
--- a/docker/dev_env/run.sh
+++ b/docker/dev_env/run.sh
@@ -26,6 +26,8 @@ shared_args=(
run_args=(
-d
--name "$container_name"
+ # Use host network so things like Sphinx and the frontend that run directly in `ov`
+ # will have ports available on the host (and this way we don't have to manually map each one)
--network host
# Bind the repo to the same exact location inside the container so that pre-commit
# and others don't get confused about where files are supposed to be
@@ -44,7 +46,10 @@ run_args=(
# environment doesn't have one to attach.
# In other words, only tell Docker to attach a TTY to the container when
# there's one to attach in the first place.
-if [ -t 0 ]; then
+# Additionally, we only want to attach a TTY if the command is actually interactive
+# and not, instead, as part of a pipe.
+# -t 1 is false if 1 is not stdout (it's something else! a file, a pipe, etc)
+if [[ -t 0 && -t 1 ]]; then
shared_args+=(-t)
fi
diff --git a/docker/minio/load_to_s3_entrypoint.sh b/docker/minio/load_to_s3_entrypoint.sh
index 10e32a1c6..9d89dda7a 100755
--- a/docker/minio/load_to_s3_entrypoint.sh
+++ b/docker/minio/load_to_s3_entrypoint.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# This does *not* allow for testing permissions issues that may come up in real AWS.
-# And, if you remove files from /tests/s3-data, you will need to use `./ov just down -v`
-# and `./ov just up` or `./ov just recreate` to see the minio bucket without those files.
+# And, if you remove files from /tests/s3-data, you will need to use `ov just down -v`
+# and `ov just up` or `ov just recreate` to see the minio bucket without those files.
# Loop through subdirectories mounted to the volume and load them to s3/minio.
# This takes care of filesystem delays on some local dev environments that may make
# minio miss files included directly in the minio volume.
diff --git a/documentation/api/guides/https.md b/documentation/api/guides/https.md
index ef002b333..3e0119a38 100644
--- a/documentation/api/guides/https.md
+++ b/documentation/api/guides/https.md
@@ -10,26 +10,34 @@ Make sure you have gone through the
[quickstart guide](/api/guides/quickstart.md) before attempting this as this is
a slightly more advanced process.
-Additionally, you will need to install
-[mkcert](/general/general_setup.md#mkcert) as described in the
-[general setup guide](/general/general_setup.md).
+Additionally, you will need to install `mkcert`.
+[Follow `mkcert`'s installation guide](https://github.com/FiloSottile/mkcert?tab=readme-ov-file#installation)
+to do so.
+
+```{caution}
+`ov` does not yet support mkcert. You must run this command without `ov`
+on your host system for it to work.
+```
## Steps
1. Create certificates for NGINX to use.
+ ```{caution}
+ Run this on your host system, `ov` does not support mkcert.
+ ```
+
```bash
- ./ov just docker/nginx/cert
+ just docker/nginx/cert
```
This will create a certificate file `openversse.crt` and a key file
`openverse.key` in the `docker/nginx/certs/` directory.
-2. Bring the ingestion server and API up, along with all their dependent
- services.
+2. Start the API along with its dependencies:
```bash
- ./ov just api/up
+ ov just api/up
```
The `api/up` recipe orchestrates the following services: `cache`, `db`,
@@ -41,8 +49,7 @@ Additionally, you will need to install
3. Make an API call over HTTPS.
```bash
- ./ov just api/stats images https://localhost:50243
- ./ov just _curl-get "images/stats/" https://localhost:50243
- curl "https://localhost:50243/v1/images/stats/"
+ ov just api/stats images https://localhost:50243
+ ov just _curl-get "images/stats/" https://localhost:50243
[{"source_name":"flickr","display_name":"Flickr","source_url":"https://www.flickr.com","logo_url":null,"media_count":2500},{"source_name":"stocksnap","display_name":"StockSnap","source_url":"https://stocksnap.io","logo_url":null,"media_count":2500}]%
```
diff --git a/documentation/api/guides/quickstart.md b/documentation/api/guides/quickstart.md
index 2941f0b4b..3ea6a340f 100644
--- a/documentation/api/guides/quickstart.md
+++ b/documentation/api/guides/quickstart.md
@@ -1,47 +1,17 @@
-# Quickstart guide
+# API quickstart guide
This is the quick start guide for setting up and running the API locally.
## Prerequisites
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites. Refer to the 'API' column in the
-[requirement matrix](/general/general_setup.md#requirement-matrix) to know what
-you need to run this.
+Follow the [general setup guide](/general/general_setup.md) to set up `ov`.
## Starting up
-1. Ensure you download, install and set up all prerequisites. Ensure that the
- Docker daemon is running.
-
-2. Clone the repository to your computer. Then switch to the cloned directory.
- If you're planning to contribute, fork the repo and clone your fork instead.
-
- ```{note}
- We recommend cloning with the `--filter=blob:none` flag as it dramatically
- reduces the filesize and download time by creating a "blobless clone".
- You can learn more about these [here](https://gist.github.com/leereilly/1f4ea46a01618b6e34ead76f75d0784b).
- ```
-
- ```bash
- git clone --filter=blob:none https://github.com/WordPress/openverse.git # or your fork
- cd openverse/
- ```
-
- If you followed the general setup guide and installed
- [GitHub CLI](/general/general_setup.md#github-cli), you can clone more simply
- using the `gh` command.
-
- ```bash
- gh repo clone WordPress/openverse -- --filter=blob:none # or your fork
- cd openverse/
- ```
-
-3. Bring the ingestion server and API up, along with all their dependent
- services.
+1. Start the API along with its dependencies:
```bash
- ./ov just api/up
+ ov just api/up
```
The `api/up` recipe orchestrates the following services: `cache`, `db`,
@@ -53,38 +23,35 @@ you need to run this.
[http://localhost:50281/task](http://localhost:50281/task)
- the API documentation on [http://localhost:50280](http://localhost:50280)
-4. Load the sample data. This step can take a few minutes to complete.
+1. Load the sample data. This step can take a few minutes to complete.
```bash
- ./ov just api/init
+ ov just api/init
```
````{admonition} Troubleshooting
If this step fails, cleaning up and restarting usually fixes it.
```bash
- ./ov just down -v
- ./ov just api/init
+ ov just down -v
+ ov just api/init
```
````
-5. With the data loaded, the API can now return JSON responses to your HTTP
+1. With the data loaded, the API can now return JSON responses to your HTTP
requests.
```bash
- ./ov just api/stats
- ./ov just _curl-get "images/stats/" http://localhost:50280
- curl "http://localhost:50280/v1/images/stats/"
+ ov just api/stats
+ ov just _curl-get "images/stats/" http://localhost:50280
[{"source_name":"flickr","display_name":"Flickr","source_url":"https://www.flickr.com","logo_url":null,"media_count":2500},{"source_name":"stocksnap","display_name":"StockSnap","source_url":"https://stocksnap.io","logo_url":null,"media_count":2500}]%
```
````{tip}
- [`jq`](https://stedolan.github.io/jq/) is a tool for parsing and manipulating
- JSON data. If you have `jq` installed, you can pipe the response to it and
- transform it.
+ Use `jq`, [one of the tools included in `ov`](/general/general_setup.md#included-tools) to filter JSON output and make it easier to read:
```bash
- ./ov just api/stats | jq '.[0]'
+ ov just api/stats | ov jq '.[0]'
{
"source_name": "flickr",
"display_name": "Flickr",
@@ -93,18 +60,15 @@ you need to run this.
"media_count": 2500
}
- ./ov just api/stats 'audio' | jq '[.[] | .source_name]'
+ ov just api/stats 'audio' | ov jq '[.[] | .source_name]'
[
"freesound",
"jamendo",
"wikimedia_audio"
]
```
-
- `jq` is great, we recommend you
- [download](https://stedolan.github.io/jq/download/) it.
````
## Shutting down
-Refer to the [common instructions](/general/quickstart.md#shutting-down).
+Refer to the [common instructions](/general/general_setup.md#shutting-down).
diff --git a/documentation/api/guides/test.md b/documentation/api/guides/test.md
index 971291f6e..4797b56df 100644
--- a/documentation/api/guides/test.md
+++ b/documentation/api/guides/test.md
@@ -10,7 +10,7 @@ Once you've made some changes to the codebase, it is important to run tests.
2. Run the tests.
```bash
- ./ov just api/test
+ ov just api/test
```
```{note}
diff --git a/documentation/automations/guides/quickstart.md b/documentation/automations/guides/quickstart.md
index 75e757303..73c07b0c2 100644
--- a/documentation/automations/guides/quickstart.md
+++ b/documentation/automations/guides/quickstart.md
@@ -5,19 +5,16 @@ scripts written in Node.js or Python.
## Prerequisites
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites. Refer to the 'Management' column in the
-[requirement matrix](/general/general_setup.md#requirement-matrix) to know what
-you need to run this.
+Follow the [general setup guide](/general/general_setup.md) to set up `ov`.
## Installation
-`./ov just install` in the repository root directory will install all Python and
+`ov just install` in the repository root directory will install all Python and
Node.js dependencies for automations as well as other parts of the repository.
If you wish to install only dependencies for automations, run the following:
-- `pipenv install` in `automations/python`
-- `pnpm install --filter=automations`
+- `ov pipenv install` in `automations/python`
+- `ov pnpm install --filter=automations`
## Running a Script
@@ -27,10 +24,10 @@ Run Python automation scripts using the `automations/python/run` just recipe.
Ex.:
```bash
-./ov just automations/python/run print_labels.py
+ov just automations/python/run print_labels.py
```
-The recipe is an alias for running `pipenv run <script>` inside the
+The recipe is an alias for running `ov pipenv run <script>` inside the
`automations/python` directory. This facilitates correct `PYTHONPATH`
configuration as expected by many scripts.
@@ -39,10 +36,10 @@ configuration as expected by many scripts.
Run Node.js automation scripts using the `automations/js/run` just recipe. Ex.:
```bash
-./ov just automations/js/run render-jinja.js
+ov just automations/js/run render-jinja.js
```
-The recipe is an alias for running `pnpm exec <script>` inside the
+The recipe is an alias for running `ov pnpm exec <script>` inside the
`automations/js` directory. As such, any `automations/js` dependencies that make
executable scripts available can also be run using the same recipe.
diff --git a/documentation/catalog/guides/adding_a_new_provider.md b/documentation/catalog/guides/adding_a_new_provider.md
index a190b0687..275ba8dbc 100644
--- a/documentation/catalog/guides/adding_a_new_provider.md
+++ b/documentation/catalog/guides/adding_a_new_provider.md
@@ -62,18 +62,18 @@ that can be used to generate the files you'll need and get you started:
# MEDIA: Optionally, a space-delineated list of media types ingested by this provider
# (and supported by Openverse). If not provided, defaults to "image".
-> ./ov just catalog/add-provider <PROVIDER_NAME> <ENDPOINT> <MEDIA>
+> ov just catalog/add-provider <PROVIDER_NAME> <ENDPOINT> <MEDIA>
# Example usages:
# Creates a provider that supports just audio
-> ./ov just catalog/add-provider TestProvider https://test.test/search audio
+> ov just catalog/add-provider TestProvider https://test.test/search audio
# Creates a provider that supports images and audio
-> ./ov just catalog/add-provider "Foobar Museum" https://foobar.museum.org/api/v1 image audio
+> ov just catalog/add-provider "Foobar Museum" https://foobar.museum.org/api/v1 image audio
# Creates a provider that supports the default, just image
-> ./ov just catalog/add-provider TestProvider https://test.test/search
+> ov just catalog/add-provider TestProvider https://test.test/search
```
You should see output similar to this:
@@ -101,7 +101,7 @@ You can run the provider script directly from the command line via a just
recipe. This will open a bash shell inside the docker stack of the catalog.
```
-./ov just catalog/run
+ov just catalog/run
```
Now you can just run the script like so:
@@ -151,7 +151,7 @@ These are documented in the definition of the `ProviderWorkflow` dataclass.
<!--TODO: add docs for other options.-->
-After adding your configuration, run `./ov just up` and you should now have a
+After adding your configuration, run `ov just up` and you should now have a
fully functioning provider DAG!
<!--TODO: add and link to docs for how to run provider DAGs locally, preferably with images.-->
@@ -173,21 +173,21 @@ manually turn the DAG on in production.
selecting only the tests associated with the provider.
```bash
- ./ov just catalog/test-session
+ ov just catalog/test-session
pytest -k <provider_name>
```
Alternatively, the test selection can be run in Docker directly with:
```bash
- ./ov just catalog/test -k <provider_name>
+ ov just catalog/test -k <provider_name>
```
```{note}
-Using `./ov just catalog/test-session` opens Docker to access a shell which is set up to run
+Using `ov just catalog/test-session` opens Docker to access a shell which is set up to run
tests. This allows one to run tests repeatedly while potentially modifying the code,
without having to start the Docker container up each time the tests need to be run.
-Running the tests on Docker directly (e.g. using `./ov just catalog/test`) will spin up the
+Running the tests on Docker directly (e.g. using `ov just catalog/test`) will spin up the
container, run the selected tests if any are provided (or all by default) and then stop
and remove the container. That can be useful for ensuring that all tests pass if one
does not need to iterate and check the test failures repeatedly.
diff --git a/documentation/catalog/guides/dag_testing.md b/documentation/catalog/guides/dag_testing.md
index cab9c4a94..ed04cd272 100644
--- a/documentation/catalog/guides/dag_testing.md
+++ b/documentation/catalog/guides/dag_testing.md
@@ -17,7 +17,7 @@ might need to get the API keys from the provider and add them to the
1. Refer to and follow the instructions at [Quickstart](./quickstart.md) to
setup and make sure the catalog service is up and running. If you have
successfully completed the general setup then this can be started by running
- `./ov just catalog/up`.
+ `ov just catalog/up`.
2. Navigate to http://localhost:9090
diff --git a/documentation/catalog/guides/quickstart.md b/documentation/catalog/guides/quickstart.md
index 26144088c..e45f460cb 100644
--- a/documentation/catalog/guides/quickstart.md
+++ b/documentation/catalog/guides/quickstart.md
@@ -1,4 +1,4 @@
-# Quickstart
+# Catalog quickstart guide
This repository contains the methods used to identify over 1.4 billion Creative
Commons licensed works. The challenge is that these works are dispersed
@@ -52,11 +52,11 @@ To set up the local python environment along with the pre-commit hook, run:
<!-- vale Vale.Repetition = NO -->
```shell
-./ov just catalog/venv
-./ov bash
+ov just catalog/venv
+ov bash -c '
source catalog/.venv/bin/activate
just catalog/install
-exit
+'
```
<!-- vale Vale.Repetition = YES -->
@@ -65,7 +65,7 @@ The containers will be built when starting the stack up for the first time. If
you'd like to build them prior to that, run:
```shell
-./ov just build
+ov just build
```
### Environment
@@ -73,7 +73,7 @@ you'd like to build them prior to that, run:
To set up environment variables run:
```shell
-./ov just env
+ov just env
```
This will generate a `.env` file which is used by the containers.
@@ -92,11 +92,10 @@ The `.env` file does not need to be modified if you only want to run the tests.
### Running & Testing
-There is a [`docker-compose.yml`][dockercompose] provided in the
-[`catalog`][cc_airflow] directory, so from that directory, run
+Use the `catalog/up` recipe to start the catalog's Docker compose stack:
```shell
-./ov just catalog/up
+ov just catalog/up
```
This results, among other things, in the following running containers:
@@ -117,21 +116,16 @@ and some networking setup so that they can communicate. Note:
container `openverse_catalog_webserver_1`. On production, only the DAGs folder
will be mounted, e.g. `/opt/airflow/openverse/dags`.
-The various services can be accessed using these links:
-
-- Airflow: `localhost:9090` (The default username and password are both
- `airflow`.)
-- Minio Console: `localhost:5011` (The default username and password are
- `test_key` and `test_secret`)
-- Postgres: `localhost:5434` (using a database connector)
+Run `ov just ps` to see the list of running services and the localhost URLs for
+interacting with them.
At this stage, you can run the tests via:
```shell
-./ov just catalog/test
+ov just catalog/test
# Alternatively, run all tests including longer-running ones
-./ov just catalog/test --extended
+ov just catalog/test --extended
```
Edits to the source files or tests can be made on your local machine, then tests
@@ -140,39 +134,39 @@ can be run in the container via the above command to see the effects.
If you'd like, it's possible to login to the webserver container via:
```shell
-./ov just catalog/shell
+ov just catalog/shell
```
If you just need to run an airflow command, you can use the `airflow` recipe.
Arguments passed to airflow must be quoted:
```shell
-./ov just run scheduler airflow config list
+ov just run scheduler airflow config list
```
To follow the logs of the running container:
```shell
-./ov just logs
+ov just logs
```
To begin an interactive [`pgcli` shell](https://www.pgcli.com/) on the database
container, run:
```shell
-./ov just catalog/pgcli
+ov just catalog/pgcli
```
If you'd like to bring down the containers, run
```shell
-./ov just down
+ov just down
```
To reset the test DB (wiping out all databases, schemata, and tables), run
```shell
-./ov just down -v
+ov just down -v
```
`docker volume prune` can also be useful if you've already stopped the running
@@ -182,7 +176,7 @@ stopped containers, not just catalog ones.
To fully recreate everything from the ground up, you can use:
```shell
-./ov just recreate
+ov just recreate
```
> **Note**: Any recipes or scripts which output files to the container's mounted
diff --git a/documentation/frontend/guides/analytics.md b/documentation/frontend/guides/analytics.md
index e6bd6f772..7d88d4389 100644
--- a/documentation/frontend/guides/analytics.md
+++ b/documentation/frontend/guides/analytics.md
@@ -13,21 +13,21 @@ Use the following `just` recipes to set Plausible up locally:
```sh
# Runs the portion of the docker-compose stack that includes Plausible
-./ov just frontend/up
+ov just frontend/up
# Sets up Plausible with a default user and the localhost testing site
# Only necessary the first time you run Plausible locally, when adding
-# new custom events, or any time after you run `./ov just down -v`
-./ov just frontend/init
+# new custom events, or any time after you run `ov just down -v`
+ov just frontend/init
```
-If you have already run `./ov just up` and `./ov just init` at the root of the
+If you have already run `ov just up` and `ov just init` at the root of the
repository, then Plausible is already set up and running the commands above is
not necessary.
> **Note**
>
-> `./ov just frontend/up` may take some time on first run as it will need to
+> `ov just frontend/up` may take some time on first run as it will need to
> download various docker images required for the Plausible stack.
## Access Plausible
@@ -57,8 +57,8 @@ Custom events must be added to Plausible for it to record them. You may do this
one of two ways:
- Automatically:
- 1. Run `./ov just frontend/init`, which automatically extracts the events
- name from the `Events` type
+ 1. Run `ov just frontend/init`, which automatically extracts the events name
+ from the `Events` type
- Manually:
1. Visit <http://0.0.0.0:50288/localhost/settings/goals> and click the "+ Add
goal" button
@@ -67,7 +67,7 @@ one of two ways:
3. Click "add goal" to save the new custom event
**If you are testing custom events added by others, you must also follow this
-process for them to appear in your local environment. `./ov just frontend/init`
+process for them to appear in your local environment. `ov just frontend/init`
will be the simplest way to do so in those cases, provided the change request
includes the necessary changes to the `Events` type.**
diff --git a/documentation/frontend/guides/icons.md b/documentation/frontend/guides/icons.md
index c1d86da37..4e6522eb5 100644
--- a/documentation/frontend/guides/icons.md
+++ b/documentation/frontend/guides/icons.md
@@ -47,7 +47,7 @@ Openverse uses
[svg-sprite-module](https://github.com/nuxt-community/svg-sprite-module) to
automatically generate the SVG sprite when you add an SVG file to
`frontend/src/assets/icons/raw/`. It runs when you run
-`./ov just frontend/run dev` or `./ov just frontend/run build`. The module also
+`ov just frontend/run dev` or `ov just frontend/run build`. The module also
watches the content of the `frontend/src/assets/icons/raw` directory, and
re-generates the sprite if you add an icon there, so you don't need to re-run
the app.
diff --git a/documentation/frontend/guides/quickstart.md b/documentation/frontend/guides/quickstart.md
index b8583fb35..22e374863 100644
--- a/documentation/frontend/guides/quickstart.md
+++ b/documentation/frontend/guides/quickstart.md
@@ -1,54 +1,25 @@
-# Quickstart guide
+# Frontend quickstart guide
This is the quick start guide for setting up and running the frontend locally.
## Prerequisites
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites. Refer to the 'Frontend' column in the
-[requirement matrix](/general/general_setup.md#requirement-matrix) to know what
-you need to run this.
+Follow the [general setup guide](/general/general_setup.md) to set up `ov`.
## Starting up
-1. Ensure you download, install and set up all prerequisites. Ensure that the
- Docker daemon is running.
-
-2. Clone the repository to your computer. Then switch to the cloned directory.
- If you're planning to contribute, fork the repo and clone your fork instead.
-
- ```{note}
- We recommend cloning with the `--filter=blob:none` flag as it dramatically
- reduces the filesize and download time by creating a "blobless clone".
- You can learn more about these [here](https://gist.github.com/leereilly/1f4ea46a01618b6e34ead76f75d0784b).
- ```
-
- ```bash
- git clone --filter=blob:none https://github.com/WordPress/openverse.git # or your fork
- cd openverse/
- ```
-
- If you followed the general setup guide and installed
- [GitHub CLI](/general/general_setup.md#github-cli), you can clone more simply
- using the `gh` command.
-
- ```bash
- gh repo clone WordPress/openverse -- --filter=blob:none # or your fork
- cd openverse/
- ```
-
-3. Install only the Node.js dependencies. You do not need to install any Python
- dependencies to run the frontend.
+1. Install additional Node.js dependencies. You do not need to install any
+ Python dependencies to run the frontend.
```bash
- ./ov just node-install
+ ov just node-install
```
-4. To bring up the frontend, we have another `just` recipe. We have `just`
+2. To bring up the frontend, we have another `just` recipe. We have `just`
recipes for almost everything.
```bash
- ./ov just frontend/run dev
+ ov just frontend/run dev
```
If you want your frontend to use a different API instance, you can set the
@@ -57,7 +28,7 @@ you need to run this.
use the local API with the frontend.
```bash
- ./ov env API_URL="http://localhost:50280" just frontend/run dev
+ ov env API_URL="http://localhost:50280" just frontend/run dev
```
Now you should be able to access the following endpoints:
diff --git a/documentation/frontend/guides/test.md b/documentation/frontend/guides/test.md
index 02fdb14cf..d3efcb9d4 100644
--- a/documentation/frontend/guides/test.md
+++ b/documentation/frontend/guides/test.md
@@ -15,7 +15,7 @@ Storybook visual regression tests read the
2. Run unit tests for the frontend.
```bash
- ./ov just frontend/run test:unit
+ ov just frontend/run test:unit
```
````{note}
@@ -23,7 +23,7 @@ Storybook visual regression tests read the
up pre-commit's Git hooks by running the following command.
```bash
- ./ov just precommit
+ ov just precommit
```
````
@@ -32,13 +32,13 @@ Storybook visual regression tests read the
visual regression tests.
```bash
- ./ov just frontend/run test:playwright
+ ov just frontend/run test:playwright
```
4. Run the Storybook visual regression tests.
```bash
- ./ov just frontend/run test:storybook
+ ov just frontend/run test:storybook
```
````{note}
@@ -49,7 +49,7 @@ Storybook visual regression tests read the
tests to fail on false-positives.
```bash
- ./ov just frontend/run test:storybook:local
+ ov just frontend/run test:storybook:local
```
````
@@ -61,11 +61,11 @@ run both the playwright and storybook tests with the `-u` flag. For example,
this will update the snapshots for the app visual regression tests:
```bash
-./ov just frontend/run test:playwright visual-regression -u
+ov just frontend/run test:playwright visual-regression -u
```
This will similarly update the storybook snapshots:
```bash
-./ov just frontend/run test:storybook -u
+ov just frontend/run test:storybook -u
```
diff --git a/documentation/frontend/reference/i18n.md b/documentation/frontend/reference/i18n.md
index ba6903f19..6cbe02a09 100644
--- a/documentation/frontend/reference/i18n.md
+++ b/documentation/frontend/reference/i18n.md
@@ -105,10 +105,10 @@ To use the script:
```shell
# Install python dependencies
-./ov just utilities/generate_test_locales/install
+ov just utilities/generate_test_locales/install
# Run the script
-./ov just utilities/generate_test_locales/run
+ov just utilities/generate_test_locales/run
```
The script caches Argos translation packages on your local machine. The first
diff --git a/documentation/frontend/reference/miscellaneous.md b/documentation/frontend/reference/miscellaneous.md
index abbd01e6b..465e04e33 100644
--- a/documentation/frontend/reference/miscellaneous.md
+++ b/documentation/frontend/reference/miscellaneous.md
@@ -4,7 +4,7 @@
The code in this repository is formatted using `prettier`. If you have prettier
setup in your code editor it should work out of the box; otherwise you can use
-the `./ov just frontend/run lint` script to format and fix lint errors in your
+the `ov just frontend/run lint` script to format and fix lint errors in your
code. Checks are run to lint your code and validate the formatting on git
precommit.
diff --git a/documentation/frontend/reference/nginx.md b/documentation/frontend/reference/nginx.md
index 185cc8bdc..d19a4230d 100644
--- a/documentation/frontend/reference/nginx.md
+++ b/documentation/frontend/reference/nginx.md
@@ -16,7 +16,7 @@ Additionally, the reverse proxy may be used in the future for the following:
## Testing
-To test the frontend reverse proxy locally, run `./ov just frontend/up`. To test
+To test the frontend reverse proxy locally, run `ov just frontend/up`. To test
the integration with your local Plausible container, follow the existing
instructions in [the frontend analytics documentation][analytics_docs].
Everything should "just work".
diff --git a/documentation/frontend/reference/testing_guidelines.md b/documentation/frontend/reference/testing_guidelines.md
index 2ef23eada..0feff529d 100644
--- a/documentation/frontend/reference/testing_guidelines.md
+++ b/documentation/frontend/reference/testing_guidelines.md
@@ -75,7 +75,7 @@ API_CLIENT_ID=""
API_CLIENT_SECRET=""
```
-Then run the API as usual using `./ov just api/up` & `./ov just api/init`. Nuxt
+Then run the API as usual using `ov just api/up` & `ov just api/init`. Nuxt
automatically loads `.env` files into the environment. With these variables in
the environment, all requests made by your server will be made using an access
token retrieved by the `~/plugins/api-token.server.ts` plugin.
@@ -84,7 +84,7 @@ Once the `.env` file is set up, you may run the development build the typical
way:
```shell
-./ov just frontend/run dev
+ov just frontend/run dev
```
## Browsers
@@ -311,7 +311,7 @@ When writing end-to-end tests, it can be helpful to use Playwright
tests by performing actions in the browser:
```bash
-./ov just frontend/run test:playwright:gen
+ov just frontend/run test:playwright:gen
```
This will open the app in a new browser window, and record any actions you take
@@ -324,7 +324,7 @@ To generate tests for a non-default breakpoint, set the viewport size using the
`--viewport-size` flag. For example, to test the `xs` breakpoint, run:
```bash
-./ov just frontend/run test:playwright:gen --viewport-size=340,600"
+ov just frontend/run test:playwright:gen --viewport-size=340,600"
```
#### Storybook
@@ -338,10 +338,10 @@ See
You can use Playwright's
[codegen](https://playwright.dev/docs/codegen#running-codegen) tool to generate
tests. For this you will need to run Storybook locally on your own using
-`./ov just frontend/run storybook`. Then run:
+`ov just frontend/run storybook`. Then run:
```bash
-./ov just frontend/run test:storybook:gen
+ov just frontend/run test:storybook:gen
```
Please note that the codegen script automatically runs against the non-iframed
@@ -378,7 +378,7 @@ renders the page compared to the docker container.
To run the debug tests:
```bash
-./ov just frontend/run test:playwright:debug
+ov just frontend/run test:playwright:debug
```
Note that this still runs the talkback proxy and the Nuxt server for you. If
@@ -442,7 +442,7 @@ If you've added new tests or updated existing ones, you may get errors about API
responses not being found. To remedy this, you'll need to update the tapes:
```bash
-./ov just frontend/run test:playwright:update-tapes
+ov just frontend/run test:playwright:update-tapes
```
If for some reason you find yourself needing to completely recreate the tapes,
diff --git a/documentation/general/contributing.md b/documentation/general/contributing.md
index b617ff4e1..276ea9bd3 100644
--- a/documentation/general/contributing.md
+++ b/documentation/general/contributing.md
@@ -48,7 +48,6 @@ contribution journey in the code and code-related space.
- [GitHub contribution practices](/general/contribution/github_contribution_practices.md)
- [Dev flow](/general/contribution/dev_flow.md)
- [General setup guide](/general/general_setup.md)
-- [Quickstart guide](/general/quickstart.md)
#### Friendly notes
diff --git a/documentation/general/contribution/dev_flow.md b/documentation/general/contribution/dev_flow.md
index 499936b9f..968d914dc 100644
--- a/documentation/general/contribution/dev_flow.md
+++ b/documentation/general/contribution/dev_flow.md
@@ -2,25 +2,26 @@
To contribute code to Openverse, follow the following steps.
-1. Complete the [general setup](/general/general_setup.md) of your development
- environment.
-
-2. Fork the repository you want to contribute to. When you make a code change
- you will push the changes to a branch on your fork and make a PR to the
- original repo to incorporate those changes.
+1. Fork [the Openverse monorepo](https://github.com/WordPress/openverse). When
+ you make a code change you will push the changes to a branch on your fork and
+ make a PR to the original repo to incorporate those changes.
Go to the repository page on GitHub and find the "Fork" button in the upper
corner of the page. Click this and GitHub will guide you through the process
of forking the repository.
-3. Make sure to go through the [quickstart guide](/general/quickstart.md) to
- have your local environment set up and running.
+1. Follow the guide in [general setup](/general/general_setup.md) to set up the
+ `ov` development environment.
+
+1. Refer to the quickstart guide of the part of the application for the issue
+ you've chosen to work on.
+ [They are linked in the general setup guide](/general/general_setup.md#up-and-running).
-4. Work on the issue you've chosen. Check out a new branch from `main`, named
+1. Work on the issue you've chosen. Check out a new branch from `main`, named
after the issue you're solving. Create commits on this branch and push to
your fork.
-5. Once you have the solution, make a PR from your working branch on your fork
+1. Once you have the solution, make a PR from your working branch on your fork
to the `main` branch on the `origin` repo. You can make a PR even before you
have a solution, but you should mark it as a draft. That PR will
automatically update when you create new commits on your work branch.
diff --git a/documentation/general/contribution/good_first_and_help_wanted_issues.md b/documentation/general/contribution/good_first_and_help_wanted_issues.md
index 268a8bb37..2d674539a 100644
--- a/documentation/general/contribution/good_first_and_help_wanted_issues.md
+++ b/documentation/general/contribution/good_first_and_help_wanted_issues.md
@@ -83,11 +83,11 @@ contain the following block of requirements:
- Have I filled out the PR template correctly?
- Did I include testing instructions?
- Does my PR pass linting? (Test either via precommit or by running
- `./ov just lint` manually)
+ `ov just lint` manually)
- Do all the tests still pass?
- If JavaScript changes, run `pnpm -r run test`
- - If API changes, run `./ov just api/test`
- - If catalog changes, run `./ov just catalog/test`
+ - If API changes, run `ov just api/test`
+ - If catalog changes, run `ov just catalog/test`
```
## On "help wanted" issues
@@ -139,8 +139,8 @@ assigned this issue to you. If you have any questions, you may leave them here.
Please check out our
[welcome](https://docs.openverse.org/general/contributing.html) and
-[quickstart](https://docs.openverse.org/general/quickstart.html) documentation
-pages for getting started with setting up your local environment.
+[general setup](https://docs.openverse.org/general/general_setup.html)
+documentation pages for getting started with setting up your local environment.
```
#### Follow up
diff --git a/documentation/general/deployment.md b/documentation/general/deployment.md
index 1c2551309..d160bfbde 100644
--- a/documentation/general/deployment.md
+++ b/documentation/general/deployment.md
@@ -18,10 +18,10 @@ Deployment logs are currently held in a private repository but are linked here f
### Frontend
-| Environment | Deployment Log | URL | Version Endpoint |
-| ----------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------- |
-| Staging | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-staging-nuxt.yml) | <https://staging.openverse.org> | [`/version.json`](https://staging.openverse.org/version.json) |
-| Production | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-production-nuxt.yml) | <https://production.openverse.org> | [`/version.json`](https://production.openverse.org/version.json) |
+| Environment | Deployment Log | URL | Version Endpoint |
+| ----------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------------------- |
+| Staging | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-staging-nuxt.yml) | <https://staging.openverse.org> | [`/version.json`](https://staging.openverse.org/version.json) |
+| Production | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-production-nuxt.yml) | <https://openverse.org> | [`/version.json`](https://openverse.org/version.json) |
### API
diff --git a/documentation/general/general_setup.md b/documentation/general/general_setup.md
index 48848819f..cc8d37b68 100644
--- a/documentation/general/general_setup.md
+++ b/documentation/general/general_setup.md
@@ -1,263 +1,239 @@
# General setup guide
-This is an exhaustive list for new developers. Feel free to skip the steps that
-you have already done on your own.
+Openverse maintains a containerised development environment named `ov`, and it
+is the only supported method of working with Openverse. `ov` is included in the
+repository, and its only dependencies are git, bash, and Docker (or a compatible
+container runtime).
-If you already have a development environment set up and want to set up
-Openverse on your computer, you can move on to the
-[quickstart guide](/general/quickstart.md).
-
-## Operating system
-
-```{caution}
+```{admonition} Openverse and Windows
+:class: caution
Openverse development is currently supported only for UNIX-type environments
-(Linux and macOS). Windows is not supported natively, but PRs that enable
-Openverse development on Windows, or improve the experience, are welcome.
-```
-
-```{tip}
-We recommend Windows Subsystem for Linux (WSL) as a viable option.
-```
-
-Windows Subsystem for Linux can be a much more versatile and familiar
-environment for software development on Windows. Everything from installing
-`git` and other dependencies to using command line tools that will be familiar
-to the wider community of software developers are more likely to be easier under
-WSL. While some parts of some Openverse projects may be able to be developed
-under native Windows, you will have a much smoother time with WSL as our command
-runners (`just` and `pnpm`) assume a UNIX-type environment (Linux and macOS).
+(Linux and macOS). Windows is not directly supported, but development may be
+possible using Windows Subsystem for Linux (WSL).
Installation instructions for WSL on Windows 10 and 11 can be found in
Microsoft's
[official documentation](https://docs.microsoft.com/en-us/windows/wsl/install).
+```
-## Requirement matrix
-
-Based on which part of the Openverse stack you are contributing to, you might
-not need everything mentioned on this page. Refer to this chart to see which
-prerequisites are required to get started with your contributions.
-
-| Requirement | Docs | Ingestion server | API | Frontend | Management |
-| ------------------ | ---- | ---------------- | --- | -------------- | ---------- |
-| [Git](#git) | ✅ | ✅ | ✅ | ✅ | ✅ |
-| [`just`](#just) | ✅ | ✅ | ✅ | ✅ | ✅ |
-| [Python](#python) | ✅ | ➖ | ➖ | ➖ | ✅ |
-| [Node.js](#nodejs) | ➖ | ➖ | ➖ | ✅ | ✅ |
-| [Docker](#docker) | ➖ | ✅ | ✅ | ❔[^analytics] | ➖ |
-
-Here ✅ means required, ➖ means not required and ❔ means conditionally
-required.
+## Dependencies
-[^analytics]: This is required to run analytics, not required otherwise.
+You must have available on your computer (referred to as the "host system") the
+following:
-## Required setup
+- bash
+- git
+- Docker (or a compatible container runtime)
-The following setup steps are needed to set up a local copy of Openverse and do
-not prepare you to contribute code to the project.
+On macOS and most popular Linux distributions, bash and git are installed by
+default. Most contributors will only need to install Docker or a compatible
+container runtime to use `ov`.
-### Git
+[Follow Docker's instructions to install Docker on your host system](https://docs.docker.com/engine/install/).
-Openverse is Git-tracked. To clone Openverse locally, you will need to install
-`git`. Most Linux distributions and macOS will already have this installed, even
-if it's not always the latest version. To know if you have Git installed, run
-the following command.
+```{tip}
+For Openverse, you'll only need the container runtime, and do not necessarily
+need to install additional tools like Docker compose, buildx, and so forth.
-```bash
-git --version
+While Openverse relies on these tools, they are all installed in the `ov` container,
+and therefore do not need to be available on your host system if you won't use
+them otherwise.
```
-If you see `git version x.y.z`, you have Git installed. If you see an error, you
-need to install it by following the
-[official instructions](https://git-scm.com/downloads).
+## Up and running
-### `just`
+1. Clone the GitHub repository:
-We use `just` as our command runner. It makes it easier to run cumbersome
-commands that are generally needed a lot during development, like bringing up
-our backend services or linting the codebase.
+```shell
+git clone --filter=blob:none https://github.com/WordPress/openverse.git # or your fork
+cd ./openverse
+```
-`just` can be [installed](https://github.com/casey/just#installation) for a host
-of operating systems via their respective
-[package managers](https://github.com/casey/just#packages) or using
-[pre-built binaries](https://github.com/casey/just#pre-built-binaries) available
-for some operating systems.
+```{note}
+We recommend cloning with the `--filter=blob:none` flag as it dramatically
+reduces the filesize and download time by creating a "blobless clone".
+You can learn more about these [here](https://gist.github.com/leereilly/1f4ea46a01618b6e34ead76f75d0784b).
+```
-````{tip}
-If you run `just` inside the Openverse root repo without a recipe name, you can
-see a huge list of all the different recipes present in the project.
+2. Initialise the `ov` development environment:
-```bash
-cd openverse/
-just
+```shell
+./ov init
```
-````
-If for some reason, you are unable to install `just`, you can refer to the
-`justfile` to see the commands that make up a recipe, and then run those
-commands individually in a terminal. It won't be the best user experience, but
-it will work just the same.
+3. It is strongly recommended to add `ov` to your
+ [`PATH`](https://en.wikipedia.org/wiki/PATH_%28variable%29) so that you can
+ run it from anywhere without needing to reference it relative to the
+ repository root.
-We also recommend setting up
-[shell completions](https://github.com/casey/just#shell-completion-scripts) for
-`just` to make it faster to find and run recipes. On macOS with the default Z
-shell, Homebrew installs completions for `just` by default.
+ You can do so using a symbolic link, for example:
-## Conditional setup
+ ```shell
+ ln -s $(git rev-parse --show-toplevel)/ov ~/.local/bin/ov
+ ```
-A subset of the following requirements will be required depending on the extent
-of your contribution to the project. To see which of these you need, refer to
-the [requirement matrix](#requirement-matrix) above.
+ Add `~/.local/bin` to your `PATH` or replace it in the command above with a
+ directory on your `PATH`, and _voilà_, you can run `ov` from anywhere without
+ needing to reference it relative to the repository.
-### Python
+ ```{caution}
+ Throughout the Openverse documentation, we assume `ov` is available for use directly.
+ If you cannot add `ov` to your `PATH`, then use a relative reference to it anytime you
+ invoke the command (i.e., as in `ov init` above).
+ ```
-```{note}
-This is only needed if you are working with the following:
+You're done! Run `ov help` to see a list of useful tools, and visit the
+quickstart guides for each part of the Openverse project in the list below:
-- documentation
-- Python automations
-- API (outside Docker, for debugging purposes)
-- ingestion server (outside Docker, for debugging purposes)
-```
-
-We use Python 3 in the backend of our stack. So to work with that part of the
-codebase, you will need Python installed. Most Linux distributions and macOS
-will already have this installed, even if it's not always the latest version. To
-know if you have Python (specifically version 3) installed, run the following
-command.
+```{toctree}
+:maxdepth: 1
+:glob:
-```bash
-python3 --version
+/frontend/guides/quickstart.md
+/api/guides/quickstart.md
+/catalog/guides/quickstart.md
+/ingestion_server/guides/quickstart.md
```
-If you see `Python x.y.z`, you have Python installed. If you see an error, you
-need to install it using [pyenv](https://github.com/pyenv/pyenv) or by following
-the [official instructions](https://www.python.org/downloads/).
+## `ov` usage
-#### Pipenv
+Run `ov help` to read basic documentation for how to use and interact with `ov`.
-Pipenv helps us provision dependencies for our Python packages and automatically
-set up a virtualenv, provided you have the version of Python mentioned in the
-`Pipfile` installed and accessible locally.
+### Aliases
-You can install Pipenv by following the
-[official instructions](https://pipenv.pypa.io/en/latest/installation.html#installing-pipenv).
+`ov` has a number of built-in aliases, which are documented and discoverable by
+running `ov aliases`.
-### Node.js
+You may configure your own aliases. Run `ov aliases --help` for documentation.
+`ov init` includes an example alias in the generated `.ov_profile.json` to help
+you get started.
-```{note}
-This is only needed if you are working with the following:
+### Included tools
-- frontend
-- Node.js automations
-```
+The containerised `ov` environment includes some excellent general purpose tools
+to interact with Openverse's development environment. Here are some important
+ones you might see used throughout the documentation:
-We use Node.js in the frontend of our stack. So to work with that part of the
-codebase, you will need Node.js installed. To know if you have Node.js
-installed, run the following command.
+- [`just`](https://github.com/casey/just) is a command runner. Like `make` but
+ with loads of features for writing scripts `make` was never made for. Try
+ `ov just` to see all available recipes.
+- [`jq`](https://stedolan.github.io/jq/) is a tool for parsing and manipulating
+ JSON data. Openverse loves `jq`! Try `ov jq --help` for information.
+- [`pdm`](https://pdm-project.org/en/stable/) is a Python package manager. You
+ can use it in any Openverse directory to interact with `pyproject.toml` and
+ different virtual environments. Try `ov pdm --help` for info.
+- [`httpie`](https://httpie.io/docs/cli) is a command line HTTP client. Like
+ cURL but with a lot of conveniences and easier to remember. Try `http --help`
+ for info.
-```bash
-node --version
-```
+````{admonition} Bring your own tools
+:class: tip
-If you see `vx.y.z`, you have Node.js installed. If you see an error, you need
-to install it using [nvm](https://github.com/nvm-sh/nvm) or by following the
-[official instructions](https://nodejs.org/en/download/).
+Generally speaking, you should be able to rely on any tools you have on your host system.
+You can pipe output to and from `ov` and it should work. For example, the following
+will pipe the output of running `ov just api/stats` to your host machine's `less` command.
-#### Corepack
+```shell
+ov just api/stats | less
+```
-Corepack helps manage package managers for a project. In any Node.js workspace,
-like the [`WordPress/openverse`](https://github.com/WordPress/openverse/)
-monorepo for example, Corepack will automatically invoke the right version of
-the specified package manager, also installing it if needed and not present.
+It works the other way, too!
-It's a part of Node.js and present in Node.js versions v14.19.0 and v16.9.0
-onwards. So no installation is needed.
+```shell
+printf '{"hello": "world"}' | ov jq '.hello'
+```
-Enable Corepack in the monorepo root. Then, check if Corepack can discover the
-right package manager, pnpm, by running the following commands.
+You can even pipe from `ov` to `ov`:
-```bash
-corepack enable
-pnpm --version
+```shell
+ov just api/stats | ov jq '.[0]'
```
-You should see a version number and no error message.
+🎉
+````
-### Docker
+````{admonition} Dive into bash
+:class: tip
-```{note}
-This is only needed if you are working with the following:
+`ov` includes `bash`, and if you prefer to interact directly with the development environment,
+rather than going through `ov` for each command, you can enter into `ov`'s `bash` prompt
+like so:
-- API
-- ingestion server
-- frontend
+```shell
+ov bash
```
-Our Python packages are published as Docker images to make it easier to work
-with them locally during development and also make it easier to deploy new
-versions in production.
+Be aware, however, that `ov` aliases **will not work** inside `ov bash`!
+````
-If you run WSL on Windows, you can
-[set up Docker Desktop](https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers#install-docker-desktop).
-If not, you can use one of the many
-[installation methods](https://docs.docker.com/engine/install/) officially
-supported by Docker.
+### Troubleshooting
-Note that the building images for the frontend needs an advanced build feature,
-namely additional build contexts, that is provided by the
-[Buildx plugin](https://docs.docker.com/build/architecture/#buildx). The Buildx
-plugin is included in Docker Desktop and all
-[installation methods](https://docs.docker.com/engine/install/) for Docker
-Engine include steps to also install the Buildx plugin.
+While `ov` works well to simplify the development environment, you may sometimes
+run into problems that you can't figure out.
-To know if your Docker setup is using Buildx, run the following command.
+The first thing to try in these circumstances is `ov doctor`, which attempts
+some basic automated troubleshooting steps to fix common issues.
-```bash
-docker build --help
-```
+If that does not resolve the problem, the next step is to restart `ov` from
+scratch, using `ov clean && ov init`.
-If you see `docker buildx build` under 'Aliases', you have Buildx set up as the
-build client.
+If the problem persists, please open an issue in GitHub so that maintainers can
+assist in debugging the problem.
-#### Docker Compose
+### How it works
-Docker Compose makes it easy to orchestrate multiple services which we put to
-use by orchestrating the external services and also the API, ingestion server
-and indexer workers locally during development.
+`ov` itself lives at the repository root, and is just a bash script. Almost all
+functionality is implemented through support scripts in `/docker/dev_env`.
-Docker Compose is a part of the Docker Desktop installation. To know if you have
-Docker Compose installed, run the following command.
+`ov` containerises the Openverse development environment by running a persistent
+Fedora container and running all development environment tools within this
+container. `ov` builds the container from a custom Dockerfile
+(`/docker/dev_env/Dockerfile`) that installs the basic tools required for the
+Openverse development environment. New tools required for working with Openverse
+should be installed using `RUN` in the Dockerfile, along with existing
+dependencies.
-```bash
-docker compose version
+While `ov` depends on the Docker, Docker compose, and Docker buildx CLI tools,
+it is not a docker-in-docker solution. Instead, it relies on the host system's
+container runtime to operate. This means the Openverse services, images,
+volumes, and so forth, are operating on your host system's container runtime,
+which is merely interacted with by the Docker tools within `ov`.
+
+```{note}
+Kudos to [distrobox](https://distrobox.it/) for introducing us to the concept
+of mapping the host's docker socket into a container.
```
-If you see `Docker Compose version vx.y.z`, you have Docker Compose installed.
-If you see an error, you need to install it by following the
-[official instructions](https://docs.docker.com/compose/install/).
+`ov` also runs the container with host networking. This ensures access to things
+like the frontend or documentation live site which do not run within the
+Openverse docker compose stack, and instead run directly in the `ov` container.
-### GitHub
+On top of this, in order to ensure messages (especially error messages)
+referring to specific files use understandable paths, `ov` maps the Openverse
+repository itself to the same path on the container as it is on the host. For
+example, if you cloned Openverse to `/home/sara/projects/openverse`, it will be
+available at the exact same path inside the container.
```{note}
-This is only needed if you want to contribute code to Openverse. The codebase
-can be read, accessed and downloaded without an account.
+A similar practice is done with PNPM to share the host cache to the container.
+That means if you use PNPM for other projects, you'll still get to benefit from
+its speedy install times and disk-space efficiency when working on Openverse.
```
-The source code for Openverse is hosted on GitHub. To contribute to Openverse,
-you will also need to [sign up](https://github.com/signup) for a GitHub account.
-It's free, and considering how much OSS development happens on GitHub, almost
-essential.
-
-#### GitHub CLI
+When trying to understand how something works in `ov`, keep in mind that there
+are three separate layers of execution:
-It's not necessary, but we recommended to install the GitHub CLI in your
-development environment because it makes it convenient to work with GitHub
-workflows like filing issues and opening PRs.
+1. Directly on the host system, which is generally the `ov` script itself, and
+ the `/docker/dev_env/run.sh` support script
+2. Inside the `ov` container
+3. Inside containers from Openverse's Docker compose stack, which still run on
+ the host system's container runtime
-You can install the CLI by following the
-[official instructions](https://github.com/cli/cli#installation).
+Note that despite there being three layers, they are not three _nested_ layers.
+Rather, they are distinct layers, with the caveat that the second and third
+layer are containerised and as such have the container runtime to contend with.
-### Text editors/IDEs
+## Text editors/IDEs
A good editor or IDE (integrated development environment) makes a lot of
difference when working with software source code. We recommend VS Code or a
@@ -269,54 +245,29 @@ different editor if you have a preference.
- [PyCharm and WebStorm](https://www.jetbrains.com/) are other popular options
with lots of bells and whistles.
- [Sublime Text](https://www.sublimetext.com/) is a minimalistic option that can
- get you off the ground quickly with lots of room for expansion through it's
+ get you off the ground quickly with lots of room for expansion through its
package system.
- [vim](https://www.vim.org/) and [emacs](https://www.gnu.org/software/emacs/)
are ubiquitous terminal-based options.
-## Optional development setup
+## Shutting down
-The following setup steps are only needed in a narrow set of scenarios.
+1. You can <kbd>Ctrl</kbd> + <kbd>C</kbd> to terminate the frontend process.
-### coreutils
+2. For services running inside Docker, like the API, ingestion server and
+ Plausible, use another `just` recipe to bring them down.
-```{note}
-This is only needed on macOS.
-```
-
-`coreutils` adds GNU utils to macOS. `timeout` from the package is required. You
-can install the
-[`coreutils` formula](https://formulae.brew.sh/formula/coreutils) using
-[Homebrew](https://brew.sh), which is a package manager for macOS.
-
-### mkcert
-
-```{note}
-This is only needed to test SSL locally.
-```
-
-To test SSL locally, install `mkcert` (and the corresponding
-[NSS](https://firefox-source-docs.mozilla.org/security/nss/index.html) tools) by
-following the
-[official instruction](https://github.com/FiloSottile/mkcert#installation). You
-can run `mkcert -install` to verify your installation.
-
-### `psycopg2` build prerequisites
-
-```{note}
-This is only needed if the `psycopg2` installation fails when running parts of the project outside of Docker.
-```
+ ```bash
+ ov just down
+ ```
-Openverse uses `psycopg2` built from source on the client for compatibility
-reasons. You must ensure that
-[`psycopg2`'s build prerequisites are fulfilled for the library to install correctly](https://www.psycopg.org/docs/install.html#build-prerequisites).
-The linked documentation includes common troubleshooting instrustions for issues
-building the library.
+ ````{tip}
+ If you include the `-v` flag, all Docker volumes (including their data) will
+ be deleted too, which is useful in case you want a fresh start.
-#### macOS
+ ```bash
+ ov just down -v
+ ```
+ ````
-The `psycopg2` package can fail to install on Apple Silicon Macs with the
-`ld: library not found for -lssl` error. To rectify this, install the
-[`openssl` formula](https://formulae.brew.sh/formula/openssl@3) using
-[Homebrew](https://brew.sh/) and set `LDFLAGS` and `CPPFLAGS` as per the
-instructions in the output of the Homebrew installation.
+3. For `ov` itself, use `ov stop`.
diff --git a/documentation/general/https.md b/documentation/general/https.md
index b280b0e1d..d4ac6cbe5 100644
--- a/documentation/general/https.md
+++ b/documentation/general/https.md
@@ -5,7 +5,7 @@ that serves the API over `https` by proxying to the Gunicorn server which serves
over `http`.
This proxy uses certificates from the `nginx/certs/` directory. These
-certificates can be generated using `mkcert` with the `./ov just nginx/cert`
+certificates can be generated using `mkcert` with the `ov just nginx/cert`
command.
Additionally, to test with the dev hostname `dev.openverse.test`, add the
diff --git a/documentation/general/index.md b/documentation/general/index.md
index ffef65b82..64930d6f0 100644
--- a/documentation/general/index.md
+++ b/documentation/general/index.md
@@ -5,7 +5,6 @@
contributing
general_setup
-quickstart
run
test
zero_downtime_database_management
diff --git a/documentation/general/logging.md b/documentation/general/logging.md
index b363e7754..51353806e 100644
--- a/documentation/general/logging.md
+++ b/documentation/general/logging.md
@@ -33,7 +33,7 @@ searchable and filterable. For example, to see all the logs for a method and
only that method, one can pipe the logs through `grep` like so.
```bash
-./ov just logs web | grep 'func_name=<function name>'
+ov just logs web | grep 'func_name=<function name>'
```
## Request IDs
@@ -46,7 +46,7 @@ codebase and understand what specific parts of the code are causing problems
with these particular requests.
```bash
-./ov just logs web | grep 'request_id=<request ID>'
+ov just logs web | grep 'request_id=<request ID>'
```
## Future improvements
diff --git a/documentation/general/quickstart.md b/documentation/general/quickstart.md
deleted file mode 100644
index 927247bd5..000000000
--- a/documentation/general/quickstart.md
+++ /dev/null
@@ -1,202 +0,0 @@
-# Quickstart guide
-
-<!-- the main entrypoint of the Openverse documentation system -->
-
-This guide covers the steps to get the Openverse stack running locally on your
-computer. This guide is for setting up the full stack, which includes the API,
-the ingestion server and the frontend.
-
-## Stack-specific quickstarts
-
-It is unlikely that you want to contribute to everything, everywhere, all at
-once. In all likelihood, you intend to contribute to a narrower slice of the
-stack. In such cases, you might find it more beneficial to go through one of
-these stack-specific quickstart guides.
-
-- [API](/api/guides/quickstart.md)
-- [Catalog](/catalog/guides/quickstart.md)
-- [Documentation](/meta/documentation/quickstart.md)
-- [Frontend](/frontend/guides/quickstart.md)
-- [Ingestion server](/ingestion_server/guides/quickstart.md)
-
-That said, there is something useful and appealing about running the full stack
-locally, which this guide is all about.
-
-## Prerequisites
-
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites.
-
-## Starting up
-
-1. Ensure you download, install and set up all prerequisites. Ensure that the
- Docker daemon is running.
-
-2. Clone the repository to your computer. Then switch to the cloned directory.
- If you're planning to contribute, fork the repo and clone your fork instead.
-
- ```{note}
- We recommend cloning with the `--filter=blob:none` flag as it dramatically
- reduces the filesize and download time by creating a "blobless clone".
- You can learn more about these [here](https://gist.github.com/leereilly/1f4ea46a01618b6e34ead76f75d0784b).
- ```
-
- ```bash
- git clone --filter=blob:none https://github.com/WordPress/openverse.git # or your fork
- cd openverse/
- ```
-
- If you followed the general setup guide and installed
- [GitHub CLI](/general/general_setup.md#github-cli), you can clone more simply
- using the `gh` command.
-
- ```bash
- gh repo clone WordPress/openverse -- --filter=blob:none # or your fork
- cd openverse/
- ```
-
-3. Install all dependencies. This step installs dependencies for the frontend,
- the documentation and the automations (both Node.js and Python) but won't
- install API or ingestion server dependencies because they are meant to run
- using Docker containers.
-
- ```bash
- ./ov just install
- ```
-
- To be more specific with your install, you can run either of the following.
-
- ```bash
- ./ov just node-install # only frontend and Node.js automations
- ./ov just py-install # only documentation and Python automations
- ```
-
-4. Spin up and orchestrate all Docker services.
-
- ```bash
- ./ov just up
- ```
-
- The `up` recipe orchestrates the following services: `cache`, `db`,
- `upstream_db`, `es`, `indexer_worker`, `ingestion_server`, `web`, `proxy`,
- `webserver`, `scheduler`, `s3`, `plausible-ch`, `plausible-db` and
- `plausible`.
-
- The `up` recipe also prints out services that have ports exposed to the host
- (this can also be seen by running `./ov just ps`):
-
- ```
- ================================================================================
- Service Ports
- ================================================================================
- webserver (catalog):
- - http://0.0.0.0:9090 (→ 8080)
- ingestion_server (ingestion_server):
- - http://0.0.0.0:50281 (→ 8001)
- plausible (plausible/analytics):
- - http://0.0.0.0:50288 (→ 8000)
- web (api):
- - http://0.0.0.0:50280 (→ 8000)
- - http://0.0.0.0:50230 (→ 3000)
- s3 (minio/minio):
- - http://0.0.0.0:5010 (→ 5000)
- - http://0.0.0.0:5011 (→ 5001)
- db (postgres):
- - http://0.0.0.0:50254 (→ 5432)
- es (docker.elastic.co/elasticsearch/elasticsearch):
- - http://0.0.0.0:50292 (→ 9200)
- cache (redis):
- - http://0.0.0.0:50263 (→ 6379)
- ================================================================================
- ```
-
- For example, you can access the following endpoints:
-
- - the list of ingestion jobs on
- [http://localhost:50281/task](http://localhost:50281/task)
- - the API documentation on [http://localhost:50280](http://localhost:50280)
- - the Plausible UI on [http://localhost:50288](http://localhost:50288)
-
-5. Load the sample data. This step can take a few minutes to complete.
-
- ```bash
- ./ov just init
- ```
-
- ````{admonition} Troubleshooting
- If this step fails, cleaning up and restarting usually fixes it.
-
- ```bash
- ./ov just down -v
- ./ov just api/init
- ```
- ````
-
-6. With the data loaded, the API can now return JSON responses to your HTTP
- requests.
-
- ```bash
- ./ov just api/stats
- ./ov just _curl-get "images/stats/" http://localhost:50280
- curl "http://localhost:50280/v1/images/stats/"
- [{"source_name":"flickr","display_name":"Flickr","source_url":"https://www.flickr.com","logo_url":null,"media_count":2500},{"source_name":"stocksnap","display_name":"StockSnap","source_url":"https://stocksnap.io","logo_url":null,"media_count":2500}]%
- ```
-
- ````{tip}
- [`jq`](https://stedolan.github.io/jq/) is a tool for parsing and manipulating
- JSON data. If you have `jq` installed, you can pipe the response to it and
- transform it.
-
- ```bash
- ./ov just api/stats | jq '.[0]'
- {
- "source_name": "flickr",
- "display_name": "Flickr",
- "source_url": "https://www.flickr.com",
- "logo_url": null,
- "media_count": 2500
- }
-
- ./ov just api/stats 'audio' | jq '[.[] | .source_name]'
- [
- "freesound",
- "jamendo",
- "wikimedia_audio"
- ]
- ```
-
- `jq` is great, we recommend you
- [download](https://stedolan.github.io/jq/download/) it.
- ````
-
-7. To bring up the frontend, we have another `just` recipe. We have `just`
- recipes for almost everything.
-
- ```bash
- ./ov env API_URL="http://localhost:50280" just frontend/run dev
- ```
-
- Now you should be able to access the following endpoints:
-
- - the Openverse search engine frontend on
- [http://localhost:8443](http://localhost:8443)
-
-## Shutting down
-
-1. You can <kbd>Ctrl</kbd> + <kbd>C</kbd> to terminate the frontend process.
-
-2. For services running inside Docker, like the API, ingestion server and
- Plausible, use another `just` recipe to bring them down.
-
- ```bash
- ./ov just down
- ```
-
- ````{tip}
- If you include the `-v` flag, all Docker volumes (including their data) will
- be deleted too, which is useful in case you want a fresh start.
-
- ```bash
- ./ov just down -v
- ```
- ````
diff --git a/documentation/general/run.md b/documentation/general/run.md
index ab015b3f2..fbfbc396e 100644
--- a/documentation/general/run.md
+++ b/documentation/general/run.md
@@ -5,7 +5,7 @@
### Docker
To run the API inside Docker, follow the instructions in the
-{doc}`"Quickstart" <./quickstart>` document.
+[general setup guide](/general/general_setup.md).
### On the host
@@ -18,18 +18,18 @@ To run the API inside Docker, follow the instructions in the
1. Create environment variables from the stencil file.
```bash
- ./ov just env
+ ov just env
```
2. Install Python dependencies.
```bash
- ./ov just install
+ ov just install
```
3. Start the Django dev server.
```bash
- ./ov just api/dj runserver
+ ov just api/dj runserver
```
## Django admin
diff --git a/documentation/general/test.md b/documentation/general/test.md
index bfc3a1dbe..13fbf5ce2 100644
--- a/documentation/general/test.md
+++ b/documentation/general/test.md
@@ -5,14 +5,15 @@
1. Before running the tests, make sure to initialise the system with data.
```bash
- ./ov just init
+ ov just init
```
- This step is a part of the {doc}`"Quickstart" <./quickstart>` process.
+ This step is a part of the [general setup](/general/general_setup.md)
+ process.
2. Run the tests in an interactive TTY connected to a `web` container.
```bash
- ./ov just api/test
+ ov just api/test
```
## Flaky tests
diff --git a/documentation/index.md b/documentation/index.md
index 03ca85e5e..a2434512d 100644
--- a/documentation/index.md
+++ b/documentation/index.md
@@ -4,10 +4,8 @@
# Documentation
-To setup your computer and install pre-requisites for developing Openverse,
-refer to the [general setup guide](./general/general_setup.md). To run the
-Openverse stack locally on your computer, refer to the
-[quickstart guide](./general/quickstart.md).
+Refer to the [general setup guide](./general/general_setup.md) to get started
+setting up your computer for Openverse development.
```{note}
This documentation is for developers who are building Openverse. If you want to
diff --git a/documentation/ingestion_server/guides/quickstart.md b/documentation/ingestion_server/guides/quickstart.md
index 1f756b537..340241bbd 100644
--- a/documentation/ingestion_server/guides/quickstart.md
+++ b/documentation/ingestion_server/guides/quickstart.md
@@ -1,59 +1,30 @@
-# Quickstart guide
+# Ingestion server quickstart guide
This is the quick start guide for setting up and running the ingestion server
locally.
## Prerequisites
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites. Refer to the 'Ingestion server' column in the
-[requirement matrix](/general/general_setup.md#requirement-matrix) to know what
-you need to run this.
+Follow the [general setup guide](/general/general_setup.md) to set up `ov`.
## Starting up
-1. Ensure you download, install and set up all prerequisites. Ensure that the
- Docker daemon is running.
+Start the ingestion server along with its dependencies:
-2. Clone the repository to your computer. Then switch to the cloned directory.
- If you're planning to contribute, fork the repo and clone your fork instead.
+```bash
+just ingestion_server/up
+```
- ```{note}
- We recommend cloning with the `--filter=blob:none` flag as it dramatically
- reduces the filesize and download time by creating a "blobless clone".
- You can learn more about these [here](https://gist.github.com/leereilly/1f4ea46a01618b6e34ead76f75d0784b).
- ```
+The `ingestion_server/up` recipe orchestrates the following services: `db`,
+`upstream_db`, `es`, `indexer_worker` and `ingestion_server`.
- ```bash
- git clone --filter=blob:none https://github.com/WordPress/openverse.git # or your fork
- cd openverse/
- ```
+Now you should be able to access the following endpoints:
- If you followed the general setup guide and installed
- [GitHub CLI](/general/general_setup.md#github-cli), you can clone more simply
- using the `gh` command.
+- The list of ingestion jobs on
+ [http://localhost:50281/task](http://localhost:50281/task)
- ```bash
- gh repo clone WordPress/openverse -- --filter=blob:none # or your fork
- cd openverse/
- ```
-
-3. Bring the ingestion server up, along with all their dependent services.
-
- ```bash
- just ingestion_server/up
- ```
-
- The `ingestion_server/up` recipe orchestrates the following services: `db`,
- `upstream_db`, `es`, `indexer_worker` and `ingestion_server`.
-
- Now you should be able to access the following endpoints:
-
- - The list of ingestion jobs on
- [http://localhost:50281/task](http://localhost:50281/task)
-
- You can view logs for the service using `./ov just logs ingestion_server`.
+You can view logs for the service using `ov just logs ingestion_server`.
## Shutting down
-Refer to the [common instructions](/general/quickstart.md#shutting-down).
+Refer to the [common instructions](/general/general_setup.md#shutting-down).
diff --git a/documentation/ingestion_server/guides/test.md b/documentation/ingestion_server/guides/test.md
index 2e5e62e62..8f5d11bd3 100644
--- a/documentation/ingestion_server/guides/test.md
+++ b/documentation/ingestion_server/guides/test.md
@@ -11,30 +11,21 @@ Once you've made some changes to the codebase, it is important to run tests.
2. Install the Python dependencies, including dev-dependencies.
```bash
- ./ov just ingestion_server/install
- ```
-
- ```{caution}
- If you experience error installing `psycopg2`, refer to [documentation
- about the `psycopg2` build prerequisites](/general/general_setup.md#psycopg2-build-prerequisites).
+ ov just ingestion_server/install
```
3. Run the integration tests.
```bash
- ./ov just ingestion_server/test-local
+ ov just ingestion_server/test-local
```
- Note that if an `.env` file exists in the folder you're running `just` from,
- it may interfere with the integration test variables and cause unexpected
- failures.
-
## Making general test requests
To make cURL requests to the local server:
```bash
-./ov just ingestion_server/curl-post '{"model": <model>, "action": <action>}'
+ov just ingestion_server/curl-post '{"model": <model>, "action": <action>}'
```
Replace `<model>` and `<action>` with the correct values. For example, to
diff --git a/documentation/ingestion_server/reference/elasticsearch.md b/documentation/ingestion_server/reference/elasticsearch.md
index 9f618ffc0..c2b625b14 100644
--- a/documentation/ingestion_server/reference/elasticsearch.md
+++ b/documentation/ingestion_server/reference/elasticsearch.md
@@ -11,9 +11,9 @@ loading it into the Openverse API using ingestion server:
tables and indexes. We refer to this as "promotion".
4. The previous API tables and Elasticsearch indexes are deleted.
-Performance is dependent on the size of the target Elasticsearch cluster,
-database throughput, and bandwidth available to the ingestion server. The
-primary bottleneck is indexing to Elasticsearch.
+Performance depends on the size of the target Elasticsearch cluster, database
+throughput, and bandwidth available to the ingestion server. The primary
+bottleneck is indexing to Elasticsearch.
## How indexing works
diff --git a/documentation/meta/ci_cd/actions.md b/documentation/meta/ci_cd/actions.md
index dc1f93e03..506e769fa 100644
--- a/documentation/meta/ci_cd/actions.md
+++ b/documentation/meta/ci_cd/actions.md
@@ -24,8 +24,8 @@ speed and to avoid wasteful consumption of resources.
## `setup-env`
Sets up the runtime environment for a job. It sets up our task runner of choice,
-[`just`](/general/general_setup.md#just) and also the specified languages and
-their respective package managers.
+[`just`](/general/general_setup.md#included-tools) and also the specified
+languages and their respective package managers.
- Python (and Pipenv)
- Node.js (and pnpm)
diff --git a/documentation/meta/ci_cd/jobs/preparation.md b/documentation/meta/ci_cd/jobs/preparation.md
index 2567936b1..6f05bcdc2 100644
--- a/documentation/meta/ci_cd/jobs/preparation.md
+++ b/documentation/meta/ci_cd/jobs/preparation.md
@@ -56,7 +56,7 @@ It is still possible to run this hook locally, assuming the docker image works
on your computer's architecture, by invoking the `lint-codeowners` just recipe:
```bash
-./ov just lint-codeowners
+ov just lint-codeowners
```
````{tip}
@@ -65,7 +65,7 @@ in the just recipe because they fail if there are uncommitted changes.
To run precisely the check that CI uses, enable experimental checks:
```bash
-./ov just lint-codeowners all
+ov just lint-codeowners all
```
````
diff --git a/documentation/meta/documentation/adding_docs.md b/documentation/meta/documentation/adding_docs.md
index 31b2f74df..ecd12e1f8 100644
--- a/documentation/meta/documentation/adding_docs.md
+++ b/documentation/meta/documentation/adding_docs.md
@@ -5,10 +5,7 @@ documentation locally.
## Prerequisites
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites. Refer to the 'Docs' column in the
-[requirement matrix](/general/general_setup.md#requirement-matrix) to know what
-you need to run this.
+Follow the [general setup guide](/general/general_setup.md) to set up `ov`.
## Starting up
@@ -31,7 +28,7 @@ The following demonstrates the process of adding a new documentation page.
3. Write the document using [MyST flavored Markdown](https://mystmd.org/guide).
-4. Run `./ov just lint` to properly format the document.
+4. Run `ov just lint` to properly format the document.
-5. Run `./ov just documentation/live` locally (following the quick start guide)
+5. Run `ov just documentation/live` locally (following the quick start guide)
and navigate to the new page to make sure it looks okay!
diff --git a/documentation/meta/documentation/quickstart.md b/documentation/meta/documentation/quickstart.md
index 317f5f72a..5e28f5d90 100644
--- a/documentation/meta/documentation/quickstart.md
+++ b/documentation/meta/documentation/quickstart.md
@@ -5,50 +5,21 @@ locally.
## Prerequisites
-Refer to the [general setup guide](/general/general_setup.md) for setting up the
-prerequisites. Refer to the 'Docs' column in the
-[requirement matrix](/general/general_setup.md#requirement-matrix) to know what
-you need to run this.
+Follow the [general setup guide](/general/general_setup.md) to set up `ov`.
## Starting up
-1. Ensure you download, install and set up all prerequisites.
-
-2. Clone the repository to your computer. Then switch to the cloned directory.
- If you're planning to contribute, fork the repo and clone your fork instead.
-
- ```{note}
- We recommend cloning with the `--filter=blob:none` flag as it dramatically
- reduces the filesize and download time by creating a "blobless clone".
- You can learn more about these [here](https://gist.github.com/leereilly/1f4ea46a01618b6e34ead76f75d0784b).
- ```
-
- ```bash
- git clone --filter=blob:none https://github.com/WordPress/openverse.git # or your fork
- cd openverse/
- ```
-
- If you followed the general setup guide and installed
- [GitHub CLI](/general/general_setup.md#github-cli), you can clone more simply
- using the `gh` command.
-
- ```bash
- gh repo clone WordPress/openverse -- --filter=blob:none # or your fork
- cd openverse/
- ```
-
-3. Install only the Python dependencies. You do not need to install any Node.js
- dependencies to run the documentation.
+1. Install dependencies used by the documentation site:
```bash
- ./ov just documentation/install
+ ov just documentation/install
```
-4. Run the documentation live server. Once this is done, you should be able to
+1. Run the documentation live server. Once this is done, you should be able to
see the documentation on [http://127.0.0.1:50230](http://127.0.0.1:50230).
```bash
- ./ov just documentation/live
+ ov just documentation/live
```
````{admonition} Troubleshooting
@@ -57,8 +28,8 @@ you need to run this.
caches and restart the live server.
```bash
- ./ov just documentation/clean
- ./ov just documentation/live
+ ov just documentation/clean
+ ov just documentation/live
```
````
diff --git a/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md b/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md
index 4e08e2806..805de04f8 100644
--- a/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md
+++ b/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md
@@ -19,7 +19,7 @@ the spike is related to one of these events and the alarms stabilizes in the
short time then the severity is low.
If the issue is not related to known recurrent events and persists, the severity
-is critical. Check if dependent services –DB, Redis, Elasticsearch– are
+is critical. Check if API service dependencies –DB, Redis, Elasticsearch– are
available to the API or if the problem is intrinsic to itself. To gather more
information check the [log group][log_group], use the "Logs Insights" view to
query for requests that failed using a CloudWatch query similar to the following
diff --git a/documentation/meta/monitoring/runbooks/unhealthy_ecs_hosts.md b/documentation/meta/monitoring/runbooks/unhealthy_ecs_hosts.md
index 8fa370c3b..df02e9501 100644
--- a/documentation/meta/monitoring/runbooks/unhealthy_ecs_hosts.md
+++ b/documentation/meta/monitoring/runbooks/unhealthy_ecs_hosts.md
@@ -57,7 +57,7 @@ checked by the healthcheck are failing:
For example, if the Postgres database is failing to serve connections to the
API, the Django API service healthcheck will fail, causing the task to restart,
-even though the core issue is with a dependent service.
+even though the core issue is with an upstream service.
If the persistent unhealthy hosts are caused by a related service, fix the
related service. Do not roll back the service with the unhealthy hosts until
diff --git a/documentation/packages/index.md b/documentation/packages/index.md
index 793dff2b4..0ebbd808f 100644
--- a/documentation/packages/index.md
+++ b/documentation/packages/index.md
@@ -19,18 +19,18 @@ Openverse does not currently have any method for publishing packages to NPM.
### Running package scripts
-Run scripts for individual packages using `./ov just p {package} {script}`. For
+Run scripts for individual packages using `ov just p {package} {script}`. For
example, to run tests for the `eslint-plugin`, run:
```
-./ov just p eslint-plugin test:unit
+ov just p eslint-plugin test:unit
```
This also works for the Nuxt frontend as an alternative to
-`./ov just frontend/run`:
+`ov just frontend/run`:
```
-./ov just p frontend dev
+ov just p frontend dev
```
### Adding new packages
diff --git a/documentation/projects/planning.md b/documentation/projects/planning.md
index c05716461..9f4f70bfd 100644
--- a/documentation/projects/planning.md
+++ b/documentation/projects/planning.md
@@ -47,7 +47,7 @@ accepts one argument as the project name, followed optionally by any number of
implementation plans.
```bash
-./ov just documentation/create-project 'Project name' 'First IP' 'Second IP'
+ov just documentation/create-project 'Project name' 'First IP' 'Second IP'
```
This will create the directory structure for your project with the specified
@@ -67,7 +67,7 @@ plan, you can use the `just` recipe `create-ip`. It accepts the directory name
(not full path) of the project and the plan name as arguments.
```bash
-./ov just documentation/create-ip project_name 'New IP'
+ov just documentation/create-ip project_name 'New IP'
```
````
diff --git a/documentation/projects/templates/implementation_plan.md b/documentation/projects/templates/implementation_plan.md
index 69bea9f76..ee696d98e 100644
--- a/documentation/projects/templates/implementation_plan.md
+++ b/documentation/projects/templates/implementation_plan.md
@@ -64,11 +64,11 @@ For each step description, ensure the heading includes an obvious reference to t
### Tools & packages
-<!-- Describe any tools or packages which this work might be dependent on. If multiple options are available, try to list as many as are reasonable with your own recommendation. -->
+<!-- Describe any tools or packages which this work might depend on. If multiple options are available, try to list as many as are reasonable with your own recommendation. -->
### Other projects or work
-<!-- Note any projects this plan is dependent on. -->
+<!-- Note any projects this plan depends on. -->
## Alternatives
diff --git a/documentation/projects/yearly_planning/process_outline.md b/documentation/projects/yearly_planning/process_outline.md
index edbca6126..b919b8aab 100644
--- a/documentation/projects/yearly_planning/process_outline.md
+++ b/documentation/projects/yearly_planning/process_outline.md
@@ -13,7 +13,7 @@ when planning which projects will be worked on in the next calendar year.
Some of the steps below reference resources that may only be accessible by maintainers.
The purpose of this document is primarily to share our process in a way that might be
useful for other projects, teams, or organizations. If you're interested in becoming a
-maintainer, please check out our [welcome page](/general/quickstart.md)
+maintainer, please check out our [welcome page](/general/contributing.md)
for how to begin getting involved.
```
diff --git a/frontend/src/locales/scripts/bulk-download.js b/frontend/src/locales/scripts/bulk-download.js
index b6fd9c01f..5094b8662 100644
--- a/frontend/src/locales/scripts/bulk-download.js
+++ b/frontend/src/locales/scripts/bulk-download.js
@@ -58,7 +58,7 @@ const extractZip = async (zipPath) => {
const issue = "https://github.com/WordPress/openverse/issues/2438"
if (deprecatedKeys.count > 0) {
let warning = `${deprecatedKeys.count} deprecated kebab-case keys replaced in locale files. `
- warning += `To see the keys, run \`./ov just frontend/run i18n:get-translations --verbose\`. For more details, see ${issue}.`
+ warning += `To see the keys, run \`ov just frontend/run i18n:get-translations --verbose\`. For more details, see ${issue}.`
if (process.argv.includes("--verbose")) {
warning += `\n${JSON.stringify(deprecatedKeys.keys, null, 2)}`
}
diff --git a/justfile b/justfile
index b96aa4e81..a83c05f96 100644
--- a/justfile
+++ b/justfile
@@ -67,12 +67,17 @@ install:
@install-hooks:
bash -c "cp ./docker/dev_env/hooks/* ./.git/hooks"
-# Create an `.ov_aliases.json` as a starting point for development environment customisation. Does not make changes if the file already exists.
-init-ov-aliases:
+# Create an `.ov_profile.json` as a starting point for development environment customisation. Does not make changes if the file already exists.
+init-ov-profile:
#! /usr/bin/env bash
- [[ -f ./.ov_aliases.json ]] && echo '.ov_aliases.json already exists! No changes made.' && exit 0 || cat <<-'EOALIASES' > ./.ov_aliases.json
+ [[ -f ./.ov_profile.json ]] && echo '.ov_profile.json already exists! No changes made.' && exit 0 || cat <<-'EOALIASES' > ./.ov_profile.json
{
- "welcome": ["just", "welcome-to-openverse"]
+ "aliases": {
+ "welcome": {
+ "cmd": ["just", "welcome-to-openverse"],
+ "doc": "Warmly welcome Openverse contributors (and provide an example for how aliases work)."
+ }
+ }
}
EOALIASES
diff --git a/ov b/ov
index d792e718f..467dca75a 100755
--- a/ov
+++ b/ov
@@ -13,7 +13,7 @@ _cmd="$1"
dev_env="$OPENVERSE_PROJECT"/docker/dev_env
export DEV_ENV="$dev_env"
-if [[ $_cmd == "help" || -z $_cmd ]]; then
+if [[ $_cmd == "help" || $_cmd == "-h" || $_cmd == "--help" || -z $_cmd ]]; then
cat <<-'EOF'
Openverse development toolkit
@@ -25,7 +25,7 @@ COMMANDS
Initialise the Openverse development toolkit for the first time
Alias for:
- ov build && ov setup-env && ov just install-hooks && ov just init-ov-aliases
+ ov build && ov setup-env && ov just install-hooks && ov just init-ov-profile
ov build [...ARGS]
Build the Openverse development toolkit Docker image.
@@ -41,6 +41,9 @@ COMMANDS
ov stop
Stop the persistent `ov` Docker container.
+ ov doctor
+ Try some basic automated troubleshooting steps for common issues.
+
ov clean
Remove the Openverse development toolkit Docker container, image and volume.
Use in conjunction with `ov init` to recreate the environment from
@@ -52,11 +55,19 @@ COMMANDS
including downloading tools handled by `ov setup-env` and pre-commit environments.
ov hook HOOK
- Run Git hooks through pre-commit inside the development toolkit container
+ Run Git hooks through pre-commit inside the development toolkit container.
+
+ ov aliases [--help|-h]
+ Display information about ov aliases. By default, lists all available aliases.
+ Passing --help will print documentation about how to use and configure aliases.
ov COMMAND [...ARGS]
- Run COMMAND inside the development toolkit container
- Hints: The toolkit comes loaded with many tools for working with Openverse! Try
+ Run COMMAND inside the development toolkit container. COMMAND will be processed
+ through ov aliases (see `ov aliases --help` for details). ov is aware of your
+ current working directory and will execute the command relative to your current directory
+ inside the repository.
+
+ Tip: The toolkit comes loaded with many tools for working with Openverse! Try
some of the following:
- ov just
@@ -64,6 +75,8 @@ COMMANDS
- ov pnpm
- ov python
- ov bash
+ - ov jq
+ - ov http
EOF
exit 0
@@ -74,7 +87,7 @@ init)
"$_self" build
"$_self" setup-env
"$_self" just install-hooks
- "$_self" just init-ov-aliases
+ "$_self" just init-ov-profile
;;
build)
@@ -89,6 +102,23 @@ stop)
docker stop openverse-dev_env
;;
+doctor)
+ # Expand these checks/fixes as needed
+ # Log a message for each fix so it's clear what is happening
+
+ printf "🩺 The Openverse Doctor is here to help... I will try to apply some basic fixes that might help.\n"
+
+ case "$OSTYPE" in
+ linux*)
+ # For some reason permissions can get mixed up in `/opt` and PDM will fail to create venvs
+ # This is only relevant to Linux hosts because macOS hosts run the container as root regardless
+ printf " - Fixing file permissions in container's /opt\n"
+ "$_self" sudo chmod -R 0777 /opt
+ ;;
+
+ esac
+ ;;
+
clean)
# Using `|| true` allows these commands to be skipped if the
# container, image or volume does not exist.
diff --git a/utilities/generate_test_locales/__main__.py b/utilities/generate_test_locales/__main__.py
index 412f187b1..217a2671d 100644
--- a/utilities/generate_test_locales/__main__.py
+++ b/utilities/generate_test_locales/__main__.py
@@ -10,7 +10,7 @@ reporoot = Path(__file__).parents[2]
from_lang = "en"
-# Must be generated using `./ov just p frontend i18n:en`
+# Must be generated using `ov just p frontend i18n:en`
from_json_path = reporoot / "frontend" / "src" / "locales" / "en.json"
to_langs = ["ar", "es"]
diff --git a/utilities/load_testing/README.md b/utilities/load_testing/README.md
index 75d5a1cd5..4a1f71b34 100644
--- a/utilities/load_testing/README.md
+++ b/utilities/load_testing/README.md
@@ -37,7 +37,7 @@ important to disable the Cloudflare cache and WAF security settings for the
duration of the test to test the actual performance of the application instead
of testing Cloudflare cache or getting blocked by WAF. By default, the tests
request only the English static pages. You can specify other scenarios to run,
-with `./ov just load_testing/k6 all` being the most comprehensive test that
+with `ov just load_testing/k6 all` being the most comprehensive test that
requests static and search pages in English. The `locales` tests request pages
in 3 other locales.
@@ -47,15 +47,15 @@ All load tests are accessible through `just` scripts in this directory's
`justfile`.
To run API load tests against a local API instance, use
-`./ov just load_testing/api`. You can optionally specify a host (the default is
-to point to local). For example
-`./ov just load_testing/api https://api-staging.openverse.org` will run the load
+`ov just load_testing/api`. You can optionally specify a host (the default is to
+point to local). For example
+`ov just load_testing/api https://api-staging.openverse.org` will run the load
tests against the staging API.
-To run the frontend load tests, use `./ov just load_testing/k6-frontend`. You
-can optionally specify the scenarios to run, for example,
-`./ov just load_testing/k6-frontend all`. To specify a host (the default is to
+To run the frontend load tests, use `ov just load_testing/k6-frontend`. You can
+optionally specify the scenarios to run, for example,
+`ov just load_testing/k6-frontend all`. To specify a host (the default is to
point to the `openverse.org`), set the `FRONTEND_URL` environment variable. For
example,
-`./ov env FRONTEND_URL=https://staging.openverse.org just load_testing/k6-frontend`
+`ov env FRONTEND_URL=https://staging.openverse.org just load_testing/k6-frontend`
will run the load tests against the staging frontend.