From b5a32d79fae7595bd991221181de300b45ee677f Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 28 Aug 2018 14:47:05 -0400 Subject: [PATCH] update kubernetes config to include cronjobs to fetch examples --- Dockerfile | 10 +--------- kubernetes/app.yml | 50 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9460983d..9ac483dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,13 +24,5 @@ ENV NODE_ENV=production COPY package.json package-lock.json index.js ./ RUN npm install --production RUN npm rebuild node-sass -# RUN npm install pm2 -g -# RUN npm install local-ssl-proxy -# COPY index.js ecosystem.json ./ -COPY --from=build /usr/src/app/dist ./dist -# for reg production +COPY --from=build $APP_HOME/dist ./dist 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 diff --git a/kubernetes/app.yml b/kubernetes/app.yml index 3444e2fc..7e523f6c 100644 --- a/kubernetes/app.yml +++ b/kubernetes/app.yml @@ -61,4 +61,52 @@ spec: httpGet: path: /health 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