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.
- Python/Django for the backend (+ uwsgi/nginx for lower level request handling)
- uwsgi is also used for the handling of periodic tasks and task queue
- Postgresql for the django database
- Meilisearch for the search database
- JavaScript/React/Bulma for the frontend
- Copy
.env.skeleton
to.env
, then fill the values (you can ignore settings for blue/green deployment) - Start a postgres and meilisearch instance as docker containers by running
scripts/deploy_swarm.sh
. - Setup the backend
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.
- This repository is cloned in two folders,
/fleebmarket_blue
and/fleebmarket_green
. .env
files, with values for blue/green deployment set-up accordingly.- A python virtualenv is set in
backend/.venv
for each of these folders. - A
/data
folder contains data for the various services. It contains the following folders (some have to be manually created):alerts
: alerts configurationbackend_blue
,backend_green
: django static files for each of the backendsmeilisearch
: meilisearch databasepostgres
: postgres database
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:
meilisearch.service
andpostgresql.service
can be enabled and started right away- The services for the backend has to be declined for Blue and Green instances:
backend@blue.service
andbackend@green.service
The alerting system works by parsing journald logs.
Nginx is the only service running as root. You can find configuration files in services/nginx
.
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).
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.