smart48 / larak8

DigitalOcean Kubernetes Deployment of Laravel App
2 stars 2 forks source link

Local MySQL and Redis #5

Open jasperf opened 3 years ago

jasperf commented 3 years ago

Local setup does also need a MySQL and Redis Image to run. Smart48 has not set up specific images for these yet. We can use the images from https://github.com/smart48/smt-docker . Just need to build these as well and add them to Docker Hub to use them in the local deployment.

jasperf commented 3 years ago

Better use https://github.com/laradock/laradock/tree/master/mysql for the MySQL database container.

jasperf commented 3 years ago

https://github.com/smart48/smt-mysql exists now and based of Laradock's MySQL image. No tweaks made yet. Will be added to Docker Hub.

jasperf commented 3 years ago

MySQL image added to Docker https://hub.docker.com/repository/docker/smart48/smt-mysql so can be referred to. Not tested in tandem with any of the other images yet. Redis still to be taken care of.

jasperf commented 3 years ago

Redis Image also added to Docker Hub and to its own repository https://github.com/smart48/smt-redis / https://hub.docker.com/repository/docker/smart48/smt-redis

jasperf commented 3 years ago

For MySQL local deployment example see .ie. https://github.com/kadnan/LearningK8s

jasperf commented 3 years ago

start made based on Kadnan's repo using MySQL deployment and persistent volume claim for MySQL and Redis. Both need testing still.

jasperf commented 3 years ago
kubectl apply -f local/redis.yml
The Deployment "redis" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"redis8"}: `selector` does not match template `labels`
jasperf commented 3 years ago

Fix for label issue added just now. Also added all to set-local namespace as well

kubectl get pods -n smt-local
NAME                       READY   STATUS    RESTARTS   AGE
localweb-5fcbfb587-f7tzh   2/2     Running   0          68m
localweb-5fcbfb587-lrcfw   2/2     Running   0          68m
localweb-5fcbfb587-vggk6   2/2     Running   0          68m
mysql-d54869744-xz6sx      0/1     Pending   0          104s
redis-7c77f656d5-6qksc     0/1     Pending   0          96s
jasperf commented 3 years ago

We do need now to access the databases from the application and from workspace so we can run `php artisan commands from workspace inside the application including migrations. So we need a .env for the minikube and remote setup as well.

jasperf commented 3 years ago

MySQL Container is now running in local deployment. Redis will be tested a bit later.