This repository contains setup instructions for configuring the BUILDMODE Server, including database, services and NGINX with HTTPS support.
- Think of better system to track user interest
- Maybe a graph
- Track recency for decay and frequency for interest signals
- Track in vector space for topic clusters
- Create nudges system
sudo apt update
sudo apt full-upgradesudo apt install -y postgresql
sudo apt install -y postgresql-17-pgvector-
Log into Postgres:
sudo -u postgres psql
-
Set a password:
ALTER USER postgres WITH PASSWORD '<YOUR_NEW_PASSWORD>';
CREATE DATABASE mia2;
\c mia2
CREATE EXTENSION vector;
\q-
Open DB:
psql -U <DB_USER> -d <DB_NAME>
-
Drop a table:
DROP TABLE <table_name>;
-
Drop the database:
sudo -u postgres dropdb <DB_NAME>
-
Completely remove PostgreSQL:
sudo apt remove --purge -y postgresql* sudo apt autoremove --purge -y
CREATE INDEX tags_vector_idx ON data
USING ivfflat (tags_vector vector_cosine_ops)
WITH (lists = 50);
CREATE INDEX swatch_vector_idx ON data
USING ivfflat (swatch_vector vector_l2_ops)
WITH (lists = 50);-
Tuning
lists:- Small datasets (≤10K rows): 10–50
- Medium datasets (10K–100K rows): 50–100
Update planner statistics:
ANALYZE data;sudo nano /etc/systemd/system/forgor-api.servicesudo systemctl daemon-reexec && sudo systemctl daemon-reload
sudo systemctl enable forgor-api.service
sudo systemctl start forgor-api.service
sudo systemctl restart forgor-api.service
sudo journalctl -u forgor-api.service -fsudo systemctl status forgor-api
journalctl -u forgor-api.service -fThe digest system sends weekly/monthly digests to users.
sudo nano /etc/systemd/system/forgor-digest.service
```bash
```bash
sudo nano /etc/systemd/system/forgor-digest.timer
```bash
### 5. NGINX + HTTPS
#### Setup Domain
* Point your **domain A record** to the VPS IP.
* Wait \~15 minutes for DNS propagation.
#### Configure NGINX
```bash
sudo nano /etc/nginx/sites-available/<name>- Use the template in
nginx.config.
sudo ln -s /etc/nginx/sites-available/<name> /etc/nginx/sites-enabled/
sudo nginx -t # Validate config
sudo systemctl start nginx
sudo systemctl status nginx
sudo systemctl reload nginxsudo certbot --nginx -d <domain>.xyz -d www.<domain>.xyzVerify auto-renewal:
sudo certbot renew --dry-run-
Check version:
psql --version
-
Status:
sudo systemctl status postgresql
-
Start & enable:
sudo systemctl start postgresql sudo systemctl enable postgresql -
Show Postgres logs (last 50 lines, live):
journalctl -u postgresql.service -n 50 -f
-
Connect to DB:
psql -U <DB_USER> -d <DB_NAME>
-
List databases:
\l
-
List tables:
\dt
-
Inspect schema of a table:
\d <table_name>
-
Run quick query:
SELECT * FROM <table_name> LIMIT 10;
-
Check status:
sudo systemctl status forgor-api
-
Show logs (last 100 lines, live):
journalctl -u forgor-api.service -f
-
Restart service:
sudo systemctl daemon-reexec && sudo systemctl daemon-reload sudo systemctl restart forgor-api.service
-
Status:
sudo systemctl status nginx
-
Reload config:
sudo nginx -t && sudo systemctl reload nginx -
Logs:
sudo tail -f /var/log/nginx/access.log sudo tail -f /var/log/nginx/error.log