Coder Social home page Coder Social logo

larakube's Introduction

Laravel

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

Goal: Deploy PHP app that will auto scale based on average CPU utilization across deployed instance.

install Laravel with composer

composer global require "laravel/installer"

create new project

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

Docker

For the purpose of this demo I've built a public docker image and pushed to my Docker 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

load environment variables

kubectl create -f env-app.yaml 
kubectl create -f env-php.yaml 
kubectl create -f env-nginx.yaml 

deploy application

kubectl create -f deployment.yaml 

expose service

this step requires a different service yaml depending where the app is being deployed:

minikube

kubectl create -f service.node.yaml 

open browser

minikube service laravel-project

Google Cloud

kubectl create -f service.yaml 

Amazon AWS

kubectl create -f service.aws.yaml 

deploy auto scaler

kubectl create -f autoscaler.yaml

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

larakube's People

Contributors

markhilton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.