{"id":13576252,"url":"https://github.com/markhilton/larakube","last_synced_at":"2025-10-13T05:17:18.289Z","repository":{"id":68163331,"uuid":"115762571","full_name":"markhilton/larakube","owner":"markhilton","description":"Laravel app deployment for auto scaled Kubernetes cluster","archived":false,"fork":false,"pushed_at":"2018-11-28T00:47:22.000Z","size":20,"stargazers_count":173,"open_issues_count":2,"forks_count":38,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-22T18:25:49.718Z","etag":null,"topics":["auto-scaling","docker","docker-compose","docker-image","helm","helm-chart","kubernetes","laravel","nginx","php-fpm"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markhilton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-30T00:05:55.000Z","updated_at":"2023-11-07T12:47:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"22b45eff-cc52-4a34-9475-af3742f2039f","html_url":"https://github.com/markhilton/larakube","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/markhilton/larakube","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markhilton%2Flarakube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markhilton%2Flarakube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markhilton%2Flarakube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markhilton%2Flarakube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markhilton","download_url":"https://codeload.github.com/markhilton/larakube/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markhilton%2Flarakube/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013695,"owners_count":26085390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-scaling","docker","docker-compose","docker-image","helm","helm-chart","kubernetes","laravel","nginx","php-fpm"],"created_at":"2024-08-01T15:01:08.406Z","updated_at":"2025-10-13T05:17:18.259Z","avatar_url":"https://github.com/markhilton.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"# Laravel\n\n_Things evolve faster than my commitment to this documentation, but may still be helpful..._\n\nWalk through deploying a [Laravel](https://laravel.com/) application on auto scaled [Kubernetes](https://kubernetes.io/) cluster.\n\n**Goal**: Deploy Laravel [PHP](http://php.net/) app that will auto scale based on average CPU utilization across cluster nodes.\n\n### Install Laravel with [composer](https://getcomposer.org/)\n\n```bash\ncomposer global require \"laravel/installer\"\n```\n\n### Create new Laravel project\n\n```bash\ncomposer create-project --prefer-dist laravel/laravel laravel-project\n```\n\n## Local development\n\nI have created `docker-compose.yml` with a typical infrastructure stack that includes:\n\n-   MySQL (default database)\n-   Redis (default cache engine)\n-   Node (for auto compiling VUE components into app.js \u0026 css.js using webpack)\n\nLinked following folders to Docker volumes:\n\n-   MySQL data storage\n-   Laravel `vendors/`\n-   Laravel `storage/`\n-   Laravel `storage/public`\n-   Laravel `node_modules`\n\nTherefore 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](https://docs.docker.com/storage/volumes/).\n\nIf you installed [docker-compose](https://docs.docker.com/compose/install/) already, simply run:\n\n```bash\ndocker-compose up\n```\n\nand watch logs as Docker will pull all required stack images and provision application environment:\n\n-   install required Laravel storage folders\n-   run pending database migrations\n-   run composer to install all vendor libraries\n-   run node to install all dependencies to compile: app.js \u0026 app.css\n\nBoth composer and node container will remain running. Node will monitor (watch) for changes in resourse/js/ files to re-compile them on the fly.\n\nComposer will remain running if you need to install additional vendor libraries, simply enter composer container shell with and for example install [Redis](https://laravel.com/docs/5.7/redis) support libs:\n\n```bash\ndocker exec -ti composer bash\ncomposer require predis/predis\ncomposer require laravel/horizon\n```\n\nNode container:\n\n```bash\ndocker exec -ti node bash\nnpm install\n```\n\n[Laravel Horizon](https://laravel.com/docs/5.7/horizon#installation) is a great package to manage Laravel queues with Redis.\n\n# Docker\n\nFor 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.\n\n## build application docker image\n\n```\ndocker build -t crunchgeek/laravel-project .\n```\n\n## push image to the repository\n\n```\ndocker push crunchgeek/laravel-project\n```\n\n# Kubernetes\n\nHaving to work with Kubernetes for the last year I've got some experience with both [Google Cloud](https://cloud.google.com/) and [AWS services](https://aws.amazon.com/) providers.\n\nI installed K8s on AWS using [KOPS](https://github.com/kubernetes/kops) and do not recommend this for production workloads. I run into multiple issues around I/O performance with Docker overlay. [AWS EKS](https://aws.amazon.com/eks/) does not appeal to me like [GKE](https://cloud.google.com/kubernetes-engine/). Google K8s is real hands off managed master node, with easy upgrades and it ended up as my go to solution.\n\nI also learned about [Helm](https://helm.sh/), Kubernetes package manager. So once you get your K8s cluster up on GKE I recommend [this tutorial](https://cloud.google.com/solutions/continuous-integration-helm-concourse) to install Helm.\n\n### test dry run helm chart\n\n```bash\nhelm install --name laravel-labs --dry-run --debug ./laravel\n```\n\n### install or upgrade current helm chart\n\n```bash\nhelm upgrade laravel-labs ./laravel -i\n```\n\n### delete helm chart\n\n```bash\nhelm del --purge laravel-labs\n```\n\nThat's it! Now the infrastructure will auto adjust itself to the app resources demand.\n\n## Ingress / Load Balancing\n\nEvery 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.\n\nInstead better solution is to use [Nginx Ingress Helm Chart](https://github.com/helm/charts/tree/master/stable/nginx-ingress) with a single Load Balancer and IP address. You can deploy as many new services as you need and use [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) to route the traffic to a specific app.\n\n## SSL support\n\nThe easiest way to deploy SSL protected application is to use [Cert Manager](https://github.com/helm/charts/tree/master/stable/cert-manager) Helm Chart, which will provision SSL certificates using free [Let's Encrypt](https://letsencrypt.org/) service.\n\nDeploying SSL protected sites is as simple as adding a single line in your ingress.yaml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkhilton%2Flarakube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkhilton%2Flarakube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkhilton%2Flarakube/lists"}