View file File name : QUICKSTART.md Content :# Quick Start Guide - Database Backup Manager This guide will get you up and running in 15 minutes! ## Prerequisites - PHP 8.2+ - MySQL/MariaDB - Composer - Git ## 1. Environment Setup (2 minutes) ### Copy Environment File ```bash cp .env.example .env ``` ### Generate Application Key ```bash php artisan key:generate ``` ### Update Database Connection Edit `.env` and update these variables: ```env DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=backup_manager DB_USERNAME=root DB_PASSWORD= ``` Create the database: ```bash mysql -u root -p -e "CREATE DATABASE backup_manager;" ``` ### Run Migrations ```bash php artisan migrate ``` ## 2. Google Drive Setup (5 minutes) ### Step A: Create Google Cloud Project 1. Visit [Google Cloud Console](https://console.cloud.google.com) 2. Click "Select a Project" > "New Project" 3. Enter "Database Backup Manager" 4. Click "Create" ### Step B: Enable Google Drive API 1. Click "APIs & Services" in left menu 2. Search for "Google Drive API" 3. Click the result and select "Enable" ### Step C: Create OAuth Credentials 1. Go to "APIs & Services" > "Credentials" 2. Click "Create Credentials" > "OAuth client ID" 3. Choose "Web application" 4. Name it "Database Backup Manager" 5. Add authorized redirect URIs: ``` http://localhost:8000/google-drive/callback ``` (For production, use your actual domain) 6. Click "Create" 7. Copy the **Client ID** and **Client Secret** ### Step D: Configure Environment Edit `.env` and add: ```env GOOGLE_CLIENT_ID=your_client_id_here GOOGLE_CLIENT_SECRET=your_client_secret_here GOOGLE_REDIRECT_URI=http://localhost:8000/google-drive/callback ``` ## 3. Start the Application (1 minute) ```bash php artisan serve ``` Visit: **http://localhost:8000** You should see the Dashboard! ## 4. Connect Google Drive (2 minutes) 1. Click the "Dashboard" link in the nav 2. Look for "Google Drive Connection" section 3. Click "Connect Google Drive" 4. Authorize the application in the popup 5. You'll be redirected back - you're connected! ## 5. Add Your First Database (3 minutes) 1. Click "Databases" in the navigation 2. Click "+ Add Database" 3. Fill in your database details: - **Database Name**: A friendly name (e.g., "Production DB") - **Host**: Usually `localhost` or your server IP - **Port**: Usually `3306` - **Database**: The actual database name on your server - **Username**: Database username - **Password**: Database password 4. Click "Save Database" ## 6. Run Your First Backup (2 minutes) ### Manual Backup 1. Go to Dashboard 2. Find your database in "Active Databases" section 3. Click "Backup Now" 4. Check "Backup History" page to see the result ### Automated Backup 1. Click "Schedules" in navigation 2. Select your database 3. Choose frequency (daily, weekly, etc.) 4. Set the time (e.g., 02:00 for 2 AM) 5. Click "Create Schedule" ## 7. Set Up Cron Job (For Linux/Mac) (1 minute) For automated schedules to work, add this to your crontab: ```bash crontab -e ``` Add this line: ``` * * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1 ``` Replace `/path/to/your/project` with your actual project path. **Windows users**: Use Task Scheduler to run the same command every minute. ## Testing ### Test Manual Backup ```bash php artisan backups:run-scheduled ``` ### Test Database Connection ```bash php artisan tinker >>> DB::connection('mysql')->getPdo(); ``` ### Test Google Drive Connection 1. Go to Dashboard 2. Verify "Google Drive Connection" shows "Connected" 3. Manual backup should upload automatically ## Common Issues ### MySQL Connection Fails - Check host, port, username, password in `.env` - Ensure database user has connection privileges - Verify MySQL service is running ### Google Drive Upload Fails - Verify `mysqldump` is installed and in PATH - Check `.env` Google credentials are correct - Try disconnecting and reconnecting Google Drive ### Cron Job Not Running - Verify cron is running: `sudo service cron status` - Check cron logs: `sudo grep CRON /var/log/syslog` - Ensure full path is used in crontab ## Useful Commands ```bash # Run scheduled backups manually php artisan backups:run-scheduled # Clear backup history older than 30 days php artisan tinker >>> app(App\Services\BackupService::class)->deleteOldBackups(30); >>> exit # Check Laravel scheduler php artisan schedule:list # Test your config php artisan config:show services.google ``` ## Next Steps 1. **Configure backup retention**: Delete old backups after 30 days 2. **Monitor backups**: Check backup history regularly 3. **Test restore**: Ensure you can restore from backups 4. **Add more databases**: Manage multiple backups 5. **Production deployment**: Update `.env` for production domain ## Support - Check [SETUP.md](SETUP.md) for detailed documentation - Review logs: `tail -f storage/logs/laravel.log` - MySQL errors: Check your database error log ## Security Tips 1. Never commit `.env` file to version control 2. Use strong database passwords 3. Store Google credentials securely 4. Keep Laravel and packages updated 5. Use HTTPS in production 6. Restrict backup file access 7. Test restore procedures regularly --- **You're all set! Your database backup system is ready to use.** 🎉