Files
bracket/search-doc.json

1 line
20 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"searchDocs":[{"title":"API","type":0,"sectionRef":"#","url":"/docs/api","content":"API Bracket has a REST API powered by FastAPI. The frontend sends requests to this API to the backend. The backend then does the actual processing (usually by querying the database). For normal usage of Bracket, you most likely don't need to use the API. Only in case you want to manipulate the state of Bracket via scripts/ The API specification is publicly available. FastAPI serves it in two versions, choose whatever you like best: ReDocSwagger UI","keywords":"","version":"Next"},{"title":"Contributing","type":0,"sectionRef":"#","url":"/docs/community/contributing","content":"","keywords":"","version":"Next"},{"title":"Translating","type":1,"pageTitle":"Contributing","url":"/docs/community/contributing#translating","content":" ","version":"Next","tagName":"h2"},{"title":"Adding translations (via crowdin)","type":1,"pageTitle":"Contributing","url":"/docs/community/contributing#adding-translations-via-crowdin","content":" Bracket uses crowdin for translations. You can add/improve translations here in your language. If you want to add a new language, please create an issue and I will add the language to Crowdin. ","version":"Next","tagName":"h3"},{"title":"Manually adding translations","type":1,"pageTitle":"Contributing","url":"/docs/community/contributing#manually-adding-translations","content":" You can add a translation by copying the English en locale (here) directory. Rename the directory to the name of your locale, and start translating the common.json file inside the directory. It might be useful to use an online tool (Google translate json file) to do the translation for you, and then carefully check and correct any mistakes. ","version":"Next","tagName":"h3"},{"title":"Contributors","type":1,"pageTitle":"Contributing","url":"/docs/community/contributing#contributors","content":" Erik Vroon Null BachErik Danny Piper SevicheCC IzStriker Raphael Le Goaller ","version":"Next","tagName":"h2"},{"title":"Star History","type":1,"pageTitle":"Contributing","url":"/docs/community/contributing#star-history","content":" ","version":"Next","tagName":"h2"},{"title":"Deployment","type":0,"sectionRef":"#","url":"/docs/deployment/","content":"","keywords":"","version":"Next"},{"title":"Configuration","type":1,"pageTitle":"Deployment","url":"/docs/deployment/#configuration","content":" ","version":"Next","tagName":"h2"},{"title":"Backend configuration","type":1,"pageTitle":"Deployment","url":"/docs/deployment/#backend-configuration","content":" The following configuration variables need to be adjusted for the backend to run it in production: JWT_SECRET: Create a random secret using openssl rand -hex 32CORS_ORIGINS: Set frontend domain names for CORS. For example: CORS_ORIGINS=https://frontend.bracket.com.ADMIN_EMAIL and ADMIN_PASSWORD: It's important to not leave the admin credentials to the default values.ALLOW_INSECURE_HTTP_SSO: Must be set to false Optional: SENTRY_DSN: The Sentry DSN for monitoring and error trackingBASE_URL: The base url of the API used for SSO See the config docs for more information. ","version":"Next","tagName":"h3"},{"title":"Developing","type":0,"sectionRef":"#","url":"/docs/community/development","content":"","keywords":"","version":"Next"},{"title":"Database","type":1,"pageTitle":"Developing","url":"/docs/community/development#database","content":" First create a bracket cluster: 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: 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 testsbracket_prod: for a production database The database URL can be specified per environment in the .env files (seeconfig). ","version":"Next","tagName":"h2"},{"title":"Running the frontend and backend","type":1,"pageTitle":"Developing","url":"/docs/community/development#running-the-frontend-and-backend","content":" To run Bracket (frontend and backend) locally without Docker, one needs yarn and pipenv. The following starts the frontend and backend for local development in the root directory of Bracket: ./run.sh If either the frontend or backend doesn't shut down correctly, you can run (on Linux)killall gunicorn node. But be careful that this will also kill other gunicorn and node processes. In case you want to run the frontend and backend yourself, see the following two sections. ","version":"Next","tagName":"h2"},{"title":"Frontend","type":1,"pageTitle":"Developing","url":"/docs/community/development#frontend","content":" cd frontend yarn run dev ","version":"Next","tagName":"h3"},{"title":"Backend","type":1,"pageTitle":"Developing","url":"/docs/community/development#backend","content":" cd backend pipenv install -d pipenv shell ./run.sh ","version":"Next","tagName":"h3"},{"title":"Alternative: running Bracket via process-compose","type":1,"pageTitle":"Developing","url":"/docs/community/development#alternative-running-bracket-via-process-compose","content":" Alternatively, you can use process-compose to run the app locally. It works similarly to docker-compose, except it works with non-containerized applications. Just install it according to the docsand then run: cp process-compose-example.yml process-compose.yml process-compose up -d Press CTRL + C (or F10) to exit. You can adjust the config by editing process-compose.yml. ","version":"Next","tagName":"h3"},{"title":"Frontend configuration","type":1,"pageTitle":"Deployment","url":"/docs/deployment/#frontend-configuration","content":" The following configuration variables need to be adjusted for the frontend to run it in production: NEXT_PUBLIC_API_BASE_URL: The base URL of the backend API to which the frontend sends requests. For example: https://api.bracket.com Optional: NEXT_PUBLIC_HCAPTCHA_SITE_KEY: The HCaptcha key used for captcha challenges when creating new accounts. You get the secret when you create a new site in HCaptcha. If left blank, HCaptcha will be disabled for your site. ","version":"Next","tagName":"h3"},{"title":"Running in production","type":1,"pageTitle":"Deployment","url":"/docs/deployment/#running-in-production","content":" There's a few ways to run Bracket (frontend and backend) in production, such as via docker-compose and Nomad. The frontend can also be deployed to a cloud service like Vercel. See the other pages in this category for more details per platform. ","version":"Next","tagName":"h2"},{"title":"Cloud services","type":0,"sectionRef":"#","url":"/docs/deployment/cloud-services","content":"","keywords":"","version":"Next"},{"title":"Vercel","type":1,"pageTitle":"Cloud services","url":"/docs/deployment/cloud-services#vercel","content":" To deploy the frontend to Vercel, use the following link: https://vercel.com/new/project?template=https://github.com/evroon/bracket Make sure to select the frontend directory as root directory, and use Next.js as framework. ","version":"Next","tagName":"h2"},{"title":"Docker","type":0,"sectionRef":"#","url":"/docs/deployment/docker","content":"","keywords":"","version":"Next"},{"title":"1. Install Docker and docker compose","type":1,"pageTitle":"Docker","url":"/docs/deployment/docker#1-install-docker-and-docker-compose","content":" First, make sure you have docker and docker compose installed. ","version":"Next","tagName":"h2"},{"title":"2. Store the docker-compose.yml file","type":1,"pageTitle":"Docker","url":"/docs/deployment/docker#2-store-the-docker-composeyml-file","content":" Then, store the following YAML in a file called docker-compose.yml in an empty directory. The highlighted lines will be discussed in the next steps. services: bracket-frontend: image: ghcr.io/evroon/bracket-frontend container_name: bracket-frontend ports: - "3000:3000" environment: NODE_ENV: "production" NEXT_PUBLIC_API_BASE_URL: "http://your-site.com:8400" NEXT_PUBLIC_HCAPTCHA_SITE_KEY: "10000000-ffff-ffff-ffff-000000000001" restart: unless-stopped bracket-backend: image: ghcr.io/evroon/bracket-backend container_name: bracket-backend ports: - "8400:8400" environment: ENVIRONMENT: "PRODUCTION" PG_DSN: "postgresql://bracket_prod:bracket_prod@postgres:5432/bracket_prod" CORS_ORIGINS: https://your-site.com JWT_SECRET: change_me volumes: - ./backend/static:/app/static restart: unless-stopped depends_on: - postgres postgres: image: postgres restart: always environment: POSTGRES_DB: bracket_prod POSTGRES_USER: bracket_prod POSTGRES_PASSWORD: bracket_prod volumes: - ./postgres:/var/lib/postgresql/data ","version":"Next","tagName":"h2"},{"title":"3. Set up the environment variables","type":1,"pageTitle":"Docker","url":"/docs/deployment/docker#3-set-up-the-environment-variables","content":" Replace the lines that are highlighted in the code block from the previous step. Replace the following values for bracket-frontend: NEXT_PUBLIC_API_BASE_URL: The address of your backend. The frontend will send requests to this address.NEXT_PUBLIC_HCAPTCHA_SITE_KEY: Either leave empty to disable it orsignup for hCaptcha, create a site and put the site key here Replace the following values for bracket-backend: PG_DSN: The DSN with format postgresql://<username>:<password>@<host>:<port>/<database>CORS_ORIGINS: Put the address of your frontend here, it's used to make sure incoming requests can only come from your actual frontendJWT_SECRET: Generate a secret to create JWTs using openssl rand -hex 32 warning Note that your docker-compose.yml file now contains secrets. If you want a more secure setup, you can store secrets in separate files on the host and load them via docker secrets. ","version":"Next","tagName":"h2"},{"title":"4. Update volume bindings","type":1,"pageTitle":"Docker","url":"/docs/deployment/docker#4-update-volume-bindings","content":" Bracket needs two volume bindings: for the backend and for the database. Update the two volume binding paths to point to a directory where you want to store the persistent data. ","version":"Next","tagName":"h2"},{"title":"5. Access the application","type":1,"pageTitle":"Docker","url":"/docs/deployment/docker#5-access-the-application","content":" Run it using docker compose up -d in the same directory as the file. Access Bracket at http://localhost:3000. ","version":"Next","tagName":"h2"},{"title":"Systemd","type":0,"sectionRef":"#","url":"/docs/deployment/systemd","content":"","keywords":"","version":"Next"},{"title":"Backend","type":1,"pageTitle":"Systemd","url":"/docs/deployment/systemd#backend","content":" [Unit] Description=Bracket backend After=syslog.target After=network.target [Service] Type=simple User=bracket WorkingDirectory=/var/lib/bracket/backend ExecStart=pipenv run gunicorn -k uvicorn.workers.UvicornWorker bracket.app:app --bind localhost:8400 --workers 1 Environment=ENVIRONMENT=PRODUCTION TimeoutSec=15 Restart=always RestartSec=2s [Install] WantedBy=multi-user.target ","version":"Next","tagName":"h2"},{"title":"Frontend","type":1,"pageTitle":"Systemd","url":"/docs/deployment/systemd#frontend","content":" [Unit] Description=Bracket frontend After=syslog.target After=network.target [Service] Type=simple User=bracket WorkingDirectory=/var/lib/bracket/frontend ExecStart=/usr/local/bin/yarn start Environment=NODE_ENV=production TimeoutSec=15 Restart=always RestartSec=2s [Install] WantedBy=multi-user.target ","version":"Next","tagName":"h2"},{"title":"FAQ","type":0,"sectionRef":"#","url":"/docs/running-bracket/faq","content":"","keywords":"","version":"Next"},{"title":"I ran Bracket with the default docker-compose.yml but I can't connect to the backend?","type":1,"pageTitle":"FAQ","url":"/docs/running-bracket/faq#i-ran-bracket-with-the-default-docker-composeyml-but-i-cant-connect-to-the-backend","content":" This is likely because you are trying to access Bracket on a different address thanhttp://localhost:3000 in the browser. In that case, two things need to be changed: Change NEXT_PUBLIC_API_BASE_URL to the address of the backend, e.g https://api.example.org.You will also need to update CORS_ORIGINS to the address of the frontend, e.g.https://app.example.org. Please consult configuration docs for more information. ","version":"Next","tagName":"h2"},{"title":"Quickstart","type":0,"sectionRef":"#","url":"/docs/running-bracket/quickstart","content":"Quickstart To quickly run bracket to see how it works, clone it and run docker compose up: 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 the following credentials: Username: test@example.orgPassword: aeGhoe1ahng2Aezai0Dei6Aih6dieHoo. To insert dummy rows into the database, run: sudo docker exec bracket-backend pipenv run ./cli.py create-dev-db ","keywords":"","version":"Next"},{"title":"Introduction","type":0,"sectionRef":"#","url":"/docs/intro","content":"","keywords":"","version":"Next"},{"title":"Overview of features","type":1,"pageTitle":"Introduction","url":"/docs/intro#overview-of-features","content":" 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.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.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. ","version":"Next","tagName":"h2"},{"title":"Configuration","type":0,"sectionRef":"#","url":"/docs/running-bracket/configuration","content":"","keywords":"","version":"Next"},{"title":"Backend","type":1,"pageTitle":"Configuration","url":"/docs/running-bracket/configuration#backend","content":" Copy ci.env to prod.env and fill in the values: PG_DSN: The URL of the PostgreSQL databaseJWT_SECRET: Create a random secret using openssl rand -hex 32CORS_ORIGINS and CORS_ORIGIN_REGEX: Specify allowed frontend domain names for CORS (see theFastAPI docs)ADMIN_EMAIL and ADMIN_PASSWORD: The credentials of the admin user, which is created when initializing the databaseSENTRY_DSN: The Sentry DSN for monitoring and error trackingBASE_URL: The base url of the API used for SSOALLOW_USER_REGISTRATION: Can be used to disallow user registration in the web app, currently used for production while bracket is still in betaALLOW_INSECURE_HTTP_SSO: Should not be used in production. Allows use of INSECURE requests for SSO auth.AUTO_RUN_MIGRATIONS: Whether to run (alembic) migrations automatically on startup or not. Migrations can be applied manually using pipenv run alembic upgrade head. ","version":"Next","tagName":"h2"},{"title":"Backend: Example configuration file","type":1,"pageTitle":"Configuration","url":"/docs/running-bracket/configuration#backend-example-configuration-file","content":" This is an example of how the config file should look like: PG_DSN='postgresql://bracket_ci:bracket_ci@localhost:5532/bracket_ci' JWT_SECRET='60eed5c5dc7a919b8595a23d6c42ddd8274e4feea651dc028d9bee495bbb9acd' CORS_ORIGINS='https://bracket.mydomain.com' CORS_ORIGIN_REGEX='https://.*\\.vercel\\.app' ADMIN_EMAIL='admin@example.com' ADMIN_PASSWORD='some unused password' SENTRY_DSN='my sentry dsn' ALLOW_USER_REGISTRATION=false ALLOW_INSECURE_HTTP_SSO=false CAPTCHA_SECRET='xxx' AUTO_RUN_MIGRATIONS=true ","version":"Next","tagName":"h3"},{"title":"Frontend","type":1,"pageTitle":"Configuration","url":"/docs/running-bracket/configuration#frontend","content":" NEXT_PUBLIC_HCAPTCHA_SITE_KEY: The HCaptcha key used for captcha challenges when creating new accounts. You get the secret when you create a new site in HCaptcha.NEXT_PUBLIC_API_BASE_URL: The base URL of the backend API to which the frontend sends requests. For example: https://api.bracket.comANALYTICS_DATA_DOMAIN: The data-domain attribute passed to the script for Plausible analyticsANALYTICS_DATA_WEBSITE_ID: The data-website-id attribute passed to the script for Umami analyticsANALYTICS_SCRIPT_SRC: The URL to the script for analytics purposes. ","version":"Next","tagName":"h2"},{"title":"Frontend: Example configuration file","type":1,"pageTitle":"Configuration","url":"/docs/running-bracket/configuration#frontend-example-configuration-file","content":" You can store the config in .env.local (as described in the Next docs). This is an example of how the config file should look like: NEXT_PUBLIC_HCAPTCHA_SITE_KEY='10000000-ffff-ffff-ffff-000000000001' NEXT_PUBLIC_API_BASE_URL='https://api.bracket.com' ANALYTICS_SCRIPT_SRC='https://analytics.bracket.com/script.js' ANALYTICS_DATA_DOMAIN='bracket.com' ANALYTICS_DATA_WEBSITE_ID='bracket.com' ","version":"Next","tagName":"h3"},{"title":"Why does this exist?","type":1,"pageTitle":"Introduction","url":"/docs/intro#why-does-this-exist","content":" 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 github. Let me know if you find one, I will list it here as alternative to Bracket. Furthermore, the closed-source tournament systems that can be found online are typically payware, and quite expensive. Secondly, there is a lack of tournament systems that support Swiss tournaments. There are a few that exist, but they're typically quite ancient projects. Furthermore, AFAIK the Swiss tournament systems that exist usually only support Swiss, no other types of tournament elements (round-robin, elimination etc.). That is quite a limitation when you want to host a tournament that starts with Swiss and determines a winner based on a knockoff (elimination) stage. Finally, I developed this project to learn more about Next.js and apply my Python (e.g. FastAPI) experience to a project with a real purpose. ","version":"Next","tagName":"h2"},{"title":"Quickstart","type":1,"pageTitle":"Introduction","url":"/docs/intro#quickstart","content":" To get started, follow the steps described in quickstart ","version":"Next","tagName":"h2"},{"title":"Nomad","type":0,"sectionRef":"#","url":"/docs/deployment/nomad","content":"","keywords":"","version":"Next"},{"title":"Backend","type":1,"pageTitle":"Nomad","url":"/docs/deployment/nomad#backend","content":" job "bracket-backend" { datacenters = ["*"] group "servers" { count = 1 network { port "uvicorn" { to = 8400 } } service { provider = "nomad" port = "uvicorn" } task "api" { driver = "docker" env { ENVIRONMENT = "PRODUCTION" PG_DSN = "postgresql://bracket_prod:bracket_prod@postgres:5432/bracket_prod" JWT_SECRET = "38af87ade31804cc115166f605586a57c6533eeb4342e66c5229f44a76afdde4" AUTO_RUN_MIGRATIONS = "false" } config { image = "ghcr.io/evroon/bracket-backend" ports = ["uvicorn"] command = "pipenv" args = [ "run", "uvicorn", "bracket.app:app", "--port", "${NOMAD_PORT_uvicorn}", "--host", "0.0.0.0", ] } resources { cpu = 256 memory = 512 } } } } ","version":"Next","tagName":"h2"},{"title":"Frontend","type":1,"pageTitle":"Nomad","url":"/docs/deployment/nomad#frontend","content":" job "bracket-frontend" { datacenters = ["*"] group "servers" { count = 1 network { port "nextjs" { } } service { provider = "nomad" port = "nextjs" } task "api" { driver = "docker" env { NEXT_PUBLIC_API_BASE_URL = "https://my.bracketdomain.com" NEXT_PUBLIC_HCAPTCHA_SITE_KEY = "xxxxx" NODE_ENV = "production" } config { image = "ghcr.io/evroon/bracket-frontend" ports = ["nextjs"] args = ["yarn", "start", "-p", "${NOMAD_PORT_nextjs}"] } resources { cpu = 256 memory = 512 } } } } ","version":"Next","tagName":"h2"}],"options":{"id":"default"}}