Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/renepardon/docker-for-artisans
Meetup at Links der Isar - 2019-11-19 - about Docker usage with laravel
https://github.com/renepardon/docker-for-artisans
Last synced: 12 days ago
JSON representation
Meetup at Links der Isar - 2019-11-19 - about Docker usage with laravel
- Host: GitHub
- URL: https://github.com/renepardon/docker-for-artisans
- Owner: renepardon
- License: mit
- Created: 2019-11-19T22:43:27.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2023-01-05T01:15:14.000Z (almost 2 years ago)
- Last Synced: 2023-03-15T11:45:25.904Z (over 1 year ago)
- Language: PHP
- Size: 8.48 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker for artisans
"Quick" intro to use Docker in combination with laravel
> Slides are available here: https://de.slideshare.net/RenPardon/docker-for-artisans## example 1
cd example1 && \
sh run.sh
## example 2cd example2 && \
sh run.sh
## example 3In addition to the laravel application which gets created through the run.sh script, we created those files and directories:
- docker/web/000-default.conf
- docker/crontab/crontab
- docker/crontab/docker-entrypoint.sh
- .dockerignore
- docker-compose.yml
- Dockerfile
- Dockerfile.dev
- run.shI also created an email, event and event listener to demonstrate functionality of the worker container.
cd example3 && \
sh run.shThe .env file contains a few adjustments to work nicer with the docker environment:
APP_NAME="Docker for Artisans"
APP_URL=http://localhost:8082
LOG_CHANNEL=stderr
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=secret
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=true
REDIS_HOST=redis
MAIL_DRIVER=smtp
MAIL_HOST=maildev
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_NAME="BoonWeb"
MAIL_FROM_ADDRESS="[email protected]"> Don't use Apache for Worker/Cron containers - it's just useless overhead!
### Testing events/emails with queues
First go into the database container: `docker-compose exec db bash`
And connect to MariaDB: `mysql -uroot -psecret`
Then create the database schema: `create database laravel;`Now you can run migrations:
docker-compose exec app bash
# Inside the App container:
php artisan queue:table
php artisan migrateThen open tinker:
php artisan tinker
#### And create a new mail
$mailer = app()->make(Illuminate\Mail\Mailer::class);
$mail = new App\Mail\TestMail();
$mailer->queue($mail);
#### Or test with an eventevent(new App\Events\TestEvent);
## Build for production
Just an example with default `Dockerfile`:
docker build -t links-der-isar/docker-for-artisans:1.3.945 .