Installation
Bayanat can be deployed natively on a Linux system or using Docker.
WARNING
Although this guide follows best security practices, you still need to secure the server itself (firewall, VPN, HTTPS, etc.).
Manual Installation
The following steps are for Ubuntu. They should work on other Linux distributions with equivalent packages.
TIP
You can install Bayanat by following these steps exactly without changes. Adjust only if you have specific requirements (e.g., PostgreSQL on another host).
Install System Packages
Ubuntu 22.04:
sudo apt install -y python3-dev libpq-dev redis-server postgresql postgresql-contrib postgis libgdal-dev uwsgiUbuntu 24.04:
sudo apt install -y python3-dev libpq-dev redis-server postgresql postgresql-contrib postgis libgdal-dev uwsgiOptionally install Tesseract OCR:
sudo apt install -y tesseract-ocrInstall language packages as needed (e.g., tesseract-ocr-eng). See Tesseract installation docs.
Install the latest NGINX.
Create System User
sudo adduser --disabled-password bayanatSetup Database
sudo -u postgres createuser bayanat
sudo -u postgres createdb -O bayanat bayanat
sudo -u postgres psql -d bayanat -c "CREATE EXTENSION IF NOT EXISTS postgis;"
sudo -u postgres psql -d bayanat -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"Install Bayanat
sudo mkdir /bayanat && sudo chown bayanat:bayanat /bayanat
sudo -u bayanat -i
cd /bayanat
git clone https://github.com/sjacorg/bayanat .Install uv if not already available.
uv syncFor voice transcription (Whisper) and OCR (Tesseract):
uv sync --extra aiConfigure
Generate the .env file interactively:
bash gen-env.shSee Configuration for manual setup.
Create Admin User
uv run flask installTest
uv run flask runAccess at http://127.0.0.1:5000. The setup wizard will guide further configuration.
WARNING
flask run is development mode only. Continue with the steps below for production.
Exit the bayanat user (Ctrl-D or exit) to continue with a privileged user.
Run as a Service
Create /etc/systemd/system/bayanat.service:
[Unit]
Description=Bayanat uWSGI Service
After=network.target postgresql.service redis-server.service
[Service]
User=bayanat
Group=bayanat
WorkingDirectory=/bayanat
ExecStart=/bayanat/.venv/bin/uwsgi --ini uwsgi.ini
Restart=always
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable --now bayanatNGINX Configuration
Create /etc/nginx/conf.d/bayanat.conf:
server {
listen 80;
server_name example.com;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Replace example.com with your domain. Use Certbot for HTTPS.
sudo systemctl restart nginxRunning Celery
Create /etc/systemd/system/bayanat-celery.service:
[Unit]
Description=Bayanat Celery Service
After=network.target redis-server.service
[Service]
User=bayanat
Group=bayanat
WorkingDirectory=/bayanat
ExecStart=/bayanat/.venv/bin/celery -A enferno.tasks worker -B --loglevel=info
Restart=always
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now bayanat-celeryDocker
Beta
Docker deployment is still in beta. For production, native deployment is recommended.
After configuring and generating a .env file:
docker-compose up -dInstall the admin user:
docker-compose exec bayanat uv run flask install