• Stars
    star
    141
  • Rank 252,029 (Top 6 %)
  • Language
    PHP
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Running Laravel project using Docker and Deploying using Kubernetes

Laravel-docker-kubernetes

From here you will be able to know that how you will run your Laravel project using Docker and how you will deploy using Kubernetes(minikube)

Run the project using docker

Clone the project

Now run the following command from your terminal one by one. Running the commands be sure that you have installed docker.You will get install instructions from this link

docker-compose build
docker-compose up -d

Now browse project

http://localhost:8083/

Deploy the project using Kubernetes

At first build image running the command:

docker build . -f ./deploy/dockerfile -t laravel:v4

Now login in docker hub. Running the command be sure that you have created an account in docker hub. If not go to the link and create account.

docker login

Now run the following command for Pushing image in docker registry.In the command nahid35 is my docker id and laravel is repository name and v4 is tag name. Modify command according to your docker id, repository name and tag name.

docker tag laravel:v4 docker.io/nahid35/laravel:v4
docker push docker.io/nahid35/laravel:v4

Now run minikube. Running the commands be sure that you have installed minikube. If not installed, you can get install instructions from this link

minikube start

Now run the following commands for deploying App from your project directory :

alias kubectl="minikube kubectl --"

kubectl apply -f deploy/app/secret.yml

kubectl apply -f deploy/app/deploy.yml

kubectl apply -f deploy/app/service.yml

Now run the following commands to see minikube dashboard:

minikube dashboard

You will get this url :

http://192.168.99.100:30000/#!/overview?namespace=default
kubectl get svc

Running above command you will get following information:

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.0.1 443/TCP 27d
laravel-api LoadBalancer 10.0.0.11 80:32676/TCP 4m
minikube service list

Running above command you will get following information:

NAMESPACE NAME TARGET PORT URL
default kubernetes No node port
default laravel-api pat-api-port/80 http://192.168.49.2:31223
kube-system kube-dns No node port
kube-system metrics-server No node port
kubernetes-dashboard dashboard-metrics-scraper No node port
kubernetes-dashboard kubernetes-dashboard No node port

Now you can browse your project using following url :

 http://192.168.49.2:31223

Extra Note :

  • If you want to use different database or different port etc, You have to change in the docker-compose.yml file.
  • If you modify .env file, You have to run following command:
     base64 -b -i deploy/env/.env
  • Running the command you will get base 64 encoded string. Put the string in deploy\app\secret.yml. And then run the commands for deploying.

More Repositories

1

solid-principles

SOLID Principles - simple and easy explanation
PHP
260
star
2

oop

Interface and abstract class - simple and easy explanation
PHP
126
star
3

laravel-pdf

A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
PHP
86
star
4

git-flow-example

Git Flow Example
PHP
57
star
5

laravel-gentelella

Laravel with Gentelella admin template for developing Laravel applications
PHP
40
star
6

laravel-service-container

Laravel Service Container
PHP
33
star
7

laravel-jwt

Laravel with JWT Authentication for API development
PHP
31
star
8

lumen-jwt-api

Lumen with JWT Authentication for API development
PHP
28
star
9

laravel-docker-redis

Simple example: How to use laravel and redis using docker compose
PHP
27
star
10

eloquent-filter

This simple package helps you filter Eloquent data using query filters.
PHP
25
star
11

laravel-docker-elasticsearch

This is a simple repo for practicing elasticsearch with laravel and docker.
PHP
20
star
12

nodejs-weather-app

Node Js Weather App is a simple module for obtaining weather information
JavaScript
16
star
13

laravel-passport-api

Laravel with Passport Authentication for API development
PHP
13
star
14

laravel-macros

A Simple package for using Macros in Laravel
PHP
9
star
15

designPattern

Design Pattern - simple and easy explanation
PHP
7
star
16

simplex

The Simplex Framework is very simple and easy. It will be very helpful for the developers who are the beginner in PHP and want to learn Framework
PHP
5
star
17

laravel-eloquent-query-filtering

Laravel Eloquent Query Filtering
PHP
5
star
18

basic-problems-and-solutions

Basic data structures and algorithm related problems and solutions
PHP
5
star
19

react-redux-todo

Simple Todo App using react and redux
JavaScript
4
star
20

symfony-4-spacebar

PHP
4
star
21

code-refactore-rules

Code Refactore Rules
PHP
4
star
22

simple-php-framework

Trying to develop basic framework structure using symfony component
PHP
4
star
23

nodejs

JavaScript
3
star
24

vue-vuex-todo

Simple Todo App using Vue and Vuex
PHP
3
star
25

rest-go

Simple api using go
Go
3
star
26

elixir-practise

Elixir Practise
Elixir
3
star
27

laravel-google-spreadsheet

This package is underdeveloped
PHP
2
star
28

curl-vs-guzzle

Curl vs Guzzle
PHP
2
star
29

react-scoreboard

Score Board using React
JavaScript
2
star
30

django

Python
2
star
31

vuejs

HTML
2
star
32

Vue-2.0-Examples

Vue-2.0-Examples
HTML
2
star
33

csv_parse_zf1.12

PHP
2
star
34

elixir-in-examples

Elixir in Examples
Elixir
2
star
35

go-example

Go
2
star
36

symfony-demo

Symfony demo project for learning and practise
PHP
2
star
37

timezones

This package is underdeveloped
PHP
1
star
38

cake-php-demo

CakePHP demo project for learning purpose
PHP
1
star
39

laravel-and-vue

Laravel and Vue Js
PHP
1
star