Skip to content

Commit

Permalink
docs: minor improvements and rewordings in README
Browse files Browse the repository at this point in the history
  • Loading branch information
avivace committed Oct 18, 2024
1 parent b1e069c commit 3140001
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Documentation about the exposed API and how to interact with the Homebrew Hub in

## Local Development

### 1. Prerequisites

To run a complete local instance of Homebrew Hub, let's start with:

```sh
Expand All @@ -32,9 +34,7 @@ git clone https://github.com/gbdev/homebrewhub
cd homebrewhub
```

### 1. Prerequisites

No matter if you choose the local setup or the docker one, you will need a couple of pre-requirements on the system:
Now, no matter if you choose the local setup or the docker one, you will need a couple of pre-requirements on the system:

- `pre-commit` <br>
E.g. Install it from pip:
Expand All @@ -51,6 +51,9 @@ No matter if you choose the local setup or the docker one, you will need a coupl
To populate the database, we'll need some sources. Here's how to pull all the 'official' databases (you need at least one):
```bash
# Let's move to a subdirectory
cd db-sources

# GB/GBC
git clone https://github.com/gbdev/database/ db-sources/database-gb
# GBA
Expand All @@ -64,16 +67,16 @@ make init-db

### 3A. Docker based requirements

First, install Docker ([download link](https://docs.docker.com/get-docker/)).
First, install Docker ([download link](https://docs.docker.com/get-docker/)), and compose.

After that, follow the steps below to get started running the project using containers:

```bash
# Start up backing services (web server, database and database admin)
# NOTE: This command will also take care of synchronising the database (including migrations)
docker-compose up --build
docker compose up --build

# Once that's finished, in another terminal, query the /api/all route to see if everything's there
# Once that's finished, from another shell, query the /api/all route to see if everything's there
curl https://localhost:8000/api/all
```

Expand All @@ -92,10 +95,7 @@ Next, install Postgres 12 ([download link](https://www.postgresql.org/download/)
After that, follow the steps below to get started running the project manually:

```bash
# Clone the repo locally
git clone https://github.com/gbdev/homebrewhub
# Change into the cloned repo
# Make sure you are in the cloned repository
cd homebrewhub

# Set up a virtual env
Expand All @@ -116,12 +116,6 @@ python3 manage.py makemigrations hhub
# Sync the database for the first time
python3 manage.py migrate

# Clone the database repositories
# GB/GBC
git clone https://github.com/gbdev/database/
# GBA
git clone https://github.com/gbadev-org/games database-gba
# Populate with the entries from the database repository
DATABASE_URL=postgres://yourpostgresuserhere:yourpostgrespasswordhere@localhost:5432/hh python3 manage.py runscript sync_db

Expand All @@ -147,7 +141,7 @@ The "real" database needs to be built (and updated when a commit gets pushed) fr

> Keep in mind that the two are not equivalent, as the Django database will keep additional values about each entry (e.g. simple analytics).
Every time you want to trigger a database sync (e.g. you pulled some updates on the games database):
Every time you want to trigger a database sync (e.g. you pulled some updates on the games database), run:

```bash
python3 manage.py runscript sync_db
Expand All @@ -157,6 +151,4 @@ python3 manage.py runscript sync_db

Now that you have your Homebrew Hub backend up and running, you can check [Virens](https://github.com/gbdev/virens), our VueJS based frontend shipping web assembly builds of mGBA and binjgb to actually play all these entries directly on a browser :D

### Legacy
If you were looking for old version written in Node/Express, check [homebrewhub-legacy](https://github.com/gb-archive/homebrewhub-legacy).
Remember to set `BASE_API_URL=http://localhost:8000` so the API calls from Virens will point to the backend we just brought up.

0 comments on commit 3140001

Please sign in to comment.