Initial commit

This commit is contained in:
Dan 2026-02-20 14:36:17 +00:00
commit 2bbb775155

269
README.md Executable file
View file

@ -0,0 +1,269 @@
# Laravel Application with Podman
This is a Laravel 12 application configured to run in Podman containers.
## Requirements
- Podman 5.0 or later
- podman-compose
## Services
The application stack includes:
- **app**: Laravel application (PHP 8.3-FPM + Nginx)
- **db**: MySQL 8.0 database
- **redis**: Redis cache server
## Quick Start
### 1. Start the containers
```bash
podman-compose up -d --build
```
This will build and start all containers in detached mode.
### 2. Access the application
Open your browser and navigate to:
```
http://localhost:8080
```
### 3. Run migrations
The initial migrations have already been run during setup. If you need to run additional migrations:
```bash
podman-compose exec app php artisan migrate
```
## Common Commands
### Container Management
```bash
# Start containers
podman-compose up -d
# Stop containers
podman-compose down
# View logs
podman-compose logs -f
# View app logs only
podman-compose logs -f app
# Rebuild containers
podman-compose up -d --build
```
### Laravel Artisan Commands
```bash
# Run any artisan command
podman-compose exec app php artisan [command]
# Examples:
podman-compose exec app php artisan migrate
podman-compose exec app php artisan migrate:fresh --seed
podman-compose exec app php artisan make:model Post -m
podman-compose exec app php artisan make:controller PostController
podman-compose exec app php artisan route:list
podman-compose exec app php artisan tinker
```
### Composer Commands
```bash
# Install dependencies
podman-compose exec app composer install
# Update dependencies
podman-compose exec app composer update
# Add a package
podman-compose exec app composer require vendor/package
```
### Database Access
```bash
# Access MySQL CLI
podman-compose exec db mysql -u laravel -psecret laravel
# Or as root
podman-compose exec db mysql -u root -proot laravel
```
### Redis Access
```bash
# Access Redis CLI
podman-compose exec redis redis-cli
```
### Running Tests
```bash
# Run PHPUnit tests
podman-compose exec app php artisan test
# Or using vendor binary
podman-compose exec app ./vendor/bin/phpunit
```
### File Permissions
If you encounter permission issues with storage or cache:
```bash
podman-compose exec app chown -R www-data:www-data /var/www/html/storage
podman-compose exec app chmod -R 755 /var/www/html/storage
```
## Configuration
### Environment Variables
The application is configured via the `.env` file. Key Docker-specific settings:
```
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret
REDIS_HOST=redis
REDIS_PORT=6379
```
### Database Credentials
- **Database**: laravel
- **Username**: laravel
- **Password**: secret
- **Root Password**: root
### Ports
- **Application**: 8080 (maps to container port 80)
- **MySQL**: 3306
- **Redis**: 6379
## Project Structure
```
.
├── app/ # Application code
├── bootstrap/ # Bootstrap files
├── config/ # Configuration files
├── database/ # Migrations, seeders, factories
├── docker/ # Docker configuration
│ ├── nginx/ # Nginx configuration
│ └── supervisor/ # Supervisor configuration
├── public/ # Public assets
├── resources/ # Views, assets
├── routes/ # Route definitions
├── storage/ # Storage files
├── tests/ # Tests
├── vendor/ # Composer dependencies
├── compose.yml # Podman Compose configuration
├── Dockerfile # Container image definition
└── .env # Environment configuration
```
## Troubleshooting
### Containers won't start
```bash
# Check container status
podman-compose ps
# View container logs
podman-compose logs
```
### Database connection errors
Ensure the database container is running and healthy:
```bash
podman-compose ps
podman-compose exec db mysql -u root -proot -e "SHOW DATABASES;"
```
### Permission denied errors
Fix storage permissions:
```bash
podman-compose exec app chown -R www-data:www-data storage bootstrap/cache
podman-compose exec app chmod -R 775 storage bootstrap/cache
```
### Clear Laravel cache
```bash
podman-compose exec app php artisan cache:clear
podman-compose exec app php artisan config:clear
podman-compose exec app php artisan route:clear
podman-compose exec app php artisan view:clear
```
## Development Workflow
1. Make code changes in your local files
2. Changes are reflected immediately via volume mounting
3. For composer or config changes, you may need to restart containers:
```bash
podman-compose restart app
```
## Stopping the Application
```bash
# Stop containers (preserves data)
podman-compose down
# Stop and remove volumes (deletes database data)
podman-compose down -v
```
## Additional Information
- Laravel Version: 12.52.0
- PHP Version: 8.3
- MySQL Version: 8.0
- Nginx: Latest stable
- Redis: Alpine latest
For more information about Laravel, visit [https://laravel.com/docs](https://laravel.com/docs)
---
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).