more config for kubernetes, fix example fetching tasks to include node env

This commit is contained in:
Cassie Tarakajian 2018-08-09 13:58:48 -04:00
parent d53ed3c16b
commit 549d622c6f
6 changed files with 48 additions and 14 deletions

View file

@ -10,8 +10,8 @@ services:
ports: ports:
- '27017:27017' - '27017:27017'
# restart: always # restart: always
# env_file: env_file:
# - "$PWD/.env" - "$PWD/.env"
nginx: nginx:
image: nginx:1.13 image: nginx:1.13
volumes: volumes:
@ -27,8 +27,8 @@ services:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
target: production target: production
# env_file: env_file:
# - "$PWD/.env" - "$PWD/.env"
environment: environment:
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor - MONGO_URL=mongodb://mongo:27017/p5js-web-editor
- MONGO_HOSTNAME=mongo - MONGO_HOSTNAME=mongo

View file

@ -1,5 +1,23 @@
apiVersion: v1 apiVersion: v1
kind: Service
metadata:
name: web-editor-node
labels:
app: web-editor
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
type: LoadBalancer
ports:
- port: 80
targetPort: 8000
selector:
app: web-editor
---
apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata:
name: web-editor-node
spec: spec:
selector: selector:
matchLabels: matchLabels:
@ -7,8 +25,24 @@ spec:
replicas: 1 replicas: 1
template: template:
metadata: metadata:
app: web-editor labels:
app: web-editor
spec: spec:
containers: containers:
- name: web-editor-app - name: web-editor-app
image: image: index.docker.io/catarak/p5.js-web-editor:latest
# temp, just to test kubernetes
# envFrom:
# - configMapRef:
# name: web-editor-env
envFrom:
- secretRef:
name: web-editor-credentials
imagePullPolicy: Always
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 8000

View file

@ -13,10 +13,10 @@
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js", "build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js",
"build:examples": "cross-env NODE_ENV=production webpack --config webpack.config.examples.js", "build:examples": "cross-env NODE_ENV=production webpack --config webpack.config.examples.js",
"test": "npm run lint", "test": "npm run lint",
"fetch-examples": "node ./server/scripts/fetch-examples.js", "fetch-examples": "cross-env NODE_ENV=development node ./server/scripts/fetch-examples.js",
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js", "fetch-examples-gg": "cross-env NODE_ENV=development node ./server/scripts/fetch-examples-gg.js",
"fetch-examples:prod": "node ./dist/fetch-examples.bundle.js", "fetch-examples:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples.bundle.js",
"fetch-examples-gg:prod": "node ./dist/fetch-examples.bundle.js", "fetch-examples-gg:prod": "cross-env NODE_ENV=production node ./dist/fetch-examples.bundle.js",
"ssl-proxy": "local-ssl-proxy --source 443 --target 80 &" "ssl-proxy": "local-ssl-proxy --source 443 --target 80 &"
}, },
"main": "index.js", "main": "index.js",

View file

@ -78,7 +78,7 @@ if (process.env.NODE_ENV === 'production') {
const muo = new URL(`mongodb://${MONGO_HOSTNAME}:${MONGO_PORT}/${MONGO_NAME}`); const muo = new URL(`mongodb://${MONGO_HOSTNAME}:${MONGO_PORT}/${MONGO_NAME}`);
muo.username = MONGO_RW_USERNAME; muo.username = MONGO_RW_USERNAME;
muo.password = MONGO_RW_PASSWORD; muo.password = MONGO_RW_PASSWORD;
mongoConnectionString = `${muo.href}?authSource=admin`; mongoConnectionString = `${muo.href}`;
} else { } else {
mongoConnectionString = process.env.MONGO_URL; mongoConnectionString = process.env.MONGO_URL;
} }

View file

@ -48,7 +48,7 @@ if (process.env.NODE_ENV === 'production') {
const muo = new URL(`mongodb://${MONGO_HOSTNAME}:${MONGO_PORT}/${MONGO_NAME}`); const muo = new URL(`mongodb://${MONGO_HOSTNAME}:${MONGO_PORT}/${MONGO_NAME}`);
muo.username = MONGO_RW_USERNAME; muo.username = MONGO_RW_USERNAME;
muo.password = MONGO_RW_PASSWORD; muo.password = MONGO_RW_PASSWORD;
mongoConnectionString = `${muo.href}?authSource=admin`; mongoConnectionString = `${muo.href}`;
} else { } else {
mongoConnectionString = process.env.MONGO_URL; mongoConnectionString = process.env.MONGO_URL;
} }

View file

@ -57,7 +57,7 @@ if (process.env.NODE_ENV === 'production') {
const muo = new URL(`mongodb://${MONGO_HOSTNAME}:${MONGO_PORT}/${MONGO_NAME}`); const muo = new URL(`mongodb://${MONGO_HOSTNAME}:${MONGO_PORT}/${MONGO_NAME}`);
muo.username = MONGO_RW_USERNAME; muo.username = MONGO_RW_USERNAME;
muo.password = MONGO_RW_PASSWORD; muo.password = MONGO_RW_PASSWORD;
mongoConnectionString = `${muo.href}?authSource=admin`; mongoConnectionString = `${muo.href}`;
} else { } else {
mongoConnectionString = process.env.MONGO_URL; mongoConnectionString = process.env.MONGO_URL;
} }