chore: migrate from docker compose to kubernetes deployment
- Replace Docker Compose setup with Kubernetes manifests for deployment - Simplify Dockerfile to use PHP's built-in server instead of nginx+supervisor - Add Makefile with build and deploy commands for local development - Update environment configuration for production deployment - Remove docker-specific configuration files (nginx.conf, supervisord.conf)
This commit is contained in:
19
.env.example
19
.env.example
@@ -1,9 +1,9 @@
|
||||
APP_NAME=Laravel
|
||||
APP_NAME='MKM Tax Services'
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_KEY=base64:Tqv7x1T7GGUVfwzcWOwg6fwrp96dkjV4WCgyRYjdyYY=
|
||||
APP_DEBUG=true
|
||||
APP_TIMEZONE=UTC
|
||||
APP_URL=http://localhost
|
||||
APP_URL=http://mkmtaxservices.com.test
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
@@ -20,11 +20,14 @@ LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_HOST=192.168.100.105
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=mkm_admin
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
DB_PASSWORD=root
|
||||
|
||||
DB_QUEUE_TABLE=jobs
|
||||
DB_QUEUE=default
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
@@ -42,12 +45,12 @@ CACHE_PREFIX=
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_HOST=192.168.100.105
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_HOST=192.168.100.105
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
@@ -62,3 +65,5 @@ AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
OCTANE_SERVER=frankenphp
|
||||
|
||||
25
Dockerfile
25
Dockerfile
@@ -1,25 +1,6 @@
|
||||
FROM php:8.4-fpm
|
||||
|
||||
WORKDIR /var/www
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git curl zip unzip libpng-dev libonig-dev \
|
||||
libxml2-dev nginx supervisor \
|
||||
&& docker-php-ext-install pdo pdo_mysql mbstring exif pcntl bcmath gd
|
||||
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
|
||||
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache
|
||||
RUN chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["/usr/bin/supervisord"]
|
||||
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||
|
||||
11
Makefile
Normal file
11
Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
IMG := mkm-admin
|
||||
|
||||
build:
|
||||
podman build -t $(IMG) .
|
||||
|
||||
deploy: build
|
||||
@if [ ! -f .env ]; then cp .env.example .env; fi
|
||||
kubectl create secret generic mkm-admin-env --from-env-file=.env --dry-run=client -o yaml | kubectl apply -f -
|
||||
kubectl apply -f k8s/deployment.yaml
|
||||
|
||||
.PHONY: build deploy
|
||||
@@ -1,24 +0,0 @@
|
||||
events {}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
server {
|
||||
listen 80;
|
||||
root /var/www/public;
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:php-fpm]
|
||||
command=php-fpm
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:nginx]
|
||||
command=nginx -g 'daemon off;'
|
||||
autostart=true
|
||||
autorestart=true
|
||||
80
k8s/deployment.yaml
Normal file
80
k8s/deployment.yaml
Normal file
@@ -0,0 +1,80 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mkm-admin
|
||||
labels:
|
||||
app: mkm-admin
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mkm-admin
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mkm-admin
|
||||
spec:
|
||||
containers:
|
||||
- name: mkm-admin
|
||||
image: mkm-admin:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: mkm-admin-env
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mkm-admin-worker
|
||||
labels:
|
||||
app: mkm-admin
|
||||
component: worker
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mkm-admin
|
||||
component: worker
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mkm-admin
|
||||
component: worker
|
||||
spec:
|
||||
containers:
|
||||
- name: worker
|
||||
image: mkm-admin:latest
|
||||
imagePullPolicy: Always
|
||||
command: ["php", "artisan", "horizon"]
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: mkm-admin-env
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mkm-admin-service
|
||||
spec:
|
||||
selector:
|
||||
app: mkm-admin
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8000
|
||||
type: ClusterIP
|
||||
Reference in New Issue
Block a user