RacingTracker is a free and open source web application that allows you to manage races in the world of motor racing with an innovative scoring system.
In motor racing, the predominant scoring system is based exclusively on the final position of the participants. This traditional approach assigns fixed scores to each position without considering key factors such as relative performance, prior expectations or the particular conditions of each driver or team. As a result, the current system has two main shortcomings:
-
Lack of recognition of relative performance: A driver or team with limited resources who achieves a modest result could be performing at an exceptional level based on their capabilities, but the system does not reflect this merit.
-
Little appreciation for exceeding expectations: A pilot from a leading team who finishes in a high position simply meets expectations, without receiving additional recognition if his performance exceeds initial projections.
These limitations raise a fundamental question: is a scoring system that only considers final position without assessing context and relative performance really equitable? The answer, from my perspective, is no. I therefore propose the development of a fairer and more dynamic ranking system, capable of more accurately reflecting the true merit of each driver and team.
📁 root/
|-- app/ # Application core
| |-- Http/
| | |-- Controllers # Route controllers
| | |-- Middleware # HTTP middleware
| | \-- Requests # Form request validation
| |-- Models # Eloquent models
| \-- Providers # Service providers
|
|-- database/ # Database files
| |-- factories # Model factories for seeding
| |-- migrations # Database schema migrations
| |-- seeders # Database seeders
| \-- database.sqlite # SQLite database
|
|-- documents/ # Project documentation
| |-- resources # Images, diagrams, etc.
| \-- memoria.docx # Project document
|
|-- public/ # Publicly accessible files
|
|-- resources/ # Frontend resources
| |-- css # CSS styles
| |-- js/ # TypeScript frontend code
| | |-- components # Reusable components
| | |-- hooks # Custom React hooks
| | |-- layouts # Layout components
| | |-- lib # Utility functions
| | |-- pages # Page-level components
| | \-- types # TypeScript types/interfaces
| \-- views # Blade views
|
\-- routes/ # Route definitionsβ: performance deviation (μ/6.0)μ: current driver points (25.0)τ: dynamic factor of change (μ/300.0)σ: current driver uncertainty (μ/3.0)A: expected average positionF: final position in the raceP: number of race participants
Performance deviation:
Dynamic factor of change:
Combined variance of performance:
Updating factor:
Error between expected and actual position:
Updating μ:
Impact of error in σ:
Proposed change in σ:
σ maximum change limit (15%):
Application of limits to σ change if
Application of limits to σ change if
σ update (with minimum 0.001):
- Clone the repository:
git clone https://github.com/Qv1ko/RacingTracker.git- Change the working directory:
cd RacingTracker- Install the dependencies:
composer install && npm install- Copy the
.env.examplefile to.env:
cp .env.example .env- Generate the application key:
php artisan key:generate- Run the migrations:
php artisan migrate- Run the seeders:
php artisan db:seed- Run the server:
npm run build && php artisan serve- Open http://localhost:8000 in your browser.
- AWS account
- Fork the RacingTracker repository
-
Create a new VPC in AWS.
-
Create a new EC2 instance in AWS:
- Select Ubuntu OS
- Create a new key pair
- Select the VPC you created in the previous step in the network settings
- Select the public subnet in the network settings
- Enable the auto-assign public IP option in the network settings
- Create two new security groups rules:
- Type: HTTP (80), Source type: Anywhere
- Type: HTTPS (443), Source type: Anywhere
-
Edit key pair permissions in your local machine:
sudo chmod 0600 "path/to/your/key.pem"- Connect with SSH to the EC2 instance:
ssh -i "path/to/your/key.pem" ubuntu@ec2-public-ip-address`- Update the system:
sudo apt update && sudo apt upgrade -y-
Reboot the instance in AWS.
-
Install the necessary packages:
sudo apt install nginx -y && sudo add-apt-repository ppa:ondrej/php -y && sudo apt install -y php8.2-fpm php8.2-curl php8.2-xml php8.2-mbstring php8.2-zip php8.2-mysql php8.2-sqlite3 php8.2-redis zip unzip && sudo curl -sS https://getcomposer.org/installer | php && sudo mv ~/composer.phar /usr/local/bin/composer && curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install nodejs -y && composer --version && node -v && npm -v- Create a new user to make deployment more secure:
sudo adduser deploy-user- Access the new user home directory:
sudo su deploy-user && cd ~- Generate GitHub ssh keys for the new user:
ssh-keygen -f /home/deploy-user/.ssh/github_rsa -t rsa- Create a new GitHub config file:
nano /home/deploy-user/.ssh/configHost github.com
IdentityFile ~/.ssh/github_rsa
IdentitiesOnly yes- Change ssh directory and files permissions:
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*- Add a new deploy key in the forked GitHub repository where its value will be the key
github_rsa.pub:
cat ~/.ssh/github_rsa.pub- Clone the forked repository:
git clone [email protected]:your-username/RacingTracker.git code && cd code- Install the dependencies:
composer install && npm install- Copy the
.env.examplefile to.env:
cp .env.example .env- Generate the application key:
php artisan key:generate- Run the migrations:
php artisan migrate- Run the seeders:
php artisan db:seed- Build the frontend:
npm run build- Remove default file in sites-enabled:
exitsudo rm /etc/nginx/sites-enabled/default- Create a config file in sites-available:
sudo nano /etc/nginx/sites-available/racingtracker.confserver {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /home/deploy-user/code/public; # Change deploy-user to your username
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}- Create a symlink to the config file in sites-enabled:
sudo ln -s /etc/nginx/sites-available/racingtracker.conf /etc/nginx/sites-enabled/- Test if the configuration is correct:
sudo nginx -t- Reload the nginx service:
sudo service nginx reload- Add the nginx user in a new group with deploy-user:
sudo usermod -aG deploy-user www-data- Modify php-fpm pool configuration:
sudo nano /etc/php/8.2/fpm/pool.d/www.conf; pool name ('www' here)
[deploy-user]
...
user = deploy-user
group = deploy-user
...
listen.owner = deploy-user
listen.group = deploy-user- Restart the php-fpm service:
sudo service php8.2-fpm restart- You can now access the application at http://ec2-public-ip-address.
- Install the necessary dependencies:
sudo apt install openssl -y- Create a new directory for the SSL/TLS certificate:
sudo su deploy-usermkdir ~/.ssl && cd ~/.ssl- Create a config file in a new directory:
nano san.cnf[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[dn]
C = # Country
ST = # State
L = # Locality
O = # Organization
OU = # Organizational Unit
CN = XX.XX.XX.XX # EC2 instance public IP address
[req_ext]
subjectAltName = @alt_names
[alt_names]
IP.1 = XX.XX.XX.XX # EC2 instance public IP address- Generate a RSA key pair:
openssl genrsa -out server.key 2048- Generate the certificate signing request (CSR):
openssl req -x509 -nodes -newkey rsa:2048 \
-keyout server.key \
-out server.crt \
-days 365 \
-subj "/CN=XX.XX.XX.XX"- Edit nginx configuration file:
exitsudo nano /etc/nginx/sites-available/racingtracker.confserver {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl;
server_name XX.XX.XX.XX; # EC2 instance public IP address
root /home/deploy-user/code/public; # Change deploy-user to your username
index index.html index.htm index.php;
ssl_certificate /home/deploy-user/.ssl/server.crt; # Change deploy-user to your username
ssl_certificate_key /home/deploy-user/.ssl/server.key; # Change deploy-user to your username
# Redirect HTTP to HTTPS
if ($scheme != "https") {
return 301 https://$server_name$request_uri;
}
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}- Check if the configuration is correct and reload the nginx service:
sudo nginx -t && sudo systemctl reload nginx- You can now access the application at https://ec2-public-ip-address.
Distributed under the MIT License. See LICENSE for more information.