scan.fyi/README.md
2026-02-22 17:49:23 +00:00

3 KiB
Executable file

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

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:

podman-compose exec app php artisan migrate

Common Commands

Container Management

# 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

# 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

# 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

# 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

# Access Redis CLI
podman-compose exec redis redis-cli

Running Tests

# 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:

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

Troubleshooting

Containers won't start

# Check container status
podman-compose ps

# View container logs
podman-compose logs

Database connection errors

Ensure the database container is running and healthy:

podman-compose ps
podman-compose exec db mysql -u root -proot -e "SHOW DATABASES;"

Permission denied errors

Fix storage permissions:

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

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