Infrastructure Changelog
2026-03-27
The NestJS backend that hosts dev.drospect.ai uses Prisma for database migrations. We found that
drospect’s migration history was manually changed by:
- first deleting a migration (which had already been committed and applied on dev) and then
- adding a new migration which did what the deleted one had already done (when it was applied on dev), thus blocking us from applying new migrations.
Relevant information:
- The
20250611152359_add_scopito_inspectionmigration was added via 4ed0fea and (presumably) applied on dev, but then deleted via 8fc6cf0 - 8fc6cf0 added
20250611152359_add_scopito_inspectionwhich broke migrations on dev
This issue was addressed by manually applying:
docker exec -it <contianer-id> shnpx prisma migrate resolve --applied 20250611152359_add_scopito_inspectionnpx prisma migrate deployUFW was configured to allow the drospect backend to send requests to our self-hosted NodeODM server:
ufw allow from 172.18.0.0/16 to any port 4000 proto tcpbecause the backend makes direct HTTP request using the NODEODM_API_URL environment variable which
apparently was configured to point to the server directly using the server’s IP address. A better
fix would be to manage NodeODM via CapRover to have it running on the same Docker network as the
backend. (This will be put on hold for now since we’re considering to move to GCP altogether.)
2026-03-23
We received a report from Hetzner that our database instance wasn’t behind a firewall. This meant that the PostgreSQL port was exposed and could be accessed from anywhere. This changelog entry outlines the changes we made to address this issue. See DROS-38 for more information.
Created back-ups for pg_hba.conf and postgresql.conf.
sudo cp /etc/postgresql/16/main/pg_hba.conf /etc/postgresql/16/main/pg_hba.conf.baksudo cp /etc/postgresql/16/main/postgresql.conf /etc/postgresql/16/main/postgresql.conf.bakUpdated pg_hba.conf to allow access from:
172.18.0.0/16, which is the Docker network subnet (i.e., thedocker_gwbridgesubnet), and- our office IP addresses.
# TYPE DATABASE USER ADDRESS METHODlocal all postgres peerlocal all all peerhost all all 127.0.0.1/32 scram-sha-256host all all ::1/128 scram-sha-256host drospect-dev postgres 172.18.0.0/16 md5host drospect-dev postgres <office-ip>/32 md5Reloaded the database config via:
sudo -u postgres psql -c "select pg_reload_conf();"Updated the database connection string in CapRover from:
postgresql://postgres:<password>@157.180.55.60/drospect-devto:
postgresql://postgres:<password>@172.18.0.1/drospect-devConfigured ufw to allow connections on port 22, 80, and 443. Connections on port 5432 (the port the
database instance listens on) are allowed only for 172.18.0.0/16 and our office IPs.
sudo ufw allow 22/tcpsudo ufw allow 80/tcpsudo ufw allow 443/tcpsudo ufw allow from 172.18.0.0/16 to any port 5432 proto tcpsudo ufw allow from <office-ip> to any port 5432 proto tcpsudo ufw enableIn the future we should consider to
- have the PostgreSQL instance running inside a Docker container like the rest of the services are, and
- remove the office IP addresses and use SSH tunneling instead (we’re putting this on hold for now since team members don’t use SSH tunneling for DB access in their workflows).