Skip to main content

Deploy blu-docs.panville.com

This page covers the first-time host setup for the Blu docs site. For routine deploys, just run ./scripts/deploy.sh from the repo.

Prerequisites on the host

  • Ubuntu 22.04 / 24.04 with Apache 2.4
  • Node 20+ available system-wide (/usr/bin/npx for the systemd unit)
  • A DNS A record for blu-docs.panville.com pointing at the host
  • Certbot / Let's Encrypt access for SSL

One-time host bootstrap

# Apache modules
sudo a2enmod proxy proxy_http proxy_wstunnel headers ssl rewrite
sudo systemctl reload apache2

# Doc root
sudo mkdir -p /var/www/blu-docs/build
sudo chown -R ubuntu:ubuntu /var/www/blu-docs

# Chat server location
sudo mkdir -p /home/ubuntu/blu-docs-chat
sudo chown -R ubuntu:ubuntu /home/ubuntu/blu-docs-chat

Apache vhost

Copy scripts/blu-docs.panville.com.conf to /etc/apache2/sites-available/, then:

sudo a2ensite blu-docs.panville.com
sudo apache2ctl configtest
sudo systemctl reload apache2

Let's Encrypt

sudo certbot --apache -d blu-docs.panville.com

Certbot will rewrite the vhost to include the SSL block.

Chat server (systemd)

# 1. Sync the server directory
rsync -avz server/ ubuntu@blu-docs.panville.com:/home/ubuntu/blu-docs-chat/

# 2. Install Node deps on the host
ssh ubuntu@blu-docs.panville.com 'cd /home/ubuntu/blu-docs-chat && npm install'

# 3. Create .env with Anthropic API key
ssh ubuntu@blu-docs.panville.com 'echo "ANTHROPIC_API_KEY=sk-ant-..." > /home/ubuntu/blu-docs-chat/.env'

# 4. Install systemd unit
scp scripts/blu-docs-chat.service ubuntu@blu-docs.panville.com:/tmp/
ssh ubuntu@blu-docs.panville.com 'sudo cp /tmp/blu-docs-chat.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable blu-docs-chat && sudo systemctl start blu-docs-chat'

# 5. Verify
ssh ubuntu@blu-docs.panville.com 'curl -s http://localhost:3941/api/health'

The systemd unit reads /home/ubuntu/blu-docs-chat/.env for ANTHROPIC_API_KEY and the docs from /home/ubuntu/blu-docs-chat/docs/.

Routine deploys

From the repo (/Users/jsalinga/odoo/odoo17/custom/vgc17/blu-docs):

./scripts/deploy.sh

The script:

  1. Builds the Docusaurus site locally (npm run build)
  2. Rsyncs build/ to /var/www/blu-docs/build/ on the host
  3. If the chat server is installed, rsyncs docs/ to /home/ubuntu/blu-docs-chat/docs/ and restarts the systemd unit so the chat server reloads its system prompt with the latest docs