Skip to content

Commit

Permalink
A few updates to some README.md's in areas where I struggled in my fi…
Browse files Browse the repository at this point in the history
…rst local build.
  • Loading branch information
rpigneri-vol committed Dec 10, 2024
1 parent 5490468 commit e4f182a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This method uses Docker to run the complete application stack.
3. Build and run the project.

```
docker-compose build && docker-compose up -d && docker-compose logs -f
docker compose build && docker compose up -d && docker compose logs -f
```

## Installation (Frontend Only)
Expand All @@ -51,7 +51,7 @@ All code must pass the unit tests and style checks before it can be merged into


```
docker exec -it "police-data-trust-api-1" /bin/bash
docker exec -it "police-data-trust_api_1" /bin/bash
```

Expand Down
7 changes: 7 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This is the backend for the National Police Data Index project. It is a Python Flask application that serves as the API for the front end.

---
**NOTE:**

If you are having trouble running your backend tests for the first time, you might be interested in [this README.md](tests/README.md) rather than this one :-).

---

## Database

The backend uses a PostgreSQL database to store data. The database schema is defined in [database/models](https://github.com/codeforboston/police-data-trust/tree/a743c232b5737b193086264e1364b1475873a884/backend/database/models).
Expand Down
16 changes: 8 additions & 8 deletions backend/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ To run backend tests locally:

## Pytest (Unit Tests)

1. Start the application cluster with `docker-compose up`
1. Start the application cluster with `docker compose up`

2. Start the test database with `docker-compose --profile test up`.
2. Start the test database with `docker compose --profile test up`.
Yes, you should start the test database separately. It'll be more likely to boot properly this way.

3. Add a test marker to the test DB. This will allow the DB to clear itself after each test run. See instructions below.
3. Add a test marker to the test DB. This will allow the DB to clear itself after each test run. See instructions[below](#adding-a-test-marker-to-the-test-database).

4. Connect to the API container with `docker exec -it "police-data-trust-api-1" /bin/bash`. You can find the container name by running `docker ps`.

Expand All @@ -20,22 +20,22 @@ Yes, you should start the test database separately. It'll be more likely to boot

1. With the test database running, navigate to `localhost:7474` in your browser.

2. On the Neo4J web interface, select `neo4j://127.0.0.1:7688` as the connection URL. Otherwise, you will connect to the main database.
2. On the Neo4J web interface, select `neo4j://127.0.0.1:7688` as the connection URL. Otherwise, you will connect to the main database. You can connect to a new DB by typing the following into the command bar at the very top of your browser window: `:server connect neo4j://127.0.0.1:7688` and pressing Enter or clicking the run button. The command bar often starts with `neo4j$ ` at the beginning.

3. Log in with the username `neo4j` and the password `test_pwd`.

4. Run the following query to add a test marker to the database:
3. Run the following query to add a test marker to the database:

```
MERGE (n:TestMarker {name: 'TEST_DATABASE'});
```

This command can also be run from the command bar at the top of your screen.

5. You can now run the tests. The database will clear itself after each test run.


## Flake8 (Linting)

1. Start the application cluster with `docker-compose up`
1. Start the application cluster with `docker compose up`

2. Connect to the API container with `docker exec -it "police-data-trust-api-1" /bin/bash`. You can find the container name by running `docker ps`.

Expand Down

0 comments on commit e4f182a

Please sign in to comment.