All Projects → markhilton → Larakube

markhilton / Larakube

Licence: mit
Laravel app deployment for auto scaled Kubernetes cluster

Projects that are alternatives of or similar to Larakube

Docker Laravel
🐳 Docker Images for Laravel development
Stars: ✭ 101 (-35.67%)
Mutual labels:  laravel, docker-image, docker-compose, nginx
Stacker
Stacker - The environment for local web development, ready for use.
Stars: ✭ 356 (+126.75%)
Mutual labels:  laravel, docker-compose, nginx
Laravel Docker K8s
Running Laravel project using Docker and Deploying using Kubernetes
Stars: ✭ 127 (-19.11%)
Mutual labels:  laravel, docker-image, docker-compose
Docker Laravel
🐳 Build a simple laravel development environment with docker-compose.
Stars: ✭ 415 (+164.33%)
Mutual labels:  laravel, docker-compose, nginx
Dockerized lara
Build your Laravel App with Redis - Mongodb - MariaDB - Nginx - php7 - zsh
Stars: ✭ 9 (-94.27%)
Mutual labels:  laravel, docker-image, docker-compose
Lumen Microservice
Lumen on Docker - Skeleton project with Nginx, MySQL & PHP 7 | Aws ECS, Google Kubernates, Azure Container Engine
Stars: ✭ 183 (+16.56%)
Mutual labels:  laravel, docker-image, docker-compose
Magento2 Varnish Redis Ssl Docker Compose
Deploy Magento2 with Varnish Cache and Redis with SSL termination using Docker-compose tool
Stars: ✭ 37 (-76.43%)
Mutual labels:  docker-image, docker-compose, nginx
Dockerfiles
lots of dockerfiles, based on alpine
Stars: ✭ 69 (-56.05%)
Mutual labels:  docker-image, docker-compose, nginx
Goodwork
Self hosted project management and collaboration tool powered by TALL stack
Stars: ✭ 1,730 (+1001.91%)
Mutual labels:  laravel, docker-compose
Docker Nginx Gunicorn Flask Letsencrypt
Boilerplate code for setting up Nginx + Gunicorn + Flask + automated LetsEncrypt certificates (https) using docker-compose.
Stars: ✭ 117 (-25.48%)
Mutual labels:  docker-compose, nginx
Docker
最新lnmp环境,包含php, java,nginx, mysql, go, node, mongodb, openssh server, redis, crond xhprof,maven等服务
Stars: ✭ 120 (-23.57%)
Mutual labels:  docker-image, docker-compose
Docker Nginx Basic Auth
🔐 Simple Docker image for basic authentication
Stars: ✭ 111 (-29.3%)
Mutual labels:  docker-image, nginx
Docker Nginx Postgres Django Example
Example using Docker, Django, multiple Postgres databases, NginX, Gunicorn, pipenv, GitLab CI and tox.
Stars: ✭ 110 (-29.94%)
Mutual labels:  docker-compose, nginx
Symfony 4 Docker Env
Docker Environment for Symfony. PHP-FPM, NGINX SSL Proxy, MySQL, LEMP
Stars: ✭ 119 (-24.2%)
Mutual labels:  docker-compose, nginx
Dlaravel
Laravel and Docker
Stars: ✭ 108 (-31.21%)
Mutual labels:  laravel, docker-compose
Docker Workshop
Introduction to Docker tutorial
Stars: ✭ 124 (-21.02%)
Mutual labels:  docker-image, docker-compose
Dockernotes
Docker入门精华版
Stars: ✭ 107 (-31.85%)
Mutual labels:  docker-image, docker-compose
Nginx Vod Module Docker
Docker image for nginx with Kaltura's VoD module used by The New York Times
Stars: ✭ 121 (-22.93%)
Mutual labels:  docker-image, nginx
Docker Phoenix
A dockerized Phoenix development and runtime environment.
Stars: ✭ 152 (-3.18%)
Mutual labels:  docker-image, docker-compose
Docker Continuous Deployment
continuous deployment of a microservices application with Docker
Stars: ✭ 141 (-10.19%)
Mutual labels:  docker-compose, nginx

Laravel

Things evolve faster than my commitment to this documentation, but may still be helpful...

Walk through deploying a Laravel application on auto scaled Kubernetes cluster.

Goal: Deploy Laravel PHP app that will auto scale based on average CPU utilization across cluster nodes.

Install Laravel with composer

composer global require "laravel/installer"

Create new Laravel project

composer create-project --prefer-dist laravel/laravel laravel-project

Local development

I have created docker-compose.yml with a typical infrastructure stack that includes:

  • MySQL (default database)
  • Redis (default cache engine)
  • Node (for auto compiling VUE components into app.js & css.js using webpack)

Linked following folders to Docker volumes:

  • MySQL data storage
  • Laravel vendors/
  • Laravel storage/
  • Laravel storage/public
  • Laravel node_modules

Therefore it's important to remember that while you work with this stack, the Laravel logs, compiled templates, cache files, vendor libraries, user uploads and application storage files, as well as MySQL database files will be saved in Docker volumes.

If you installed docker-compose already, simply run:

docker-compose up

and watch logs as Docker will pull all required stack images and provision application environment:

  • install required Laravel storage folders
  • run pending database migrations
  • run composer to install all vendor libraries
  • run node to install all dependencies to compile: app.js & app.css

Both composer and node container will remain running. Node will monitor (watch) for changes in resourse/js/ files to re-compile them on the fly.

Composer will remain running if you need to install additional vendor libraries, simply enter composer container shell with and for example install Redis support libs:

docker exec -ti composer bash
composer require predis/predis
composer require laravel/horizon

Node container:

docker exec -ti node bash
npm install

Laravel Horizon is a great package to manage Laravel queues with Redis.

Docker

For the purpose of this demo I've built a public Docker image and pushed to my account. Dockerfile adds Laravel app into a lightweight alpine image.

build application docker image

docker build -t crunchgeek/laravel-project .

push image to the repository

docker push crunchgeek/laravel-project

Kubernetes

Having to work with Kubernetes for the last year I've got some experience with both Google Cloud and AWS services providers.

I installed K8s on AWS using KOPS and do not recommend this for production workloads. I run into multiple issues around I/O performance with Docker overlay. AWS EKS does not appeal to me like GKE. Google K8s is real hands off managed master node, with easy upgrades and it ended up as my go to solution.

I also learned about Helm, Kubernetes package manager. So once you get your K8s cluster up on GKE I recommend this tutorial to install Helm.

test dry run helm chart

helm install --name laravel-labs --dry-run --debug ./laravel

install or upgrade current helm chart

helm upgrade laravel-labs ./laravel -i

delete helm chart

helm del --purge laravel-labs

That's it! Now the infrastructure will auto adjust itself to the app resources demand.

Ingress / Load Balancing

Every time you deploy a completely independent application on Kubernetes exposed to the public network - it will probably come with a Load Balancer service. This may be costly if you have to deploy several of them.

Instead better solution is to use Nginx Ingress Helm Chart with a single Load Balancer and IP address. You can deploy as many new services as you need and use Ingress to route the traffic to a specific app.

SSL support

The easiest way to deploy SSL protected application is to use Cert Manager Helm Chart, which will provision SSL certificates using free Let's Encrypt service.

Deploying SSL protected sites is as simple as adding a single line in your ingress.yaml

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].