Compare commits
2 Commits
0fab8b6d42
...
ced136fb4d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ced136fb4d | ||
|
|
cac26e73ce |
172
k8s/deployment-nodejs.yaml
Normal file
172
k8s/deployment-nodejs.yaml
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
namespace: manoonoilstype: Opaque
|
||||||
|
stringData:
|
||||||
|
WOOCOMMERCE_URL: "https://manoonoils.com"
|
||||||
|
# You'll need to update these with actual credentials
|
||||||
|
WOOCOMMERCE_CONSUMER_KEY: "PLACEHOLDER_KEY"
|
||||||
|
WOOCOMMERCE_CONSUMER_SECRET: "PLACEHOLDER_SECRET"
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: storefront
|
||||||
|
namespace: manoonoilsspec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: storefront
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: storefront
|
||||||
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: clone
|
||||||
|
image: alpine/git:latest
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
apk add --no-cache git
|
||||||
|
|
||||||
|
# Clone from Gitea (using HTTP with ssl verify disabled for self-signed cert)
|
||||||
|
git config --global http.sslVerify false
|
||||||
|
git clone --depth 1 --branch master \
|
||||||
|
https://100.74.155.73:3000/unchained/manoon-headless.git \
|
||||||
|
/workspace
|
||||||
|
|
||||||
|
echo "Clone complete. Files:"
|
||||||
|
ls -la /workspace
|
||||||
|
volumeMounts:
|
||||||
|
- name: workspace
|
||||||
|
mountPath: /workspace
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
- name: install
|
||||||
|
image: node:20-alpine
|
||||||
|
workingDir: /workspace
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
echo "Installing dependencies..."
|
||||||
|
npm ci --prefer-offline --no-audit --silent
|
||||||
|
echo "Dependencies installed."
|
||||||
|
volumeMounts:
|
||||||
|
- name: workspace
|
||||||
|
mountPath: /workspace
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
- name: build
|
||||||
|
image: node:20-alpine
|
||||||
|
workingDir: /workspace
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
echo "Building Next.js app..."
|
||||||
|
npm run build
|
||||||
|
echo "Build complete!"
|
||||||
|
env:
|
||||||
|
- name: NODE_ENV
|
||||||
|
value: "production"
|
||||||
|
- name: NEXT_PUBLIC_WOOCOMMERCE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
key: WOOCOMMERCE_URL
|
||||||
|
- name: NEXT_PUBLIC_WOOCOMMERCE_CONSUMER_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
key: WOOCOMMERCE_CONSUMER_KEY
|
||||||
|
- name: NEXT_PUBLIC_WOOCOMMERCE_CONSUMER_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
key: WOOCOMMERCE_CONSUMER_SECRET
|
||||||
|
- name: NEXT_PUBLIC_SITE_URL
|
||||||
|
value: "https://dev.manoonoils.com"
|
||||||
|
volumeMounts:
|
||||||
|
- name: workspace
|
||||||
|
mountPath: /workspace
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 2000m
|
||||||
|
memory: 2Gi
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
containers:
|
||||||
|
- name: storefront
|
||||||
|
image: node:20-alpine
|
||||||
|
workingDir: /workspace
|
||||||
|
command:
|
||||||
|
- npm
|
||||||
|
- start
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
env:
|
||||||
|
- name: NODE_ENV
|
||||||
|
value: "production"
|
||||||
|
- name: PORT
|
||||||
|
value: "3000"
|
||||||
|
- name: HOSTNAME
|
||||||
|
value: "0.0.0.0"
|
||||||
|
- name: NEXT_PUBLIC_WOOCOMMERCE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
key: WOOCOMMERCE_URL
|
||||||
|
- name: NEXT_PUBLIC_WOOCOMMERCE_CONSUMER_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
key: WOOCOMMERCE_CONSUMER_KEY
|
||||||
|
- name: NEXT_PUBLIC_WOOCOMMERCE_CONSUMER_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: woocommerce-credentials
|
||||||
|
key: WOOCOMMERCE_CONSUMER_SECRET
|
||||||
|
- name: NEXT_PUBLIC_SITE_URL
|
||||||
|
value: "https://dev.manoonoils.com"
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 1Gi
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
volumeMounts:
|
||||||
|
- name: workspace
|
||||||
|
mountPath: /workspace
|
||||||
|
startupProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 3000
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 30
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 3000
|
||||||
|
periodSeconds: 30
|
||||||
|
failureThreshold: 3
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 3000
|
||||||
|
periodSeconds: 5
|
||||||
|
failureThreshold: 3
|
||||||
|
volumes:
|
||||||
|
- name: workspace
|
||||||
|
emptyDir:
|
||||||
|
sizeLimit: 2Gi
|
||||||
Reference in New Issue
Block a user