~dusnm/dusanmitrovic.xyz

Source files for my personal website.
replace btc wallet address
Add avatar to home page
Add reading estimates to posts

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~dusnm/dusanmitrovic.xyz
read/write
git@git.sr.ht:~dusnm/dusanmitrovic.xyz

You can also use your local clone with git send-email.

#dusanmitrovic.xyz

Source code for my website.

#Table of contents

#Configure hosts

Add these lines to the end of your /etc/hosts file.

127.0.0.1 website.test
127.0.0.1 website-smtp.test
127.0.0.1 website-db.test

These will be used to access the website and its services in development.

#Run docker development environment

This will bootstrap the development environment and all its dependencies.

docker compose -f ./docker/docker-compose-dev.yml up -d

#Run migrations

This is necessary to update the database schema.

docker exec website-node knex migrate:latest

#Run seeds

If you want to seed the databse with some fake data run this command.

docker exec website-node knex seed:run

#Services

The docker environment will start the following services.

#Production setup

Two methods are supported:

#Manual

Requirements:

  • nginx
  • redis
  • mariadb >= 10.7
  • node >= 16
  • npm (or any other node package manager of your choice)
  • pm2 (optional)

To minify CSS for production (required) run:

npm run minify-css

If you're using PM2 as your node service manager an example confifguration is provided. Edit it to suit your needs.

It also lists all the environment variables that need to be configured.

#Docker

A docker compose file is included in ./docker/docker-compose.yml

To use it, you must set some environment variables on your system. The easiest way is to populate your /etc/environment file with the following:

WEBSITE_HOST="https://example.org"
WEBSITE_STATIC_DIR="assets"
WEBSITE_SESSION_SECRET="REDACTED"
WEBSITE_DB_USERNAME="website"
WEBSITE_DB_PASSWORD="REDACTED"
WEBSITE_DB_NAME="website"
WEBSITE_MAILER_HOST="smtp.example.org"
WEBSITE_MAILER_PORT=587
WEBSITE_MAILER_SECURE=0
WEBSITE_MAILER_USERNAME="user@example.org"
WEBSITE_MAILER_PASSWORD="REDACTED"
WEBSITE_ANTISPAM_TTL=1200
WEBSITE_MASTODON_HOST="https://fosstodon.org"
WEBSITE_MASTODON_CLIENT_ID="REDACTED"
WEBSITE_MASTODON_CLIENT_SECRET="REDACTED"

After saving the file, reboot to make the system load the environment variables on startup.

Copy the included docker-compose.yml to your working directory and run:

docker compose up -d

Remember to initialize the database:

docker exec -it website knex migrate:latest

#Licensing

All source code written for this website is licensed under the terms of GNU AGPLv3.

All content on this website is licensed under the terms of CC-BY-SA.