This repository serves as a method to implement version control for the website, as well as allowing for a more modular workflow when creating future updates.
This repository should not be treated as a backup for the website. Backups are automatically made on the webserver's online dashboard.
When a change is made to the repository, GitHub Actions will automatically begin making the change on the webserver. Here are the steps it takes to do so:
- Repo is checked out
- Installs rsync + SSH
- Sets up SSH key + known hosts
- Runs rsync to copy repo → server (at /var/www/fridg3.org)
When making an update yet to be released, you can create a new branch and then pull it to main whenever it's ready.
All site data (accounts, audio, downloads, posts and images) must be stored in /data. This directory should be backed up to a location outside the web server every so often.
This directory has to be manually modified and then updated, any updates via Git will not be tracked. This is to ensure the security of the directory's data (sensitive information is stored here) and to keep the total size of the repository low.
Sensitive information must be stored in .json files. The web server will block client access to the .json files, so any reference to the .json files need to be within PHP, not JavaScript.
Every file and directory in the website's root must belong to the "deploy" user, otherwise GitHub Actions won't be able to update it. The following commands can be issued on the webserver to ensure this requirement is met:
sudo chown -R deploy:http /var/www/fridg3.org
find /var/www/fridg3.org -type d -exec chmod 755 {} \;
find /var/www/fridg3.org -type f -exec chmod 644 {} \;/data/ and sitemap.xml will not be writeable by the web server unless they're owned by the "http" user. Run the following commands (ideally after pushing to the main branch) to fix permissions:
sudo chown -R http:http /var/www/fridg3.org/data && sudo chmod -R 755 /var/www/fridg3.org/data
sudo chown -R http:http /var/www/fridg3.org/sitemap.xml && sudo chmod -R 755 /var/www/fridg3.org/sitemap.xmlHere's a single command that bundles all of the above commands together:
sudo chown -R deploy:http /var/www/fridg3.org && find /var/www/fridg3.org -type d -exec chmod 755 {} \; && find /var/www/fridg3.org -type f -exec chmod 644 {} \; && sudo chown -R http:http /var/www/fridg3.org/data && sudo chmod -R 755 /var/www/fridg3.org/data && sudo chown -R http:http /var/www/fridg3.org/sitemap.xml && sudo chmod -R 755 /var/www/fridg3.org/sitemap.xmlI've created two technical references to familiarise you with how the website backend works, how files are formatted, how JavaScript works and more. Both of these files are in the repository, and are consistently kept up-to-date.
TECHNICAL_REFERENCE_DEV.md contains all the technical information in a human-readable format, such as:
- The /data/ directory and how files are stored within it
- An explanation on how every page works, and exactly what they do
- How local data is stored (e.g. login sessions, user settings)
- How all the pages are loaded and how dynamic content (i.e. journal and feed post listing) is displayed
- How the API works and where it's used
- And much more!
If you need help understanding anything in this file, you can contact me and I'll be happy to help.
TECHNICAL_REFERENCE_AI.md is the same as TECHNICAL_REFERENCE_DEV.md, but formatted to be used as a reference for an AI (e.g. GitHub CoPilot).
- I fully support the usage of AI in development for this project, as long as no frontend content (site styling, page text content, journal and feed posts, etc.) are AI-generated.
- I recommend telling your AI to reference this file so it makes changes that respects how the website already works.
- Make sure everything implemented is secure (e.g. if something should be server-side, make sure your AI isn't implementing it in JavaScript).