Sign in to access MinerSheets revolutionary features
Try searching with different keywords
The backbone of operational excellence
Deploy MinerSheets to production with confidence and zero downtime
Create .env.production with production settings:
.env.production
# Django Settings DJANGO_ENV=production DEBUG=False SECRET_KEY=your-super-secret-key-min-50-chars-long-randomly-generated ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com # Database Configuration DB_NAME=minersheets_prod DB_USER=minersheets_user DB_PASSWORD=strong-database-password DB_HOST=db DB_PORT=5432 # Security Settings CSRF_TRUSTED_ORIGINS=https://yourdomain.com,https://www.yourdomain.com SECURE_SSL_REDIRECT=True SESSION_COOKIE_SECURE=True CSRF_COOKIE_SECURE=True # Email Configuration (for notifications) EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USE_TLS=True EMAIL_HOST_USER=your-email@gmail.com EMAIL_HOST_PASSWORD=your-app-password # Redis (for caching and sessions) REDIS_URL=redis://redis:6379/0 # Monitoring SENTRY_DSN=your-sentry-dsn-if-using
⚠️ Security Warning: Never commit .env.production to git. Add it to .gitignore and store secrets in a secure vault.
.gitignore
cd /opt sudo git clone https://github.com/yourusername/MinerSheets.git cd MinerSheets sudo chown -R $USER:$USER .
# Copy and edit production environment file cp .env.production.example .env.production nano .env.production # Edit with your settings # Generate Django secret key python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
# Build production images docker-compose -f config/docker-compose.production.yml build # Start all services docker-compose -f config/docker-compose.production.yml up -d # Check service status docker-compose -f config/docker-compose.production.yml ps
# Run migrations docker-compose -f config/docker-compose.production.yml exec web python manage.py migrate # Create superuser docker-compose -f config/docker-compose.production.yml exec web python manage.py createsuperuser # Collect static files docker-compose -f config/docker-compose.production.yml exec web python manage.py collectstatic --noinput
# /etc/nginx/sites-available/minersheets server { listen 80; server_name yourdomain.com www.yourdomain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name yourdomain.com www.yourdomain.com; ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; client_max_body_size 100M; location / { proxy_pass http://localhost:9320; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location /static/ { alias /opt/MinerSheets/staticfiles/; expires 30d; } location /media/ { alias /opt/MinerSheets/media/; expires 7d; } }
# Enable site sudo ln -s /etc/nginx/sites-available/minersheets /etc/nginx/sites-enabled/ # Test configuration sudo nginx -t # Reload Nginx sudo systemctl reload nginx
# Allow SSH, HTTP, HTTPS sudo ufw allow 22/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp # Enable firewall sudo ufw enable # Check status sudo ufw status
# View Django logs docker-compose logs -f web # View Nginx logs sudo tail -f /var/log/nginx/access.log sudo tail -f /var/log/nginx/error.log
# Check health endpoint curl https://yourdomain.com/health/ # Check container status docker ps # Check database docker exec -it db psql -U postgres
#!/bin/bash # backup-database.sh BACKUP_DIR="/opt/backups/minersheets" DATE=$(date +%Y%m%d_%H%M%S) BACKUP_FILE="$BACKUP_DIR/minersheets_$DATE.sql" # Create backup directory mkdir -p $BACKUP_DIR # Perform backup docker exec db pg_dump -U postgres minersheets_prod > $BACKUP_FILE # Compress backup gzip $BACKUP_FILE # Remove backups older than 30 days find $BACKUP_DIR -name "*.sql.gz" -mtime +30 -delete echo "Backup completed: ${BACKUP_FILE}.gz"
# Edit crontab crontab -e # Add daily backup at 2 AM 0 2 * * * /opt/MinerSheets/scripts/backup-database.sh >> /var/log/minersheets-backup.log 2>&1
Check logs and rebuild:
docker-compose logs docker-compose down docker-compose up -d --build
Check if Django is running and port is correct:
docker-compose ps curl http://localhost:9320 sudo nginx -t
Recollect static files:
docker-compose exec web python manage.py collectstatic --noinput sudo systemctl reload nginx