Files
quality_recticel/py_app/manage_production.sh
Quality System Admin d264bcdca9 feat: Major system improvements and production deployment
 New Features:
- Added view_orders route with proper table display
- Implemented CSV upload with preview workflow and date parsing
- Added production WSGI server configuration with Gunicorn
- Created comprehensive production management scripts

🔧 Bug Fixes:
- Fixed upload_data route column mapping for actual CSV structure
- Resolved print module database queries and template rendering
- Fixed view orders navigation routing (was pointing to JSON API)
- Corrected barcode display width constraints in print module
- Added proper date format parsing for MySQL compatibility

🎨 UI/UX Improvements:
- Updated view_orders template with theme-compliant styling
- Hidden barcode text in print module preview for cleaner display
- Enhanced CSV upload with two-step preview-then-save workflow
- Improved error handling and debugging throughout upload process

🚀 Production Infrastructure:
- Added Gunicorn WSGI server with proper configuration
- Created systemd service for production deployment
- Implemented production management scripts (start/stop/status)
- Added comprehensive logging setup
- Updated requirements.txt with production dependencies

📊 Database & Data:
- Enhanced order_for_labels table compatibility
- Fixed column mappings for real CSV data structure
- Added proper date parsing and validation
- Improved error handling with detailed debugging

🔧 Technical Debt:
- Reorganized database setup documentation
- Added proper error handling throughout upload workflow
- Enhanced debugging capabilities for troubleshooting
- Improved code organization and documentation
2025-10-11 23:31:32 +03:00

114 lines
3.3 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Production Management Script for Trasabilitate Application
# Usage: ./manage_production.sh {start|stop|restart|status|logs|install-service}
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_success() {
echo -e "${GREEN}$1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}$1${NC}"
}
print_info() {
echo -e "${BLUE} $1${NC}"
}
usage() {
echo "Usage: $0 {start|stop|restart|status|logs|install-service|help}"
echo ""
echo "Commands:"
echo " start Start the production server"
echo " stop Stop the production server"
echo " restart Restart the production server"
echo " status Show server status"
echo " logs Show recent logs"
echo " install-service Install systemd service"
echo " help Show this help message"
echo ""
}
case "$1" in
start)
./start_production.sh
;;
stop)
./stop_production.sh
;;
restart)
echo -e "${BLUE}🔄 Restarting Trasabilitate Application${NC}"
echo "=============================================="
./stop_production.sh
sleep 2
./start_production.sh
;;
status)
./status_production.sh
;;
logs)
echo -e "${BLUE}📋 Recent Error Logs${NC}"
echo "=============================================="
if [[ -f "/srv/quality_recticel/logs/error.log" ]]; then
tail -20 /srv/quality_recticel/logs/error.log
else
print_error "Error log file not found"
fi
echo ""
echo -e "${BLUE}📋 Recent Access Logs${NC}"
echo "=============================================="
if [[ -f "/srv/quality_recticel/logs/access.log" ]]; then
tail -10 /srv/quality_recticel/logs/access.log
else
print_error "Access log file not found"
fi
;;
install-service)
echo -e "${BLUE}📦 Installing Systemd Service${NC}"
echo "=============================================="
if [[ ! -f "trasabilitate.service" ]]; then
print_error "Service file not found"
exit 1
fi
print_info "Installing service file..."
sudo cp trasabilitate.service /etc/systemd/system/
print_info "Reloading systemd daemon..."
sudo systemctl daemon-reload
print_info "Enabling service..."
sudo systemctl enable trasabilitate.service
print_success "Service installed successfully!"
echo ""
echo "Systemd commands:"
echo " sudo systemctl start trasabilitate # Start service"
echo " sudo systemctl stop trasabilitate # Stop service"
echo " sudo systemctl restart trasabilitate # Restart service"
echo " sudo systemctl status trasabilitate # Check status"
echo " sudo systemctl enable trasabilitate # Enable auto-start"
echo " sudo systemctl disable trasabilitate # Disable auto-start"
;;
help|--help|-h)
usage
;;
*)
print_error "Invalid command: $1"
echo ""
usage
exit 1
;;
esac