This guide will help you deploy the Dockerized Laravel 12 Starter application using Docker. The application consists of a Laravel backend, React frontend, MySQL database, and Redis server, all running in separate containers.
- Docker installed on your machine
- Docker Compose installed on your machine
- Git (optional, for cloning the repository)
-
Clone or create the project
Either clone the repository
-
Set up environment variables
cp .env.example .env
Then edit
.envto set your desired database credentials and Pusher API keys. -
Build and start the containers
docker-compose up -d
-
Install JavaScript dependencies and build assets
docker-compose exec app npm install docker-compose exec app npm run dev
Once all containers are up and running, you can access the application at:
http://localhost:8080
-
Start containers
docker-compose up -d
-
Stop containers
docker-compose down
-
View logs
docker-compose logs -f
-
Access a container shell
docker-compose exec app bash
To ensure the cleaning of expired boards, set up a cron job to run the scheduler:
docker-compose exec app php artisan schedule:runFor production, you might want to add this to your server's crontab:
* * * * * docker-compose -f /path/to/docker-compose.yml exec -T app php artisan schedule:run >> /dev/null 2>&1
This application uses Pusher for real-time updates. Make sure to:
- Create a Pusher account at https://pusher.com/
- Get your App ID, Key, Secret, and Cluster
- Update your
.envfile with these credentials
For production environments, consider:
- Using a reverse proxy like Traefik or Nginx Proxy Manager
- Implementing SSL certificates for secure connections
- Setting up proper monitoring for your containers
- Configuring backups for your database volume
-
Database connection issues Make sure the database container is running and the credentials in the
.envfile are correct. -
File permission issues If you encounter permission issues, ensure the proper ownership of directories:
docker-compose exec app chown -R www-data:www-data /var/www/html/storage -
WebSocket connection errors Verify your Pusher credentials and make sure ports are not blocked by firewalls.