TEW-0x04/README.md
2020-04-27 04:13:41 +02:00

2.3 KiB

tew-0x04

just an ultrasimple laravel mvc demo for tew classes

commands

run commands directly in the container (which is named laravel) using docker-compose exec

create a new controller

$ docker-compose exec laravel php artisan make:controller CarsController --invokable

create a migration

$ docker-compose exec laravel php artisan make:migration create_cars_table

perform predefined migrations

$ docker-compose exec laravel php artisan migrate

first setup

docker

running on fedora 32 via moby-engine

$ sudo  dnf install moby-engine moby-engine-vim moby-engine-zsh-completion \
  && sudo systemctl enable --now docker

enable backward compatibility for Cgroups using systemd.unified_cgroup_hierarchy=0 kernel arg (reboot implied), otherwise docker won't function correctly

make sure your user is in the docker group to be able to use docker/docker-compose
commands without sudo

run the following and log out/back in to apply the change

$ sudo groupadd docker
$ sudo usermod -aG docker $USER

why to use docker

  • the development environment setup process is greatly simplified thanks to using a docker-compose magic

  • can use mere docker-compose up to start up the container bundle

the docker-compose.yml file is largely based on the bitnami one, it was appropriated, though, to play better with fedora

selinux

after some hours of despair and a fair amount of selinux sorcery I was finally able to connect to the database (YMMV), you may need to push docker to the permissive zone

firewall

try enabling docker0 (docker networking interface) in the firewall first, running as root

$ sudo firewall-cmd --permanent --zone=trusted --change-interface=docker0

followed by

$ sudo firewall-cmd --reload

and restart docker with

$ sudo systemctl restart docker

Note: restarting docker will stop any running containers

if the above still doesn't allow you to connect to the database, also allow the docker's bridge interface in the firewall in a similar manner