Skip to content

Latest commit

 

History

History
159 lines (118 loc) · 5.42 KB

CONTRIBUTING.md

File metadata and controls

159 lines (118 loc) · 5.42 KB

Contributing to bfportal.gg

First off, thanks for taking the time to contribute! 🎉🎉

This file contains a few guidelines on how to contribute to the Battlefield Portal Library hosted at bfportal.gg These are not rules but just some suggestion, so feel free to propose any change in the project

Architecture of the Project

Before you start contributing you should understand the stack that this projects uses

image

As shown in the architecture picture the project is built based on the following:

Backend:

Frontend:

  • HTML/CSS/JS

Runtime Environment:

  • Docker Container Images on Linux

If you're not familiar with Django or Wagtail, it might be good to start with wagtail.

Django Apps

App Description
bfportal This app Contains the base settings and base html file that is used to generate any webpage on the website
core The app is the heart of "Experience listing" and User profile, all the models used in the Database are defined in this

Few key components

  • All the "webpages" are in <app>/<templates>/<app>/ directory, we can use this structure to override the template of other apps that are installed in python
  • The models for all "pages" type are defined in /core/models/*
  • The API at (https://api.bfportal.gg/) is defined and controlled by /core/api/*
  • Form validation and discord hooks are done in /core/views.py

How to contribute

  • Pick an issue or Create a new one explaning the change/feature you want to add
  • Create a new branch for that issue
  • Make your changes
  • Make sure all the precommit test are passed
  • Open a pull request to merge the branch into main branch
  • The changes will be reviewed on dev deployment
  • Upon successfully testing dev will be merged into production

How to discuss with the maintainers

Development Environment Setup

Containerized Setup

Prerequisites

You need to install the following applications on your system

Todo

  • docker pre-commit hooks in docker environment
    • all hooks except commit-msg-validator are working.

Setup

  • Clone in repo and cd into it

    git clone https://gh.bfportal.gg/
    
  • Install poetry for dependency management

    curl -sSL https://install.python-poetry.org | python3 -
    
  • Install project dependencies

    poetry install
    
  • Install the pre-commit hooks by running

    pre-commit install --install-hooks
    
  • Copy the .env.template file to .env

  • (optional) Create a discord application for OAuth2 and copy the client id and secret

    • Paste the client id and secret in .env file to DISCORD_CLIENT_ID and DISCORD_SECRET respectively
  • From the repositories root directory build the necessary docker images and run the platform

    docker-compose up
    
  • The website should become available at 127.0.0.1:8000

Non-Container Environment Setup

Prerequisites

You need to install the following applications on your system

Setup

  • Install poetry for dependency management

    curl -sSL https://install.python-poetry.org | python3 -
    
  • Install python dependencies

    cd bfportal.gg
    poetry install
    
  • Install the pre-commit hooks by running

    pre-commit install --install-hooks
    
  • Install npm dependencies

    cd bfportal.gg/bfportal
    npm install
    
  • Copy the .env.template file to .env

  • (optional) Create a discord application for OAuth2 and copy the client id and secret

    • Paste the client id and secret in .env file to DISCORD_CLIENT_ID and DISCORD_SECRET respectively
  • Make sure postgres is installed and running

    • Create DB, USER and Password for the project
    • Update the .env file accordingly
  • Launch the server / web page with following commands:

cd bfportal.gg/bfportal
python manage.py migrate --noinput
python manage.py ensure_superuser --username bfportal --email [email protected] --password 1234
python manage.py ensure_initialization
python manage.py mock -u 3 -e 10 --clear
python manage.py runserver 0.0.0.0:8000