ΰ¦ΰ¦ guide ΰ¦ΰ¦Ώ ΰ¦ΰ¦ͺনাΰ¦ΰ§ Digital Ocean droplet ΰ¦ OMR Scraper deploy ΰ¦ΰ¦°ΰ¦€ΰ§ ΰ¦Έΰ¦Ύΰ¦Ήΰ¦Ύΰ¦―ΰ§ΰ¦― ΰ¦ΰ¦°ΰ¦¬ΰ§ΰ₯€
- Digital Ocean droplet (Ubuntu 20.04+ recommended)
- Root access বা sudo privileges
- Domain name configured (optional but recommended)
- Basic knowledge of Linux commands
# Connect to your Digital Ocean droplet
ssh root@your-droplet-ip
# Update system
apt update && apt upgrade -y
# Install essential packages
apt install -y python3 python3-pip python3-venv nginx ufw fail2ban git# From your local machine, upload the project
scp -r /home/devzkhalil/Downloads/python-omr-scraper-main root@your-droplet-ip:/var/www/# On the server
cd /var/www/
git clone your-repository-url omr-scraper# Make script executable and run
cd /var/www/omr-scraper
chmod +x deploy.sh
sudo ./deploy.sh# Edit nginx configuration
nano /etc/nginx/sites-available/omr-scraper
# Replace 'omr.yourdomain.com' with your actual domain
# Save and exit# Edit service file
nano /etc/systemd/system/omr-scraper.service
# Update the domain and secret key
# Save and exit# Reload systemd and start services
systemctl daemon-reload
systemctl enable omr-scraper
systemctl start omr-scraper
systemctl restart nginx
# Check status
systemctl status omr-scraper- Go to your domain registrar
- Add an A record:
- Name:
omr(or your preferred subdomain) - Type: A
- Value: Your Digital Ocean droplet IP
- TTL: 300 (5 minutes)
- Name:
# Install Certbot
apt install -y certbot python3-certbot-nginx
# Get SSL certificate
certbot --nginx -d omr.yourdomain.com
# Auto-renewal (already configured by certbot)# Check if service is running
systemctl status omr-scraper
# Check logs
journalctl -u omr-scraper -f
# Check nginx status
systemctl status nginx# Test home endpoint
curl http://your-domain.com/
# Test health endpoint
curl http://your-domain.com/health# Application logs
journalctl -u omr-scraper -f
# Nginx logs
tail -f /var/log/nginx/omr-scraper.access.log
tail -f /var/log/nginx/omr-scraper.error.log
# Application logs
tail -f /var/log/omr_scraper.log# Restart OMR scraper
systemctl restart omr-scraper
# Restart nginx
systemctl restart nginx
# Restart both
systemctl restart omr-scraper nginx# Stop service
systemctl stop omr-scraper
# Update code (if using git)
cd /var/www/omr-scraper
git pull origin main
# Update dependencies
source venv/bin/activate
pip install -r requirements.txt
# Start service
systemctl start omr-scraper# Check firewall status
ufw status
# Allow only necessary ports
ufw allow ssh
ufw allow 'Nginx Full'
ufw enable# Check fail2ban status
systemctl status fail2ban
# View banned IPs
fail2ban-client status nginx-http-auth# Check service logs
journalctl -u omr-scraper -n 50
# Check if port is in use
netstat -tlnp | grep 8001# Test nginx configuration
nginx -t
# Check nginx logs
tail -f /var/log/nginx/error.log# Fix permissions
chown -R www-data:www-data /var/www/omr-scraper
chmod -R 755 /var/www/omr-scraper# Find process using port 8001
lsof -i :8001
# Kill process if needed
kill -9 <PID># Edit nginx configuration
nano /etc/nginx/nginx.conf
# Add these settings in http block:
# worker_processes auto;
# worker_connections 1024;
# keepalive_timeout 65;# Increase file limits
echo "* soft nofile 65536" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.confcurl -X POST http://your-domain.com/analyze-omr \
-F "image=@/path/to/omr-sheet.png" \
-F "correct_answers={\"1\":\"3\",\"2\":\"1\",\"3\":\"4\"}"curl http://your-domain.com/cleanup/statusIf you encounter any issues:
- Check the logs first
- Verify all services are running
- Check firewall and DNS settings
- Ensure all dependencies are installed
Once deployed, your OMR Scraper will be available at:
- URL:
http://your-domain.com - API:
http://your-domain.com/analyze-omr - Health Check:
http://your-domain.com/health
Your OMR scraper is now ready to process OMR sheets with Bengali support! π