Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CodingMonkTech/cafec3a17d2d29f595b01d5b394b0478 to your computer and use it in GitHub Desktop.
Save CodingMonkTech/cafec3a17d2d29f595b01d5b394b0478 to your computer and use it in GitHub Desktop.

Revisions

  1. CodingMonkTech renamed this gist Jan 12, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. CodingMonkTech revised this gist Jan 12, 2020. No changes.
  3. CodingMonkTech revised this gist Jan 12, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    FROM php:7.2-fpm
    COPY app /var/www/
    EXPOSE 9000
  4. CodingMonkTech revised this gist Jan 12, 2020. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    FROM php:7.2-fpm
    COPY app /var/www/
    EXPOSE 9000


  5. CodingMonkTech created this gist Jan 12, 2020.
    5 changes: 5 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    FROM php:7.2-fpm
    COPY app /var/www/
    EXPOSE 9000


    29 changes: 29 additions & 0 deletions nginx_configMap.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: nginx-config
    labels:
    tier: backend
    data:
    config : |
    server {
    index index.php index.html;
    error_log /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /code/app/public;
    location / {
    try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ .php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+.php)(/.+)$;
    fastcgi_pass php:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }
    }
    41 changes: 41 additions & 0 deletions nginx_deployment.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: nginx
    labels:
    tier: backend
    app: nginx
    spec:
    replicas: 2
    selector:
    matchLabels:
    app: nginx
    tier: backend
    template:
    metadata:
    labels:
    app: nginx
    tier: backend
    spec:
    volumes:
    - name: dir
    hostPath:
    path: /code
    - name: config
    configMap:
    name: nginx-config
    items:
    - key: config
    path: site.conf
    containers:
    - name: nginx
    image: nginx
    volumeMounts:
    - name: dir
    mountPath: /code
    - name: config
    mountPath: /etc/nginx/conf.d
    ports:
    - containerPort: 80
    name: http
    protocol: TCP
    17 changes: 17 additions & 0 deletions nginx_service.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    kind: Service
    apiVersion: v1
    metadata:
    name: nginx
    labels:
    tier: backend
    app: nginx
    spec:
    ports:
    - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 32380
    selector:
    tier: backend
    app: nginx
    type: LoadBalancer
    39 changes: 39 additions & 0 deletions php_deployment.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: php
    labels:
    tier: backend
    spec:
    replicas: 5
    selector:
    matchLabels:
    app: php
    tier: backend
    template:
    metadata:
    labels:
    app: php
    tier: backend
    spec:
    volumes:
    - name: dir
    hostPath:
    path: /code
    containers:
    - name: php
    image: hirenkavad/laravel-k8:1.5.1
    volumeMounts:
    - name: dir
    mountPath: /code
    initContainers:
    - name: install
    image: busybox
    volumeMounts:
    - name: dir
    mountPath: /code
    command:
    - cp
    - "-r"
    - "/var/www/."
    - "/code/app"
    13 changes: 13 additions & 0 deletions php_service.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    apiVersion: v1
    kind: Service
    metadata:
    name: php
    labels:
    tier: backend
    spec:
    selector:
    app: php
    tier: backend
    ports:
    - protocol: TCP
    port: 9000