Skip to content

Instantly share code, notes, and snippets.

@goern
Forked from luebken/openshift.md
Last active September 7, 2016 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goern/5302146d29f885f350af37f6fbe87b86 to your computer and use it in GitHub Desktop.
Save goern/5302146d29f885f350af37f6fbe87b86 to your computer and use it in GitHub Desktop.
Getting started with OpenShift

Install

$ brew update
$ brew install --devel openshift-cli

# add 172.30.0.0/16 to the insecure registries
$ docker-machine ssh 
$ vi /var/lib/boot2docker/profile
# add --insecure-registry 172.30.0.0/16
$ docker-machine restart

$ oc cluster up

$ oc login -u system:admin
$ oc adm policy add-cluster-role-to-user cluster-admin developer

http://stackoverflow.com/a/32810449
https://blog.switchbit.io/openshift-cluster-up-with-docker-for-mac/#ineedmorepower

Create app

$ oc login -u developer
$ oc project myproject

# fork https://github.com/openshift/nodejs-ex
$ git clone git@github.com:luebken/nodejs-ex.git
$ cd nodejs-ex/

$ oc create -f openshift/templates/nodejs.json
$ oc patch template nodejs-example -p '{"objects[3]":spec":{"source":{"type":{"git":{"uri":"https://github.com/luebken/nodejs-ex"}}}}}}'
 :+1: 1  

$ oc new-app nodejs-example

Edit app

# change index.html
$ git add .
$ git commit -m "a commit"
$ git push origin master

# since the local cluster is not reachable from Github we need to start builds manually 
$ oc start-build nodejs-example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment