Skip to content

Commit

Permalink
Add checks for docs (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
evroon authored Nov 27, 2023
1 parent 158bae0 commit a2cd121
Show file tree
Hide file tree
Showing 17 changed files with 3,165 additions and 238 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docs_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
run: yarn
working-directory: docs

- name: Run tests
run: yarn test-check
working-directory: docs

- name: Build docs
run: yarn build
working-directory: docs
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,37 @@
[![codecov](https://codecov.io/gh/evroon/bracket/branch/master/graph/badge.svg?token=YJL0DVPFFG)](https://codecov.io/gh/evroon/bracket)
[![backend](https://github.com/evroon/bracket/actions/workflows/backend.yml/badge.svg)](https://github.com/evroon/bracket/actions/workflows/backend.yml)
[![frontend](https://github.com/evroon/bracket/actions/workflows/frontend.yml/badge.svg)](https://github.com/evroon/bracket/actions/workflows/frontend.yml)
[![last commit](https://img.shields.io/github/last-commit/evroon/bracket)](https://img.shields.io/github/last-commit/evroon/bracket)
[![last
commit](https://img.shields.io/github/last-commit/evroon/bracket)](https://img.shields.io/github/last-commit/evroon/bracket)
[![release](https://img.shields.io/github/v/release/evroon/bracket)](https://img.shields.io/github/v/release/evroon/bracket)

<br/>

Tournament system meant to be easy to use.
Bracket is written in async Python (with [FastAPI](https://fastapi.tiangolo.com)) and [Next.js](https://nextjs.org/) as frontend using the [Mantine](https://mantine.dev/) library.
Tournament system meant to be easy to use. Bracket is written in async Python (with
[FastAPI](https://fastapi.tiangolo.com)) and [Next.js](https://nextjs.org/) as frontend using the
[Mantine](https://mantine.dev/) library.

It has the following features:
It has the following features:
- Supports **single elimination, round-robin and swiss** formats.
- **Build your tournament structure** with multiple stages that can have multiple groups/brackets in them.
- **Build your tournament structure** with multiple stages that can have multiple groups/brackets in
them.
- **Drag-and-drop matches** to different courts or reschedule them to another start time.
- Various **dashboard pages** are available that can be presented to the public, customized with a logo.
- Various **dashboard pages** are available that can be presented to the public, customized with a
logo.
- Create/update **teams**, and add players to **teams**.
- Create **multiple clubs**, with **multiple tournaments** per club.
- **Swiss tournaments** can be handled dynamically, with automatic scheduling of matches.

### Preview
<img alt="" src="docs/static/img/schedule_preview.png" width="50%" /><img alt="" src="docs/static/img/planning_preview.png" width="50%" />
<img alt="" src="docs/static/img/builder_preview.png" width="50%" /><img alt="" src="docs/static/img/standings_preview.png" width="50%" />
<img alt="" src="docs/static/img/schedule_preview.png" width="50%" /><img alt=""
src="docs/static/img/planning_preview.png" width="50%" /> <img alt=""
src="docs/static/img/builder_preview.png" width="50%" /><img alt=""
src="docs/static/img/standings_preview.png" width="50%" />


# Quickstart
To quickly run bracket to see how it works, clone it and run `docker-compose up`:
```shell
```bash
git clone git@github.com:evroon/bracket.git
cd bracket
sudo docker-compose up -d
Expand All @@ -39,20 +45,20 @@ be able to view bracket at http://localhost:3000. You can log in with username `
and password `aeGhoe1ahng2Aezai0Dei6Aih6dieHoo`.

To insert dummy rows into the database, run:
```shell
```bash
sudo docker exec bracket-backend pipenv run ./cli.py create-dev-db
```

# Setup
## Database
First create a `bracket` cluster:
```shell
```bash
sudo pg_createcluster -u postgres -p 5532 13 bracket
pg_ctlcluster 13 bracket start
```

Subsequently, create a new `bracket_dev` database:
```shell
```bash
sudo -Hu postgres psql -p 5532
CREATE USER bracket_dev WITH PASSWORD 'bracket_dev';
CREATE DATABASE bracket_dev OWNER bracket_dev;
Expand All @@ -68,20 +74,22 @@ The database URL can be specified per environment in the `.env` files (see [conf
Copy [ci.env](backend/ci.env) to `prod.env` and fill in the values:
- `PG_DSN`: The URL of the PostgreSQL database
- `JWT_SECRET`: Create a random secret using `openssl rand -hex 32`
- `CORS_ORIGINS` and `CORS_ORIGIN_REGEX`: Specify allowed frontend domain names for CORS (see the [FastAPI docs](https://fastapi.tiangolo.com/tutorial/cors/))
- `ADMIN_EMAIL` and `ADMIN_PASSWORD`: The credentials of the admin user, which is created when initializing the database
- `CORS_ORIGINS` and `CORS_ORIGIN_REGEX`: Specify allowed frontend domain names for CORS (see the
[FastAPI docs](https://fastapi.tiangolo.com/tutorial/cors/))
- `ADMIN_EMAIL` and `ADMIN_PASSWORD`: The credentials of the admin user, which is created when
initializing the database


## Running the frontend and backend
The following starts the frontend and backend for local development:
### Frontend
```
```bash
cd frontend
yarn run dev
```

### Backend
```
```bash
cd backend
pipenv install -d
pipenv shell
Expand Down
23 changes: 23 additions & 0 deletions docs/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"config": {
"default": true,
"line-length": {
"strict": true,
"code_blocks": false,
"line_length": 100
},

// part of the markdownlint-rule-relative-links plugin
"relative-links": true
},
"globs": [
"**/*.{md,mdx}"
],
"ignores": [
"node_modules",
"static"
],
"customRules": [
"markdownlint-rule-relative-links"
]
}
40 changes: 22 additions & 18 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website
generator.

### Installation
## Installation

```
$ yarn
```bash
yarn
```

### Local Development
## Local Development

```
$ yarn start
```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
This command starts a local development server and opens up a browser window. Most changes are
reflected live without having to restart the server.

### Build
## Build

```
$ yarn build
```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content into the `build` directory and can be served using any static
contents hosting service.

### Deployment
## Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
If you are using GitHub pages for hosting, this command is a convenient way to build the website and
push to the `gh-pages` branch.
2 changes: 1 addition & 1 deletion docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
15 changes: 11 additions & 4 deletions docs/docs/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ sidebar_position: 2
# Configuration

Copy `ci.env` to `prod.env` and fill in the values:

- `PG_DSN`: The URL of the PostgreSQL database
- `JWT_SECRET`: Create a random secret using `openssl rand -hex 32`
- `CORS_ORIGINS` and `CORS_ORIGIN_REGEX`: Specify allowed frontend domain names for CORS (see the [FastAPI docs](https://fastapi.tiangolo.com/tutorial/cors/))
- `ADMIN_EMAIL` and `ADMIN_PASSWORD`: The credentials of the admin user, which is created when initializing the database
- `CORS_ORIGINS` and `CORS_ORIGIN_REGEX`: Specify allowed frontend domain names for CORS (see the
[FastAPI docs](https://fastapi.tiangolo.com/tutorial/cors/))
- `ADMIN_EMAIL` and `ADMIN_PASSWORD`: The credentials of the admin user, which is created when
initializing the database
- `SENTRY_DSN`: The [Sentry](https://sentry.io) DSN for monitoring and error tracking
- `BASE_URL`: The base url of the API used for SSO
- `ALLOW_USER_REGISTRATION`: Can be used to disallow user registration in the web app, currently used for production while bracket is still in beta
- `ALLOW_INSECURE_HTTP_SSO`: Should not be used in production. Allows use of INSECURE requests for SSO auth.
- `ALLOW_USER_REGISTRATION`: Can be used to disallow user registration in the web app, currently
used for production while bracket is still in beta
- `ALLOW_INSECURE_HTTP_SSO`: Should not be used in production. Allows use of INSECURE requests for
SSO auth.

## Example configuration file

This is an example of how the config file should look like:

```bash
PG_DSN='postgresql://bracket_ci:bracket_ci@localhost:5532/bracket_ci'
JWT_SECRET='60eed5c5dc7a919b8595a23d6c42ddd8274e4feea651dc028d9bee495bbb9acd'
Expand Down
18 changes: 15 additions & 3 deletions docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,49 @@ sidebar_position: 1
---

# Installation
This guide explains how to run Bracket without Docker. If you quickly want to get up and running, please read [quickstart.md](quickstart.md).

This guide explains how to run Bracket without Docker. If you quickly want to get up and running,
please read [quickstart.md](quickstart.md).

## Database

First create a `bracket` cluster:

```bash
sudo pg_createcluster -u postgres -p 5532 13 bracket
pg_ctlcluster 13 bracket start
```

Subsequently, create a new `bracket_dev` database. First connect via `sudo -Hu postgres psql -p 5532`, and then run:
Subsequently, create a new `bracket_dev` database. First connect via `sudo -Hu postgres psql -p
5532`, and then run:

```sql
CREATE USER bracket_dev WITH PASSWORD 'bracket_dev';
CREATE DATABASE bracket_dev OWNER bracket_dev;
```

You can do the same but replace the user and database name with:

- `bracket_ci`: for running tests
- `bracket_prod`: for a production database

The database URL can be specified per environment in the `.env` files (see [config](#config)).
The database URL can be specified per environment in the `.env` files (see
[config](configuration.md)).

## Running the frontend and backend

The following starts the frontend and backend for local development:

### Frontend

```bash
cd frontend
yarn
npm run dev
```

### Backend

```bash
cd backend
pipenv install -d
Expand Down
9 changes: 6 additions & 3 deletions docs/docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
sidebar_position: 2
sidebar_position: 0
---

# Quickstart

To quickly run bracket to see how it works, clone it and run `docker-compose up`:

```bash
git clone git@github.com:evroon/bracket.git
cd bracket
sudo docker-compose up -d
```

This will start the backend and frontend of Bracket, as well as a postgres instance. You should now
be able to view bracket at http://localhost:3000. You can log in with username `test@example.org`
be able to view bracket at `http://localhost:3000`. You can log in with username `test@example.org`
and password `aeGhoe1ahng2Aezai0Dei6Aih6dieHoo`.

To insert dummy rows into the database, run:

```shell
sudo docker exec bracket-backend pipenv run ./cli.py create-dev-db
```
```
4 changes: 4 additions & 0 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ is written in async Python (with [FastAPI](https://fastapi.tiangolo.com)) and
[Next.js](https://nextjs.org/) as frontend using the [Mantine](https://mantine.dev/) library.

## Overview of features

It has the following features:

- Supports **single elimination, round-robin and swiss** formats.
- **Build your tournament structure** with multiple stages that can have multiple groups/brackets in
them.
Expand All @@ -21,6 +23,7 @@ It has the following features:
- **Swiss tournaments** can be handled dynamically, with automatic scheduling of matches.

## Why does this exist?

There are plenty of tournament systems to be found online. So why does Bracket exist?

**Firstly**, there are **no complete open-source tournament systems to be found** [on
Expand All @@ -38,4 +41,5 @@ starts with Swiss and determines a winner based on a knockoff (elimination) stag
experience to a project with a real purpose.

## Quickstart

To get started, follow the steps described in [quickstart](getting-started/quickstart.md)
Loading

1 comment on commit a2cd121

@vercel
Copy link

@vercel vercel bot commented on a2cd121 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.