Skip to content

Facebook Parse MBaaS on Openshift

Chakradhar Rao Jonagam edited this page May 3, 2016 · 30 revisions

Assuming you already have openshift setup.
This tutorial assumes you have enabled privileged containers on openshift. Check this page to enable https://github.com/debianmaster/Notes/wiki/Enabling-privileged-containers-on-Openshift

Initial setup

To setup openshift on your laptop using a Vagrant image use https://www.openshift.org/vm/ Assuming you have openshift installed on https://10.2.2.2:8443 and with dns name 10.2.2.2.xip.io

export OPENSHIFT_DOMAIN='parse.apps.10.2.2.2.xip.io'  # where parse is project name and apps.10.2.2.2.xip.io is openshift domain 
export MONGODB_USER='mongouser'
export MONGODB_PASSWORD='password'
export MONGODB_DATABASE='sampledb'

Setup mongodb

oc new-app -e MONGODB_USER=${MONGODB_USER},\
MONGODB_PASSWORD=${MONGODB_PASSWORD},\
MONGODB_DATABASE=${MONGODB_DATABASE},\
MONGODB_ADMIN_PASSWORD=${MONGODB_PASSWORD} \
registry.access.redhat.com/rhscl/mongodb-26-rhel7 --name mongodb
Get mongodb cluster ip address and update MONGO_URL environment variable
export MONGODB_HOST=`oc get svc | grep mongodb | awk '{print $2}'`
export MONGO_URL="mongodb://${MONGODB_USER}:${MONGODB_PASSWORD}@${MONGODB_HOST}/${MONGODB_DATABASE}"

Setup Parse-Server (api)

oc new-app  \
-e PARSE_SERVER_MASTER_KEY=myMasterKey,\
DATABASE_URI="${MONGO_URL}",\
PORT=8080,\
PARSE_SERVER_URL="http://cloud-server-${OPENSHIFT_DOMAIN}/parse",\
APP_ID=myAppId,\
MASTER_KEY=myMasterKey \
https://github.com/debianmaster/parse-server-example.git  \
--strategy=docker --name='cloud-server'

Setup Parse Dashboard

oc new-app  https://github.com/debianmaster/parse-dashboard.git \
--strategy=docker --name='dash' \
-e PORT=8080,\
APP_ID=myAppId,\
MASTER_KEY=myMasterKey,\
PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1,\
PARSE_DASHBOARD_USER_ID=admin,\
PARSE_DASHBOARD_USER_PASSWORD=admin,\
PARSE_DASHBOARD_SERVER_URL="http://cloud-server-${OPENSHIFT_DOMAIN}/parse",\
PARSE_DASHBOARD_MASTER_KEY=myMasterKey,\
PARSE_DASHBOARD_APP_ID=myAppId

Expose service and route in openshift

oc expose dc/dash --port=8080  #expose dashboard deployment config
oc expose svc/dash #expose dashboard service as route
oc expose svc/cloud-server  #expose parse server api service as a route

Testing

visit http://dash-parse.apps.10.2.2.2.xip.io/ with credentials admin/admin to see your apps

Clone this wiki locally