- PHP 45.1%
- JavaScript 17.4%
- HTML 13%
- CSS 11.4%
- Python 8.7%
- Other 4.4%
|
|
||
|---|---|---|
| controller | add comment to honeypot functionality | |
| model | refactor code to make it somewhat sensible ( #2 ) | |
| pandoc | refactor code to make it somewhat sensible ( #2 ) | |
| public | new update and name update | |
| site-data | new update and name update | |
| sql | refactor code to make it somewhat sensible ( #2 ) | |
| templates | fix html error | |
| view | refactor code to make it somewhat sensible ( #2 ) | |
| .gitignore | add header | |
| compose.yaml | fix cookie security | |
| Dockerfile | refactor code to make it somewhat sensible ( #2 ) | |
| LICENSE | update license and index page | |
| README.md | update readme | |
Website
"Abandon all hope, ye who enter here"
This mess of PHP spaghetti code is my personal website. You can visit it at https://jjanzen.ca. All content of the website is licensed under the MIT License.
Technology
The website is built using Docker to aid in configuration of various services
needed to run the site. I place the site behind a reverse proxy using Caddy to
serve requests for jjanzen.ca to the appropriate port. This is convenient for
running a test instance of the site alongside the production instance (no, you
can't access the test instance; it's behind a firewall).
Pages are written in Emacs Org Mode, which are converted into html using
Pandoc. I also have an RSS feed for my blog posts generated by a Python script.
I do not recommend using my RSS generator script. It works well enough for my
needs, but it is very hacked together.
The actual site is hosted under a FrankenPHP container. Why FrankenPHP? It performs better than the PHP executable (which is really just for debug purposes anyway) and is easier to figure out with Docker than PHP-FPM. Why PHP? I really don't like JavaScript, but do want to have modular pages and interactive components. I suppose CGI scripts would work too, but PHP feels like a more sensible technology for this use case.
I had previously used Atabook as a guestbook system,
but have since moved to a homemade guestbook built in PHP. Messages are stored
in a PostgreSQL database. I have a simple system for approving messages to avoid
losers on the Internet polluting the publicly viewable guestbook with garbage.
Messages are placed into a pending state upon creation. I have a simple
password-protected admin page where I can view all messages, set their approval
status (or delete them), and write replies that will be displayed alongside the
message. This is probably a good use-case for HTTP basic access authentication,
but rolling my own felt nice and the security in my implementation is "good
enough" so long as you're using HTTPS (which is enforced on my deployment). To
directly interface with the database (this shouldn't ever really be necessary),
I have a deployment of Adminer behind my firewall that I can use as a GUI for
the PostgreSQL database when I'm connected to the same network as the server.
Deployment
Create a .env file with the following keys.
SERVER_NAME=http://jjanzen.ca # URL of the website
PORT=8080 # port the website is published on
POSGRES_PASSWORD= # password for the database
POSTGRES_VOLUME=/db_volume # location of the db files on the host machine
ADMINER_PORT=10000 # port to access db frontend
TIMEZONE=America/Winnipeg # set to the desired timezone for dates
ADMIN_PASS= # password for /admin.php
SECURE_COOKIES=true # set to false if not using https
Launch the website with docker compose up --build.