update kubernetes config to include cronjobs to fetch examples

This commit is contained in:
Cassie Tarakajian 2018-08-28 14:47:05 -04:00
parent c3537b32d0
commit b5a32d79fa
2 changed files with 50 additions and 10 deletions

View file

@ -24,13 +24,5 @@ ENV NODE_ENV=production
COPY package.json package-lock.json index.js ./ COPY package.json package-lock.json index.js ./
RUN npm install --production RUN npm install --production
RUN npm rebuild node-sass RUN npm rebuild node-sass
# RUN npm install pm2 -g COPY --from=build $APP_HOME/dist ./dist
# RUN npm install local-ssl-proxy
# COPY index.js ecosystem.json ./
COPY --from=build /usr/src/app/dist ./dist
# for reg production
CMD ["npm", "run", "start:prod"] CMD ["npm", "run", "start:prod"]
# for production with pm2
# CMD ["pm2-runtime", "ecosystem.json"]
# for testing ssl locally
# CMD npm run ssl-proxy && pm2-runtime ecosystem.json

View file

@ -61,4 +61,52 @@ spec:
httpGet: httpGet:
path: /health path: /health
port: 8000 port: 8000
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
annotations:
name: web-editor-node
namespace: default
spec:
maxReplicas: 6
minReplicas: 1
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: web-editor-node
targetCPUUtilizationPercentage: 80
---
# cronjob for p5.js examples
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: fetch-examples-job
spec:
schedule: "0 0 * * 0"
jobTemplate:
spec:
template:
spec:
containers:
- name: fetch-examples
image: index.docker.io/catarak/p5.js-web-editor:latest
command: ["npm", "run", "fetch-examples:prod"]
restartPolicy: OnFailure
---
# cronjob for generative gestaltung p5.js examples
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: fetch-examples-gg-job
spec:
schedule: "30 0 * * 0"
jobTemplate:
spec:
template:
spec:
containers:
- name: fetch-examples-gg
image: index.docker.io/catarak/p5.js-web-editor:latest
command: ["npm", "run", "fetch-examples-gg:prod"]
restartPolicy: OnFailure