mirror of
https://github.com/Dvorinka/bizoni.git
synced 2026-06-03 18:22:57 +00:00
3.8 KiB
3.8 KiB
Remote Blog Management - Complete Guide
🎯 Goal
Remove local blog files and work exclusively with remote server blogs.
📋 Options Available
Option 1: Quick Remove Local Blogs
# Run this in your bizoni directory
./remove-local-blogs.sh
Option 2: Ubuntu Server Management Script
# Upload to your Ubuntu server and run
./ubuntu-remote-blogs.sh migrate
Option 3: Backend Configuration (Recommended)
Update backend to work with remote blogs only.
🚀 Recommended Deployment Steps
Step 1: Remove Local Blogs
cd /home/tdvorak/Desktop/HTML_Projekty/bizoni
./remove-local-blogs.sh
Step 2: Update Backend Configuration
The backend is now configured to work with remote blogs at /var/www/bizoni/blog.
You can set the remote path with environment variable:
export REMOTE_BLOG_DIR="/var/www/bizoni/blog"
Step 3: Deploy Backend to Server
- Build the updated backend
- Deploy to your server
- Set REMOTE_BLOG_DIR environment variable
Step 4: Run Migration on Server
# On your Ubuntu server
./ubuntu-remote-blogs.sh migrate
📁 File Structure After Changes
Local (Development)
bizoni/
├── backend/main.go # Updated for remote blogs
├── admin/new.html # Updated with new fields
├── js/admin-auth.js # Login persistence
├── tools/migrate_slugs.go # Migration tool
├── remove-local-blogs.sh # Local cleanup script
└── ubuntu-remote-blogs.sh # Server management script
Server (Production)
/var/www/bizoni/
├── blog/
│ ├── 0000.html # Original numeric files
│ ├── 0001.html
│ ├── jdeme-do-finale.html # New slug files
│ └── 1-zapas-final-score.html
├── img/blog/
│ ├── 0000.png
│ └── 0001.png
└── backend # Updated backend
🔧 Ubuntu Server Script Usage
List All Blogs
./ubuntu-remote-blogs.sh list
Migrate All Blogs to Slugs
./ubuntu-remote-blogs.sh migrate
Show Blog Info
./ubuntu-remote-blogs.sh info 0030
Add Slug to Specific Blog
./ubuntu-remote-blogs.sh add-slug 0030
Create Backup
./ubuntu-remote-blogs.sh backup
🌐 URL Structure After Migration
Before
/blog/0030.html/blog/0001.html
After
/blog/jdeme-do-finale(clean URL)/blog/1-zapas-final-score/blog/0030.html(still works for backward compatibility)
⚠️ Important Notes
- Backup First: Always create backup before migration
- Test Locally: Test backend with REMOTE_BLOG_DIR set to local copy
- Deploy Gradually: Deploy backend first, then run migration
- Environment Variables: Use REMOTE_BLOG_DIR for flexibility
🔄 Environment Variables
Set these on your server:
# Path to remote blog directory
export REMOTE_BLOG_DIR="/var/www/bizoni/blog"
# Port for backend (if needed)
export PORT="8080"
# Static files path
export STATIC_PATH="/var/www/bizoni"
🚨 Troubleshooting
Backend Can't Find Blogs
# Check if directory exists
ls -la /var/www/bizoni/blog
# Set correct path
export REMOTE_BLOG_DIR="/correct/path/to/blogs"
Migration Script Fails
# Make script executable
chmod +x ubuntu-remote-blogs.sh
# Update paths in script
nano ubuntu-remote-blogs.sh
Permission Issues
# Fix permissions on server
sudo chown -R www-data:www-data /var/www/bizoni/blog
sudo chmod -R 755 /var/www/bizoni/blog
📞 Next Steps
- Choose your option (1, 2, or 3)
- Remove local blogs with the provided script
- Deploy updated backend to server
- Run migration on server
- Test new URLs and admin interface
Your blog system will then work entirely with remote server blogs! 🎉