This guide explains how to run the Remote Elevator Control System using Docker.
Start all services:
docker-compose up -dAccess the application:
- Frontend (Web App): http://localhost:8080
- Backend API: http://localhost:3000
- Database: localhost:5432
Default credentials:
- Admin email:
admin@remotecon.local - Admin password:
admin123
The Docker Compose setup includes:
-
PostgreSQL Database (port 5432)
- Persistent data storage
- Automatic health checks
-
Backend API (port 3000)
- NestJS application
- Automatic database migrations
- Auto-seeding on first run
-
Frontend Web App (port 8080)
- Angular/Ionic app served by Nginx
- Production-optimized build
Edit docker-compose.yml to change:
Database:
POSTGRES_USER: remotecon
POSTGRES_PASSWORD: remotecon_password_change_this # ⚠️ CHANGE THIS
POSTGRES_DB: remoteconBackend:
JWT_ACCESS_SECRET: your-secret-key # ⚠️ CHANGE THIS
JWT_REFRESH_SECRET: your-refresh-secret # ⚠️ CHANGE THIS
CORS_ORIGIN: http://localhost,http://localhost:8080The ESP32 firmware is not containerized. Configure it to connect to your Docker backend:
Edit esp32/src/config.h:
#define SERVER_URL "http://YOUR_HOST_IP:3000/api"
#define DEVICE_KEY "test-device-key-12345"Note: Use your host machine's IP address (not localhost) so the ESP32 can reach the Docker container.
Start services:
docker-compose up -dView logs:
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f postgresStop services:
docker-compose stopStop and remove containers:
docker-compose downStop and remove containers + volumes (
docker-compose down -vRebuild after code changes:
docker-compose up -d --buildAccess backend shell:
docker exec -it remotecon-backend shAccess database:
docker exec -it remotecon-db psql -U remotecon -d remoteconRun migrations manually:
docker exec remotecon-backend npx prisma migrate deploySeed database:
docker exec remotecon-backend npx prisma db seedReset database (
docker-compose down -v
docker-compose up -dBefore deploying to production:
- Change
POSTGRES_PASSWORDin docker-compose.yml - Change
JWT_ACCESS_SECRETandJWT_REFRESH_SECRET - Update
CORS_ORIGINto your production domain - Use environment file instead of hardcoded secrets
- Enable HTTPS (use reverse proxy like Traefik or Nginx)
- Set resource limits for containers
- Configure backup strategy for database volume
- Update ESP32
SERVER_URLto production domain
Create .env file in root directory:
POSTGRES_PASSWORD=secure_password_here
JWT_ACCESS_SECRET=your_access_secret
JWT_REFRESH_SECRET=your_refresh_secret
CORS_ORIGIN=https://yourdomain.comUpdate docker-compose.yml to use env file:
services:
backend:
env_file:
- .envAdd nginx reverse proxy service to docker-compose.yml:
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx-proxy.conf:/etc/nginx/nginx.conf
- ./ssl:/etc/nginx/ssl
depends_on:
- backend
- frontendAdd resource limits to services:
services:
backend:
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M# Check logs
docker-compose logs backend
# Common issues:
# 1. Database not ready - wait for health check
# 2. Migration failed - check DATABASE_URL
# 3. Port conflict - change port in docker-compose.yml# Check backend is running
docker-compose ps
# Verify API URL in frontend build
# Check CORS settings in backend# Check postgres is running
docker-compose ps postgres
# Check health status
docker inspect remotecon-db | grep Health# Get host machine IP
# Windows: ipconfig
# Linux/Mac: ifconfig or ip addr
# Update ESP32 config.h with host IP:
# #define SERVER_URL "http://192.168.1.100:3000/api"docker-compose up -d --build backendView resource usage:
docker statsCheck service health:
docker-compose psDatabase size:
docker exec remotecon-db psql -U remotecon -d remotecon -c "SELECT pg_size_pretty(pg_database_size('remotecon'));"Backup database:
docker exec remotecon-db pg_dump -U remotecon remotecon > backup.sqlRestore database:
docker exec -i remotecon-db psql -U remotecon remotecon < backup.sqlBackup volume:
docker run --rm -v remotecon_postgres_data:/data -v $(pwd):/backup alpine tar czf /backup/postgres_backup.tar.gz /dataThe mobile apps (Android/iOS) are not containerized. They need to be built locally:
cd app
npm install
ionic build --prod
# Android
npx cap sync android
npx cap open android
# iOS
npx cap sync ios
npx cap open iosUpdate environment.prod.ts with your production backend URL before building.
- Start with Docker:
docker-compose up -d - Access web app: http://localhost:8080
- Login as admin:
admin@remotecon.local/admin123 - Configure ESP32 with your host IP
- Flash ESP32 firmware
- Test complete system
MIT