Skip to content
Snippets Groups Projects
Commit b2cdd3b1 authored by derrabauke's avatar derrabauke
Browse files

added an extra health endpoint

- figured out how to configure liveliness
parent a733e38b
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,5 @@ COPY . .
RUN npm install --production
ENV PORT 3002
ENV NODE_ENV production
EXPOSE 3002
CMD ["npm", "start"]
......@@ -33,17 +33,26 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: PORT
value: "{{ .Values.port }}"
- name: MONGODB_URL
value: "mongodb://{{ .Values.mongodb.fullnameOverride}}:{{ .Values.mongodb.service.port }}"
- name: NODE_ENV
value: "production"
- name: JWT_SECRET
value: "secretz"
ports:
- name: primary
containerPort: {{ .Values.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
path: /health
port: primary
readinessProbe:
httpGet:
path: /
path: /health
port: primary
resources:
{{- toYaml .Values.resources | nindent 12 }}
......@@ -3,7 +3,7 @@ image:
repository: backend #! change to container registry if possible
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.0.2"
tag: "v0.0.3"
replicaCount: 1
port: 3002
......
......@@ -8,6 +8,7 @@ const todoRoutes = require('./routes/todo');
const userRoutes = require('./routes/user');
const errorRoutes = require('./routes/error');
const envRoute = require('./routes/env.js');
const healthRoute = require('./routes/health.js');
let cookieParser = require('cookie-parser');
const app = express();
......@@ -37,6 +38,7 @@ app.use(userRoutes);
app.use('/', express.static(path.resolve(__dirname, `./public`)));
// IMPORTANT: Educational purpose only! Possibly exposes sensitive data.
app.use(envRoute);
app.use(healthRoute);
// NOTE: must be last one, because is uses a wildcard (!) that behaves aa
// fallback and catches everything else
app.use(errorRoutes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment