Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

RUN npm install -g 0x

USER nextjs
RUN apk add sudo perf

EXPOSE 3000

ENV PORT=3000

ENV HOSTNAME="0.0.0.0"

CMD ["node", "server.js"]
USER root

RUN mkdir -p /artifacts /html_output

CMD ["0x", "--kernel-tracing", "--output-dir", "/artifacts/{pid}.0x", "--output-html", "/html_output/{name}.html", "--", "node", "server.js"]
36 changes: 25 additions & 11 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: nsolid
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: nsolid
Expand All @@ -14,40 +14,54 @@ spec:
labels:
app: nsolid
spec:
securityContext:
runAsNonRoot: true
containers:
- name: nsolid
image: yourrepo/nsolid:latest
imagePullPolicy: Always
image: 800406105498.dkr.ecr.us-west-2.amazonaws.com/kubernetes/test:latest
ports:
- containerPort: 3000
env:
- name: NSOLID_APPNAME
value: "Sample App"
- name: NSOLID_TAGS
value: "production,nextjs,nsolid-hydrogen"
- name: NSOLID_SAAS
valueFrom:
secretKeyRef:
name: nsolid-saas-secret
key: nsolid_saas
# - name: NSOLID_SAAS
# valueFrom:
# secretKeyRef:
# name: nsolid-saas-secret
# key: nsolid_saas
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
securityContext:
privileged: true
livenessProbe:
httpGet:
path: /health
path: /
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
path: /
port: 3000
initialDelaySeconds: 10
periodSeconds: 5
volumeMounts:
- name: artifacts-volume
mountPath: /artifacts
- name: html-output-volume
mountPath: /html_output
command: ["0x", "--kernel-tracing", "--output-dir", "/artifacts/{pid}.0x", "--output-html", "/html_output/{name}.html", "--", "node", "server.js"]
terminationGracePeriodSeconds: 30
volumes:
- name: artifacts-volume
persistentVolumeClaim:
claimName: artifacts-pvc
- name: html-output-volume
persistentVolumeClaim:
claimName: html-output-pvc
23 changes: 23 additions & 0 deletions k8s/pvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: artifacts-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: gp2
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: html-output-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: gp2
Loading