Skip to main content

Server Setup

This project is ran on our Debian server, but this setup should work on any Debian-based server.

1. Install system dependencies

This project requires rsync for syncing the documentation from repos, and nginx for routing, and then node for running the framework.

sudo apt update
sudo apt install -y git curl rsync nginx

Use the NodeSource repo for Node.js 22:

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs

You can verify the correct version matches what this project requires:

node --version # v22.x.x

Then we need the pnpm package manager:

npm install -g pnpm

2. Clone the repo

git clone https://github.com/TrickfireRobotics/docs.git /home/trickfire/docs
cd /home/trickfire/docs

3. Install dependencies and build

pnpm install --frozen-lockfile
pnpm website:build

The first build takes 1–2 minutes. Subsequent builds are faster due to pnpm's cache.

4. Configure nginx

The sites-available/sites-enabled directories are not created automatically on all distros. Create them if missing, then copy the config and enable it:

sudo mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled
sudo cp /home/trickfire/docs/scripts/nginx.conf /etc/nginx/sites-available/trickfire-docs
sudo ln -s /etc/nginx/sites-available/trickfire-docs /etc/nginx/sites-enabled/trickfire-docs

Make sure /etc/nginx/nginx.conf includes the sites-enabled directory inside its http {} block. Check with:

grep -n "sites-enabled" /etc/nginx/nginx.conf

If nothing is returned, add this line inside the http {} block:

include /etc/nginx/sites-enabled/*;

nginx runs as www-data and cannot traverse /home/trickfire by default. Grant execute permission:

sudo chmod o+x /home/trickfire

Then test and reload:

sudo nginx -t
sudo nginx -s reload

The config serves build/ on localhost:80. The Cloudflare tunnel (set up next) is what exposes this to the internet, nginx itself only listens on localhost.

5. Verify the server

curl -s http://localhost/ | grep -i title
# ...<title data-rh=true>Home | TrickFire Robotics Docs</title>...

Updating the server

The scripts/build.sh script handles updates automatically. To run it manually:

bash /home/trickfire/docs/scripts/build.sh

This pulls the latest framework code, updates dependencies if the lockfile changed, and rebuilds the site. Content in content/ is untouched (it's gitignored).