This project is a server scraper for Rust game servers, which collects and stores information about various Rust servers using the BattleMetrics API.
- Ubuntu Server (20.04 LTS or later recommended)
- Node.js (v18 or later)
- npm (usually comes with Node.js)
- Git
-
Update your system:
sudo apt update && sudo apt upgrade -y -
Install Node.js and npm:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs -
Install Git:
sudo apt install git -y
-
Clone the repository:
cd /root/scripts git clone https://github.com/yourusername/rust-server-scraper.git cd rust-server-scraper
-
Install dependencies:
npm install
-
Create a
.envfile in the project root:cp .env.example .env
-
Edit the
.envfile with your actual values:nano .env
Update the following variables:
NEON_DATABASE_URL=your_neon_database_url RESEND_API_KEY=your_resend_api_key [email protected]
-
Create a systemd service file:
sudo nano /etc/systemd/system/rust-server-scraper.service
-
Add the following content to the file:
[Unit] Description=Rust Server Scraper After=network.target [Service] ExecStart=/usr/bin/node /root/scripts/rust-server-scraper/tests/run_scrapper.js Restart=always User=root Environment=PATH=/usr/bin:/usr/local/bin Environment=NODE_ENV=production WorkingDirectory=/root/scripts/rust-server-scraper [Install] WantedBy=multi-user.target -
Save and close the file.
-
Reload the systemd daemon:
sudo systemctl daemon-reload
-
Enable the service to start on boot:
sudo systemctl enable rust-server-scraper -
Start the service:
sudo systemctl start rust-server-scraper
-
To check the status of the service:
sudo systemctl status rust-server-scraper
-
To stop the service:
sudo systemctl stop rust-server-scraper
-
To restart the service:
sudo systemctl restart rust-server-scraper
-
To view logs:
sudo journalctl -u rust-server-scraper -f
-
Pull the latest changes:
cd /root/scripts/rust-server-scraper git pull origin main -
Install any new dependencies:
npm install
-
Restart the service:
sudo systemctl restart rust-server-scraper
-
If the service fails to start, check the logs for error messages:
sudo journalctl -u rust-server-scraper -n 50 --no-pager
-
Ensure that all environment variables in the
.envfile are correctly set. -
Verify that the Node.js version is compatible with the project requirements:
node --version
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE.md file for details.