Skip to content

Commit

Permalink
fixup! Add docs checks
Browse files Browse the repository at this point in the history
  • Loading branch information
evroon committed Nov 27, 2023
1 parent ee7e0b0 commit 561dd45
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 87 deletions.
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 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 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
54 changes: 5 additions & 49 deletions docs/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -1,55 +1,11 @@
{
"config": {
"default": true,
"header-increment": false,
"first-header-h1": false,
"header-style": false,
"ul-style": false,
"list-indent": false,
"ul-start-left": false,
"ul-indent": false,
"no-trailing-spaces": true, // Nice to have, easy to fix automatically
"no-hard-tabs": false,
"no-reversed-links": true,
"no-multiple-blanks": false,
"line-length": false, // Nice to have, lot of work
"commands-show-output": false,
"no-missing-space-atx": true,
"no-multiple-space-atx": true,
"no-missing-space-closed-atx": true,
"no-multiple-space-closed-atx": true,
"blanks-around-headers": false,
"header-start-left": false,
"no-duplicate-header": false,
"single-h1": false,
"no-trailing-punctuation": false,
"no-multiple-space-blockquote": true,
"no-blanks-blockquote": true,
"ol-prefix": false,
"list-marker-space": false,
"blanks-around-fences": false,
"blanks-around-lists": false,
"no-inline-html": false,
"no-bare-urls": false,
"hr-style": true,
"no-emphasis-as-header": false,
"no-space-in-emphasis": true,
"no-space-in-code": false,
"no-space-in-links": false,
"fenced-code-language": false,
"first-line-h1": false,
"no-empty-links": false,
"required-headers": true,
"proper-names": true,
"no-alt-text": false,
"code-block-style": true,
"single-trailing-newline": true,
"code-fence-style": true,
"emphasis-style": false,
"strong-style": false,
"link-fragments": true,
"reference-links-images": false,
"link-image-reference-definitions": true,
"line-length": {
"strict": true,
"code_blocks": false,
"line_length": 100
},

// part of the markdownlint-rule-relative-links plugin
"relative-links": true
Expand Down
32 changes: 18 additions & 14 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

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

## 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

```
$ 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

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.
14 changes: 10 additions & 4 deletions docs/docs/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +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
12 changes: 9 additions & 3 deletions docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,33 @@ 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](configuration.md)).
The database URL can be specified per environment in the `.env` files (see
[config](configuration.md)).

## Running the frontend and backend

Expand Down
4 changes: 3 additions & 1 deletion docs/docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ sidebar_position: 2
# 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
```

0 comments on commit 561dd45

Please sign in to comment.