- Implemented Python scraper using BeautifulSoup and pandas to automatically collect travel rates from official NJC website - Added currency extraction from table titles (supports EUR, USD, AUD, CAD, ARS, etc.) - Added country extraction from table titles for international rates - Flatten pandas MultiIndex columns for cleaner data structure - Default to CAD for domestic Canadian sources (accommodations and domestic tables) - Created SQLite database schema (raw_tables, rate_entries, exchange_rates, accommodations) - Successfully scraped 92 tables with 17,205 rate entries covering 25 international cities - Added migration script to convert scraped data to Node.js database format - Updated .gitignore for Python files (.venv/, __pycache__, *.pyc, *.sqlite3) - Fixed city validation and currency conversion in main app - Added comprehensive debug and verification scripts This replaces manual JSON maintenance with automated data collection from official government source.
5.3 KiB
Deployment Guide
🚀 Quick Start (Node.js)
Prerequisites
- Node.js 14+ installed
- npm installed
Installation & Run
# Install dependencies
npm install
# Start the server
npm start
The application will be available at: http://localhost:5001
🐳 Docker Deployment
Prerequisites
- Docker installed
- Docker Compose installed (optional)
Option 1: Docker Build & Run
# Build the Docker image
docker build -t govt-travel-estimator .
# Run the container
docker run -d --env-file .env -p 5001:5001 --name govt-travel-app govt-travel-estimator
Option 2: Docker Compose (Recommended)
# Start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose down
Verify Deployment
# Check container status
docker ps
# View logs
docker logs govt-travel-estimator
# Test the application
curl http://localhost:5001
Note: Docker builds can run without Amadeus credentials. When the API keys are missing, flight search falls back to curated sample flights (see
data/sampleFlights.json) so you can still exercise the UI. AddAMADEUS_API_KEYandAMADEUS_API_SECRETlater to unlock live pricing. Make sure you create a.envfile based on.env.exampleand the Compose service loads it viaenv_file, or pass it via--env-filewhen usingdocker run.
🌐 Access Points
Once deployed, access the application:
- Main Application: http://localhost:5001
- Validation Dashboard: http://localhost:5001/validation.html
🔧 Configuration
Change Port
In server.js:
const PORT = 5001; // Change this value
In docker-compose.yml:
ports:
- "5001:5001" # Change first value (host port)
📁 File Structure
Govt Travel App/
├── server.js # Express server
├── package.json # Dependencies
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose config
├── index.html # Main app
├── validation.html # Validation dashboard
├── styles.css # Styling
├── script.js # Application logic
└── data/ # Rate databases
├── perDiemRates.json
├── accommodationRates.json
└── transportationRates.json
🔄 Updating Rate Databases
Without Stopping Server
If using Docker with volume mount:
# Edit the JSON files in ./data/
# Changes are reflected immediately (read-only mount)
With Server Restart
# Stop the server
npm stop # or docker-compose down
# Update JSON files in ./data/
# Restart the server
npm start # or docker-compose up -d
🛠️ Troubleshooting
Port Already in Use
# Windows
netstat -ano | findstr :5001
taskkill /PID <PID> /F
# Linux/Mac
lsof -ti:5001 | xargs kill -9
Cannot Find Module 'express'
npm install
Docker Container Won't Start
# Check logs
docker logs govt-travel-estimator
# Remove and rebuild
docker-compose down
docker-compose up --build
🔒 Production Considerations
Security
- Add HTTPS/SSL certificate
- Enable CORS policies
- Add rate limiting
- Implement authentication (if needed)
Performance
- Enable gzip compression
- Add caching headers
- Use CDN for static assets
- Implement load balancing
Monitoring
- Add logging system
- Implement health checks
- Set up uptime monitoring
- Configure alerts
📊 Server Commands
Development
npm start # Start server
npm run dev # Start in dev mode (same as start)
Docker
docker-compose up # Start with logs
docker-compose up -d # Start in background
docker-compose down # Stop and remove
docker-compose restart # Restart services
docker-compose logs -f # Follow logs
🌍 Deployment Options
Local Network Access
To access from other devices on your network:
-
Find your IP address:
# Windows ipconfig # Linux/Mac ifconfig -
Update server.js:
app.listen(PORT, '0.0.0.0', () => { // Server accessible on network }); -
Access from other devices:
http://<your-ip>:5001
Cloud Deployment
Heroku:
heroku create govt-travel-estimator
git push heroku main
AWS/Azure/GCP:
- Use container services (ECS, App Service, Cloud Run)
- Deploy Docker image
- Configure port 5001
✅ Health Check
Verify the server is running:
# Command line
curl http://localhost:5001
# Browser
Open: http://localhost:5001
Expected: Application loads successfully
📝 Environment Variables
Create .env file for configuration:
PORT=5001
NODE_ENV=production
LOG_LEVEL=info
Update server.js to use:
const PORT = process.env.PORT || 5001;
🔄 Auto-Restart on Changes
Using nodemon for development:
# Install nodemon
npm install --save-dev nodemon
# Update package.json
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js"
}
# Run with auto-restart
npm run dev
Deployment Guide Version: 1.0
Last Updated: October 30, 2025
Port: 5001
Protocol: HTTP