Here's how I setup a VPS to run ahap.info.
I first setup a $5/month droplet on Digital Ocean with Ubuntu 22.04 and followed these instructions.
- Initial Server Setup
- Passwordless sudo
- Install Nginx
- Secure Nginx with Let's Encrypt
- Install Node.js with NVM
- Setup Node.js for Production
Clone the onetech repo and build it:
git clone https://github.com/connorhsm/ahap.info
npm install
npm run build
Setup the server config:
server {
root /var/www/ahap.info/onetech/public;
index index.html;
server_name ahap.info edge.ahap.info www.ahap.info;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(ico|css|js|gif|jpe?g|png|json|svg)$ {
# try the file directly
}
# ...
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
I also enabled gzip on /etc/nginx/nginx.conf
:
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 256;
gzip_disable "MSIE [1-6].(?!.*SV1)";
Make sure to setup ahap.info domain to point to the droplet.
Run this to install ImageMagick and Cairo for the node-canvas.
sudo apt-get install imagemagick libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++ libsox-fmt-mp3 sox
Then run it:
cd onetech
node process download
Setup cron to run the update script every so often, this will watch both Git repos and update the site when they change.
*/5 * * * * ONETECH_MOD_NAME="Another Hour Another Planet" ONETECH_PROCESS_GIT_URL="https://github.com/jasonrohrer/AnotherPlanetData" bash /var/www/ahap.info/onetech/updater/update.sh >> /var/www/ahap.info/onetech/updater/update.log 2>&1
That's it!