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