← Projects
Betolla CosmeticsHow I run it
Betolla Cosmetics is a cosmetics store with admin, staff and delivery dashboards. This page covers what runs where, how updates ship, and how the data is backed up.
Every detail on this page was checked against the live server on 14 Oct 2026.
The setup
- One VPS running Ubuntu 26.04 hosts the whole store.
- Cloudflare sits in front and handles TLS for visitors.
- Nginx compresses responses and splits traffic between two Next.js processes. If one process crashes, Nginx keeps sending visitors to the other while it restarts.
- Next.js serves the store and the admin, staff and delivery dashboards. It runs as two PM2 processes inside a systemd service, so it restarts on a crash and starts again when the server boots.
- Redis holds a shared cache, so both processes serve the same data.
- PostgreSQL 18 sits behind PgBouncer, which pools database connections. Both listen on the server itself only, never on the public internet.
- The firewall only allows SSH and web traffic, and fail2ban blocks repeated failed SSH logins.
How updates are deployed
Every deploy follows the same checklist:
- Back up first. A fresh copy of the database and the uploaded images is taken before anything changes.
- Package the code. The package deliberately leaves out the server's secrets and customers' uploaded images, so a deploy can never overwrite them.
- Install, migrate, build, restart. Exact dependency versions are installed, database migrations are applied with
prisma migrate deploy, the app is built, and the service restarts. - Verify. The service must be running, the number of users, orders and products must match what it was before, and the main pages (home, products, register, login and the health check) must load.
Database changes are kept additive (new tables, nullable columns, indexes), so accounts, passwords and orders are never touched by a schema change. Rolling back means restoring the previous code package and, if needed, the database copy taken in step 1.
How backups work
- Every night a scheduled job dumps the database and archives all uploaded images.
- Each database dump is read back right after it's written. If it can't be read, the job stops with an error.
- Daily copies are kept for 30 days, and the first copy of each month is kept for a year.
- On top of the nightly copy, a backup is taken right before every deploy.