TradeEntry VPS Recovery Guide (After VPS Reboot)
Version: 1.0 | Server: Ubuntu 22.04 VPS | Application: TradeEntry | Date: June 2026
Objective
This document records the complete troubleshooting process after a VPS reboot when:
- Website (www.tradeentry.in) was inaccessible
- PostgreSQL could not be reached
- TradeEntry service failed
- Docker PostgreSQL was not reachable
This can be used as a standard operating procedure (SOP).
Architecture
Internet
│
▼
Nginx (80/443)
│
▼
TradeEntry Service
│
├── Backend (FastAPI) → Port 8000
├── Frontend (Vite) → Port 5173
└── Docs (Docusaurus) → Port 3000
Backend
│
▼
Docker PostgreSQL
Port 5432
Volume: tradeentry_pgdata
Step 1 — Check Server Health
uptime
free -h
df -h
Verify:
- Memory
- Disk
- CPU load
Step 2 — Check Docker
docker ps
Expected running container: postgres-db
If empty:
docker ps -a
Step 3 — Check Docker Logs
docker logs postgres-db
Typical recovery messages after reboot:
database system was not properly shut down
automatic recovery in progress
database system is ready to accept connections
Step 4 — Verify Database
docker exec -it postgres-db psql -U postgres -l
Expected databases:
tedb
postgres
template0
template1
Step 5 — Check TradeEntry Service
sudo systemctl status tradeentry.service
If the exit code shows 203/EXEC, possible causes:
start.shnot executable- Wrong shebang
- Wrong
ExecStartpath
Step 6 — Verify start.sh
ls -l start.sh
Correct permissions:
-rwxr-xr-x
If not executable:
chmod +x start.sh
Step 7 — Verify Service File
sudo systemctl cat tradeentry.service
Correct entries:
WorkingDirectory=/home/kss/tradeentry
ExecStart=/home/kss/tradeentry/start.sh
Step 8 — Restart Service
sudo systemctl daemon-reload
sudo systemctl restart tradeentry.service
Verify:
sudo systemctl status tradeentry.service
Step 9 — Verify Backend
curl http://127.0.0.1:8000/docs
Expected: Swagger HTML page
Step 10 — Verify Listening Ports
ss -tulpn | grep -E '80|443|8000|5173|3000|5432'
All six ports should appear: 80, 443, 8000, 5173, 3000, 5432
PostgreSQL Issue Found
Symptom
docker ps
Showed postgres-db running but the PORTS column was blank.
Also:
docker port postgres-db
returned nothing — port 5432 was not published.
Investigation
docker inspect postgres-db
Found:
HostConfig.PortBindings→5432/tcp(binding defined in config)NetworkSettings.Ports→{}(no actual binding active)
This meant:
- Container was running
- Database was healthy internally
- No network attachment
- No published ports
Verify Docker Network
docker network ls
docker network inspect tradeentry_default
Found Containers: {} — no containers were attached to the network.
Root Cause
The PostgreSQL container had entered an inconsistent networking state after reboot:
- Running ✓
- No published ports ✗
- Not attached to Docker network ✗
Safe Recovery
1. Verify volume is intact
docker volume ls
Confirm tradeentry_pgdata is listed. Database files are stored safely inside this external Docker volume.
2. Recreate ONLY the PostgreSQL container
docker-compose stop db
docker-compose rm -f db
docker-compose up -d db
This does not remove database files — the volume is preserved.
3. Verify port is now published
docker ps
Expected PORTS column:
0.0.0.0:5432->5432/tcp
docker port postgres-db
Expected:
5432/tcp -> 0.0.0.0:5432
4. Verify database connectivity
PGPASSWORD=tedb psql \
-h 127.0.0.1 \
-U postgres \
-d tedb
Should connect successfully.
5. Verify PostgreSQL readiness
docker exec postgres-db pg_isready
Expected: accepting connections
6. Verify website
| Component | Check |
|---|---|
| Backend | curl http://127.0.0.1:8000/docs |
| Frontend | http://127.0.0.1:5173 |
| Docs | http://127.0.0.1:3000 |
| Website | https://www.tradeentry.in |
Useful Commands Reference
TradeEntry Service
sudo systemctl status tradeentry.service
sudo systemctl restart tradeentry.service
journalctl -u tradeentry.service -f
Docker
docker ps
docker ps -a
docker logs postgres-db
docker restart postgres-db
docker exec postgres-db pg_isready
PostgreSQL
docker exec -it postgres-db psql -U postgres
docker exec -it postgres-db psql -U postgres -l
Nginx
sudo systemctl status nginx
sudo nginx -t
Ports
ss -tulpn
Volumes
docker volume ls
Lessons Learned
-
Never run
docker-compose down -vunless you intentionally want to delete database volumes. -
Always verify
docker volume lsbefore recreating containers. -
Docker containers can be recreated safely if data is stored in named volumes.
-
A running container does not guarantee networking is healthy.
-
Always verify
docker port postgres-db— thePORTScolumn indocker psshould never be empty for PostgreSQL. -
After every VPS reboot verify: Docker → PostgreSQL → TradeEntry Service → Nginx → Ports → Website.
Recommended Post-Reboot Health Check
Run this sequence after every reboot:
uptime
docker ps
docker exec postgres-db pg_isready
sudo systemctl status tradeentry.service
sudo systemctl status nginx
ss -tulpn | grep -E '80|443|5432|8000|5173|3000'
curl http://127.0.0.1:8000/docs
If all checks pass, the TradeEntry server is healthy.