sapristi / fleebmarket

Source repository for https://fleebmarket.mmill.eu/
https://fleebmarket.mmill.eu/
GNU Affero General Public License v3.0
3 stars 0 forks source link
mechanical-keyboard

Fleebmarket

Fleebmarket is a frontend to the /r/mechmarket subreddit (seconds hand mechanical keyboards marketplace). You can reach the website at "https://fleebmarket.mmill.eu"

This repo holds the full source code of the website.

Tech stack

Local setup

  1. Copy .env.skeleton to .env, then fill the values (you can ignore settings for blue/green deployment)
  2. Start a postgres and meilisearch instance as docker containers by running scripts/deploy_swarm.sh.
  3. Setup the backend

Prod setup

Fleebmarket is currently deployed on a bare-metal server, this sections describe the current setup.

It shouldn't be too difficult to adapt, or even dockerize everything, but some settings are hard-coded.

Files

Systemd services

Services are run as systemd user services. Services files are present in the services/systemd directory, which is symlinked on the server to ~/.config/systemd/user. Services can then be managed with systemd --user commands:

The alerting system works by parsing journald logs.

Nginx

Nginx is the only service running as root. You can find configuration files in services/nginx.

Monitoring

Monitorix is used to monitor the server, as well as fleebmarket usage. Some settings can be found in services/monitorix.

Additionally, a Huey job parses journald logs, and send alerts to the configured discord channel when it finds messages with level ERROR or higher (cysystemd is used to give the right level to python log messages).

Create account provider apps

and set related field in .env file. This is usefull if you want to develop features related to those kind of accounts; otherwise you can log in the django admin panel at localhost:8000/admin, and then go back to the website.