dev (#1)
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s
Co-authored-by: Frank John Begornia <frank.begornia@yahoo.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
133
LOCAL_DEVELOPMENT.md
Normal file
133
LOCAL_DEVELOPMENT.md
Normal file
@@ -0,0 +1,133 @@
|
||||
# Local Development Setup for Merchbay
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Copy local environment file:**
|
||||
```bash
|
||||
cp .env.local .env
|
||||
```
|
||||
|
||||
2. **Build and start containers:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.local.yml up -d --build
|
||||
```
|
||||
|
||||
3. **Generate application key:**
|
||||
```bash
|
||||
docker exec merchbay_app_local php artisan key:generate
|
||||
```
|
||||
|
||||
4. **Run migrations:**
|
||||
```bash
|
||||
docker exec merchbay_app_local php artisan migrate
|
||||
```
|
||||
|
||||
5. **Access the application:**
|
||||
- **App:** http://localhost:8080
|
||||
- **phpMyAdmin:** http://localhost:8081
|
||||
- Username: `merchbay`
|
||||
- Password: `secret`
|
||||
|
||||
## Development Commands
|
||||
|
||||
### View logs
|
||||
```bash
|
||||
# Application logs
|
||||
docker exec merchbay_app_local tail -f storage/logs/laravel.log
|
||||
|
||||
# Apache logs
|
||||
docker logs -f merchbay_app_local
|
||||
```
|
||||
|
||||
### Run artisan commands
|
||||
```bash
|
||||
docker exec merchbay_app_local php artisan [command]
|
||||
```
|
||||
|
||||
### Access container shell
|
||||
```bash
|
||||
docker exec -it merchbay_app_local bash
|
||||
```
|
||||
|
||||
### Database access
|
||||
```bash
|
||||
docker exec -it merchbay_db_local mysql -u merchbay -psecret merchbay
|
||||
```
|
||||
|
||||
### Clear caches
|
||||
```bash
|
||||
docker exec merchbay_app_local php artisan cache:clear
|
||||
docker exec merchbay_app_local php artisan config:clear
|
||||
docker exec merchbay_app_local php artisan view:clear
|
||||
```
|
||||
|
||||
### Stop containers
|
||||
```bash
|
||||
docker-compose -f docker-compose.local.yml down
|
||||
```
|
||||
|
||||
### Stop and remove volumes (clean slate)
|
||||
```bash
|
||||
docker-compose -f docker-compose.local.yml down -v
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
### Enable Xdebug (if needed)
|
||||
Add to Dockerfile:
|
||||
```dockerfile
|
||||
RUN pecl install xdebug-2.9.8 && docker-php-ext-enable xdebug
|
||||
```
|
||||
|
||||
### Check container status
|
||||
```bash
|
||||
docker-compose -f docker-compose.local.yml ps
|
||||
```
|
||||
|
||||
### View all logs
|
||||
```bash
|
||||
docker-compose -f docker-compose.local.yml logs -f
|
||||
```
|
||||
|
||||
## Hot Reload Development
|
||||
|
||||
For live code changes without rebuilding:
|
||||
- Code changes in `.php` files are reflected immediately (via volume mount)
|
||||
- View changes are reflected immediately
|
||||
- Config/route changes require cache clearing
|
||||
|
||||
## Database Management
|
||||
|
||||
### Import SQL dump
|
||||
```bash
|
||||
docker exec -i merchbay_db_local mysql -u merchbay -psecret merchbay < dump.sql
|
||||
```
|
||||
|
||||
### Export database
|
||||
```bash
|
||||
docker exec merchbay_db_local mysqldump -u merchbay -psecret merchbay > dump.sql
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Permission issues
|
||||
```bash
|
||||
docker exec merchbay_app_local chown -R www-data:www-data storage bootstrap/cache
|
||||
docker exec merchbay_app_local chmod -R 775 storage bootstrap/cache
|
||||
```
|
||||
|
||||
### Reset everything
|
||||
```bash
|
||||
docker-compose -f docker-compose.local.yml down -v
|
||||
docker rmi merchbay_app:local
|
||||
rm .env
|
||||
cp .env.local .env
|
||||
docker-compose -f docker-compose.local.yml up -d --build
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The local setup uses a separate MySQL container
|
||||
- All code changes are live-mounted for easy development
|
||||
- Mail is logged to `storage/logs/laravel.log` instead of being sent
|
||||
- phpMyAdmin is available for easy database management
|
||||
Reference in New Issue
Block a user