Skip to content

Instantly share code, notes, and snippets.

@luebken
Last active November 21, 2016 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save luebken/ee591310af7212abc054e81702e80e83 to your computer and use it in GitHub Desktop.
Save luebken/ee591310af7212abc054e81702e80e83 to your computer and use it in GitHub Desktop.
Getting started with OpenShift

Original Docs

https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

Install

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

# add 172.30.0.0/16 to the insecure registries
$ docker-machine ssh 
$ sudo vi /var/lib/boot2docker/profile
# add --insecure-registry 172.30.0.0/16
$ exit
$ 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 https://github.com/openshift/nodejs-ex
$ cd nodejs-ex/
$ hub fork

$ oc new-app -f openshift/templates/nodejs.json -p NAME=luebken-app,SOURCE_REPOSITORY_URL=git@github.com:luebken/nodejs-ex.git

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

Understanding the template

  • The nodejs template has the following kubernetes objects: Service, Route, ImageStream, BuildConfig, DeploymentConfig
@goern
Copy link

goern commented Sep 7, 2016

what about a echo "oc start-build nodejs-example" >.git/hooks/post-commit after you have clone the git repository? This will eliminate the need to manually start a build, but at the same time it will build on each commit...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment