Skip to content

Commit

Permalink
update readme to take advantage of authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Feb 24, 2015
1 parent 1044638 commit 3079d08
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
1 change: 0 additions & 1 deletion examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func TestExampleObjectSchemas(t *testing.T) {
"application-template-stibuild": &templateapi.Template{},
"application-template-dockerbuild": &templateapi.Template{},
"application-template-custombuild": &templateapi.Template{},
"project": &projectapi.Project{},
},
"../examples/jenkins": {
"jenkins-config": &configapi.Config{},
Expand Down
50 changes: 32 additions & 18 deletions examples/sample-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,21 @@ the present working directory is the same directory as this README.
$ export CURL_CA_BUNDLE=`pwd`/openshift.local.certificates/admin/root.crt
$ sudo chmod +r "$KUBECONFIG"

4. Deploy a private Docker registry within OpenShift with the certs necessary for access to master:
4. Bind a user to the `view` role in the default namespace so you can observe progress in the web console

$ openshift ex policy add-user view anypassword:test-admin

5. *Optional:* View the OpenShift web console in your browser by browsing to `https://<host>:8444`. Login using the user `test-admin` and any password.

* You will need to have the browser accept the certificate at
`https://<host>:8443` before the console can consult the OpenShift
API. Of course this would not be necessary with a legitimate
certificate.
* If you click the `default` project and leave the tab open,
you'll see the page update as you deploy objects into the project
and run builds.

6. Deploy a private docker registry within OpenShift with the certs necessary for access to master:

$ sudo chmod +r ./openshift.local.certificates/openshift-client/key.key
$ openshift ex registry --create --credentials="${KUBECONFIG}"
Expand All @@ -116,7 +130,7 @@ the present working directory is the same directory as this README.
could be used for persistent storage, but that is beyond the scope
of this tutorial.

5. Confirm the registry is started (this can take a few minutes):
7. Confirm the registry is started (this can take a few minutes):

$ osc describe service docker-registry

Expand All @@ -133,7 +147,7 @@ the present working directory is the same directory as this README.
see the registry pod and if there are any issues. Once the pod has started, the IP of the pod will
be added to the docker-registry service list so that it's reachable from other places.

6. Confirm the registry is accessible (you may need to run this more than once):
8. Confirm the registry is accessible (you may need to run this more than once):

$ curl `osc get service docker-registry --template="{{ .portalIP}}:{{ .port }}"`

Expand All @@ -142,21 +156,21 @@ the present working directory is the same directory as this README.
"docker-registry server (dev) (v0.9.0)"


7. Create a new project in OpenShift. This creates a namespace `test` to contain the builds and app that we will generate below.
9. Create a new project in OpenShift. This creates a namespace `test` to contain the builds and app that we will generate below.

$ osc create -f project.json
$ openshift ex new-project test --display-name="OpenShift 3 Sample" --description="This is an example project to demonstrate OpenShift v3" --admin=anypassword:test-admin

8. *Optional:* View the OpenShift web console in your browser by browsing to `https://<host>:8444`
10. *Optional:* View the OpenShift web console in your browser by browsing to `https://<host>:8444`. Login using the user `test-admin` and any password.

* You will need to have the browser accept the certificate at
`https://<host>:8443` before the console can consult the OpenShift
API. Of course this would not be necessary with a legitimate
certificate.
* If you click the `Hello OpenShift` project and leave the tab open,
* If you click the `OpenShift 3 Sample` project and leave the tab open,
you'll see the page update as you deploy objects into the project
and run builds.

9. *Optional:* Fork the [ruby sample repository](https://github.com/openshift/ruby-hello-world)
11. *Optional:* Fork the [ruby sample repository](https://github.com/openshift/ruby-hello-world)
to an OpenShift-visible git account that you control, preferably
somewhere that can also reach your OpenShift server with a webhook.
A github.com account is an obvious place for this, but an in-house
Expand All @@ -169,7 +183,7 @@ the present working directory is the same directory as this README.
Without your own fork, you can still run the initial build from
OpenShift's public repository, just not a changed build.

10. *Optional:* Add the following webhook under the settings in your new GitHub repository:
12. *Optional:* Add the following webhook under the settings in your new GitHub repository:

$ https://<host>:8443/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/github?namespace=test

Expand All @@ -178,12 +192,12 @@ the present working directory is the same directory as this README.
will almost certainly need to "Disable SSL Verification" for your test
instance as the certificate chain generated is not publicly verified.

11. Edit application-template-stibuild.json which will define the sample application
13. Edit application-template-stibuild.json which will define the sample application

* Update the BuildConfig's sourceURI (git://github.com/openshift/ruby-hello-world.git) to point to your forked repository.
*Note:* You can skip this step if you did not create a forked repository.

12. Submit the application template for processing (generating shared parameters requested in the template)
14. Submit the application template for processing (generating shared parameters requested in the template)
and then request creation of the processed template:

$ osc process -n test -f application-template-stibuild.json | osc create -n test -f -
Expand All @@ -202,13 +216,13 @@ the present working directory is the same directory as this README.
Note that no build has actually occurred yet, so at this time there
is no image to deploy and no application to visit.

13. Trigger an initial build of your application
15. Trigger an initial build of your application
* If you setup the GitHub webhook, push a change to app.rb in your ruby sample repository.
* Otherwise you can request a new build by running:

$ osc start-build -n test ruby-sample-build

14. Monitor the builds and wait for the status to go to "complete" (this can take a few minutes):
16. Monitor the builds and wait for the status to go to "complete" (this can take a few minutes):

$ osc get -n test builds

Expand Down Expand Up @@ -238,7 +252,7 @@ the present working directory is the same directory as this README.
automatically trigger a deployment of the application, creating a
pod each for the frontend (your Ruby code) and backend.

15. Wait for the application's frontend pod and database pods to be started (this can take a few minutes):
17. Wait for the application's frontend pod and database pods to be started (this can take a few minutes):

$ osc get -n test pods

Expand All @@ -249,7 +263,7 @@ the present working directory is the same directory as this README.
1b978f62-605f-11e4-b0db-3c970e3bf0b7 mysql localhost.localdomain/ deploymentConfig=,deploymentID=database,name=database,replicationController=1b960e56-605f-11e4-b0db-3c970e3bf0b7,template=ruby-helloworld-sample Running
4a792f55-605f-11e4-b0db-3c970e3bf0b7 172.30.17.3:5001/openshift/origin-ruby-sample:9477bdb99a409b9c747e699361ae7934fd83bb4092627e2ee35f9f0b0869885b localhost.localdomain/ deploymentConfig=frontend,deploymentID=frontend-1,name=frontend,replicationController=4a749831-605f-11e4-b0db-3c970e3bf0b7,template=ruby-helloworld-sample Running

16. Determine the IP for the frontend service:
18. Determine the IP for the frontend service:

$ osc get -n test services

Expand All @@ -265,18 +279,18 @@ the present working directory is the same directory as this README.

*Note:* you can also get this information from the web console.

17. Confirm the application is now accessible via the frontend service on port 5432. Go to http://172.30.17.4:5432 (or whatever IP address was reported above) in your browser if you're running this locally; otherwise you can use curl to see the HTML, or port forward the address to your local workstation to visit it.
19. Confirm the application is now accessible via the frontend service on port 5432. Go to http://172.30.17.4:5432 (or whatever IP address was reported above) in your browser if you're running this locally; otherwise you can use curl to see the HTML, or port forward the address to your local workstation to visit it.

You should see a welcome page and a form that allows you to query and update key/value pairs. The keys are stored in the database container running in the database pod.

18. Make a change to your ruby sample main.html file, commit, and push it via git.
20. Make a change to your ruby sample main.html file, commit, and push it via git.

* If you do not have the webhook enabled, you'll have to manually trigger another build:

$ osc start-build -n test ruby-sample-build


19. Repeat step 14 (waiting for the build to complete). Once the build is complete, refreshing your browser should show your changes.
21. Repeat step 16 (waiting for the build to complete). Once the build is complete, refreshing your browser should show your changes.

Congratulations, you've successfully deployed and updated an application on OpenShift.

Expand Down
3 changes: 0 additions & 3 deletions examples/sample-app/container-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ bits that are used in the sample app.
$ wget \
https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json \
-O examples/sample-app/application-template-stibuild.json
$ wget \
https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/project.json \
-O examples/sample-app/project.json

## Configure client security

Expand Down
14 changes: 0 additions & 14 deletions examples/sample-app/project.json

This file was deleted.

0 comments on commit 3079d08

Please sign in to comment.