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

View File

@ -1,5 +1,23 @@
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
metadata:
name: web-editor-node
spec:
selector:
matchLabels:
@ -7,8 +25,24 @@ spec:
replicas: 1
template:
metadata:
app: web-editor
labels:
app: web-editor
spec:
containers:
- name: web-editor-app
image:
- name: web-editor-app
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:examples": "cross-env NODE_ENV=production webpack --config webpack.config.examples.js",
"test": "npm run lint",
"fetch-examples": "node ./server/scripts/fetch-examples.js",
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js",
"fetch-examples:prod": "node ./dist/fetch-examples.bundle.js",
"fetch-examples-gg:prod": "node ./dist/fetch-examples.bundle.js",
"fetch-examples": "cross-env NODE_ENV=development node ./server/scripts/fetch-examples.js",
"fetch-examples-gg": "cross-env NODE_ENV=development node ./server/scripts/fetch-examples-gg.js",
"fetch-examples:prod": "cross-env NODE_ENV=production 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 &"
},
"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}`);
muo.username = MONGO_RW_USERNAME;
muo.password = MONGO_RW_PASSWORD;
mongoConnectionString = `${muo.href}?authSource=admin`;
mongoConnectionString = `${muo.href}`;
} else {
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}`);
muo.username = MONGO_RW_USERNAME;
muo.password = MONGO_RW_PASSWORD;
mongoConnectionString = `${muo.href}?authSource=admin`;
mongoConnectionString = `${muo.href}`;
} else {
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}`);
muo.username = MONGO_RW_USERNAME;
muo.password = MONGO_RW_PASSWORD;
mongoConnectionString = `${muo.href}?authSource=admin`;
mongoConnectionString = `${muo.href}`;
} else {
mongoConnectionString = process.env.MONGO_URL;
}