Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ The simplest way to run OpenShift Origin is in a Docker container:
Once the container is started, you can jump into a console inside the container and run the CLI.

$ docker exec -it openshift-origin bash
$ export KUBECONFIG=/var/lib/openshift/openshift.local.certificates/admin/.kubeconfig
$ osc --help


Expand Down
77 changes: 37 additions & 40 deletions examples/sample-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ At this stage of OpenShift 3 development, there are a few things that you will n

### Docker Changes ###

First, you'll need to configure the docker daemon on your host to trust the docker registry service you'll be starting.
First, you'll need to configure the Docker daemon on your host to trust the Docker registry service you'll be starting.

To do this, you need to add "--insecure-registry 172.30.17.0/24" to the docker daemon invocation, eg:
To do this, you need to add "--insecure-registry 172.30.17.0/24" to the Docker daemon invocation, eg:

$ docker -d --insecure-registry 172.30.17.0/24

Note that you need to have installed Docker 1.3.2 or higher in order to use the `--insecure-registry` flag.

If you are running docker as a service via `systemd`, you can add this argument to the options value in `/etc/sysconfig/docker`
If you are running Docker as a service via `systemd`, you can add this argument to the options value in `/etc/sysconfig/docker`

This will instruct the docker daemon to trust any docker registry on the 172.30.17.0/24 subnet,
This will instruct the Docker daemon to trust any Docker registry on the 172.30.17.0/24 subnet,
rather than requiring the registry to have a verifiable certificate.

These instructions assume you have not changed the kubernetes/openshift service subnet configuration from the default value of 172.30.17.0/24.
Expand All @@ -73,7 +73,7 @@ This section covers how to perform all the steps of building, deploying, and upd
NOTE: All commands assume the `osc` binary/symlink is in your path and
the present working directory is the same directory as this README.

1. *Optional*: Pre-pull the docker images used in this sample. This is
1. *Optional*: Pre-pull the Docker images used in this sample. This is
not strictly necessary as OpenShift will pull the images as it needs them,
but by doing it up front it will prevent lengthy operations during build
and deployment which might otherwise lead you to believe the process
Expand Down Expand Up @@ -104,52 +104,49 @@ 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. 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
$ pushd ../..
$ CERT_DIR=examples/sample-app/openshift.local.certificates/openshift-client hack/install-registry.sh
$ popd
$ openshift ex registry --create --credentials="${KUBECONFIG}"
docker-registry # the service
docker-registry # the deployment config

Note that the private docker registry is using ephemeral storage,
Note that the private Docker registry is using ephemeral storage,
so when it is stopped, the image will be lost. An external volume
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):

$ osc get pods
$ osc describe service docker-registry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to see if the registry is running from just looking at the service? I mean, the service is create instantly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can tell because it returns endpoints, which is the equivalent to listing the pods. (also the curl command still gets run to test it in step 6)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said, it seems odd that describe does not return the ip address of the service itself?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparees the endpoint will exists before the Pod will get running, right? so that is not a 'good' way to check that the registry is started imho

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed on IRC... "no it won't" :) but the describe method should be showing the portalIP for the service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the issues are fixed upstream. The section should tell the user to wait for endpoints.

On Feb 23, 2015, at 8:15 AM, Ben Parees [email protected] wrote:

In examples/sample-app/README.md:

 so when it is stopped, the image will be lost. An external volume
 could be used for persistent storage, but that is beyond the scope
 of this tutorial.
  1. Confirm the registry is started (this can take a few minutes):
  •    $ osc get pods
    
  •    $ osc describe service docker-registry
    
    as discussed on IRC... "no it won't" :) but the describe method should be showing the portalIP for the service.


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed upstream.

On Feb 23, 2015, at 7:57 AM, Ben Parees [email protected] wrote:

In examples/sample-app/README.md:

 so when it is stopped, the image will be lost. An external volume
 could be used for persistent storage, but that is beyond the scope
 of this tutorial.
  1. Confirm the registry is started (this can take a few minutes):
  •    $ osc get pods
    
  •    $ osc describe service docker-registry
    
    that said, it seems odd that describe does not return the ip address of the service itself?


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we eventually want a readiness check here. Then he user will be able to osc wait service docker-registry.

On Feb 23, 2015, at 8:15 AM, Ben Parees [email protected] wrote:

In examples/sample-app/README.md:

 so when it is stopped, the image will be lost. An external volume
 could be used for persistent storage, but that is beyond the scope
 of this tutorial.
  1. Confirm the registry is started (this can take a few minutes):
  •    $ osc get pods
    
  •    $ osc describe service docker-registry
    
    as discussed on IRC... "no it won't" :) but the describe method should be showing the portalIP for the service.


Reply to this email directly or view it on GitHub.


You should see:

Name Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
94679170-54dc-11e4-88cc-3c970e3bf0b7 openshift/docker-registry localhost.localdomain/ deployment=registry-config,name=registrypod,replicationController=946583f6-54dc-11e4-88cc-3c970e3bf0b7 Running
Name: docker-registry
Labels: docker-registry=default
Selector: docker-registry=default
Port: 5000
Endpoints: 172.17.0.60:5000
No events.

6. Confirm the registry service is running. Note that the actual IP address may vary.
If "Endpoints" is listed as <none>, your registry hasn't started yet. You can run `osc get pods` to
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.

$ osc get services
6. Confirm the registry is accessible (you may need to run this more than once):

You should see:

Name Labels Selector IP Port
---------- ---------- ---------- ---------- ----------
docker-registry name=registrypod 172.30.17.3 5001

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

$ curl `osc get services docker-registry -o template --template="{{ .portalIP}}:{{ .port }}"`
$ curl `osc get service docker-registry --template="{{ .portalIP}}:{{ .port }}"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you could use the /proxy/services route, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxy won't be exposed to end users in all likelihood.

----- Original Message -----

- You should see:

  •    Name                Labels              Selector            IP
    
    Port

  •    docker-registry                         name=registrypod
    

    172.30.17.3 5001

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

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

Or you could use the /proxy/services route, right?


Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1100/files#r25167830


You should see:

"docker-registry server (dev) (v0.9.0)"


8. Create a new project in OpenShift. This creates a namespace `test` to contain the builds and app that we will generate below.
7. 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

9. *Optional:* View the OpenShift web console in your browser by browsing to `https://<host>:8444`
8. *Optional:* View the OpenShift web console in your browser by browsing to `https://<host>:8444`

* You will need to have the browser accept the certificate at
`https://<host>:8443` before the console can consult the OpenShift
Expand All @@ -159,7 +156,7 @@ the present working directory is the same directory as this README.
you'll see the page update as you deploy objects into the project
and run builds.

10. *Optional:* Fork the [ruby sample repository](https://github.com/openshift/ruby-hello-world)
9. *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 @@ -172,7 +169,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.

11. *Optional:* Add the following webhook under the settings in your new GitHub repository:
10. *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 @@ -181,12 +178,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.

12. Edit application-template-stibuild.json which will define the sample application
11. 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.

13. Submit the application template for processing (generating shared parameters requested in the template)
12. 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 @@ -205,13 +202,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.

14. Trigger an initial build of your application
* If you setup the GitHub webhook, push a change to app.rb in your ruby sample repository from step 10.
13. 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

15. Monitor the builds and wait for the status to go to "complete" (this can take a few minutes):
14. 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 @@ -241,7 +238,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.

16. Wait for the application's frontend pod and database pods to be started (this can take a few minutes):
15. 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 @@ -252,7 +249,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

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

$ osc get -n test services

Expand All @@ -266,20 +263,20 @@ the present working directory is the same directory as this README.

In this case, the IP for frontend is 172.30.17.4 and it is on port 5432.

*Note:* you can also get this information from the web console if you launched it in step 9.
*Note:* you can also get this information from the web console.

18. 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.
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.

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.

19. Make a change to your ruby sample main.html file, commit, and push it via git.
18. 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


20. Repeat step 15 (waiting for the build to complete). Once the build is complete, refreshing your browser should show your changes.
19. Repeat step 14 (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
8 changes: 1 addition & 7 deletions examples/sample-app/container-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,18 @@ bits that are used in the sample app.
$ wget \
https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/project.json \
-O examples/sample-app/project.json
$ wget \
https://raw.githubusercontent.com/openshift/origin/master/hack/install-registry.sh
$ chmod a+x install-registry.sh

## Configure client security

$ export KUBECONFIG=`pwd`/openshift.local.certificates/admin/.kubeconfig
$ export CURL_CA_BUNDLE=`pwd`/openshift.local.certificates/admin/root.crt
$ chmod +r "$KUBECONFIG"

For more information on this step, see [Application Build, Deploy, and Update
Flow](https://github.com/openshift/origin/blob/master/examples/sample-app/README.md#application-build-deploy-and-update-flow),
step #3.

## Deploy the private docker registry

$ chmod +r ./openshift.local.certificates/openshift-client/key.key
$ CERT_DIR=openshift.local.certificates/openshift-client ./install-registry.sh
$ openshift ex registry --create --credentials="${KUBECONFIG}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not specific export in this doc for KUBECONFIG. I do see it in the referenced doc below (app build/deploy/update step 4) - do you think we need to explicitly add back setting KUBECONFIG in this doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already set inside the docker container.

----- Original Message -----

@@ -76,8 +71,7 @@ step #3.

Deploy the private docker registry

  • $ chmod +r ./openshift.local.certificates/openshift-client/key.key
  • $ CERT_DIR=openshift.local.certificates/openshift-client
    ./install-registry.sh
  • $ openshift ex registry --create --credentials="${KUBECONFIG}"

There's not specific export in this doc for KUBECONFIG. I do see it in
the referenced doc below (app build/deploy/update step 4) - do you think we
need to explicitly add back setting KUBECONFIG in this doc?


Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1100/files#r25168130

$ cd examples/sample-app

For more information on this step, see [Application Build, Deploy, and Update
Expand Down
7 changes: 0 additions & 7 deletions examples/sample-app/updateregistry.sh

This file was deleted.

50 changes: 0 additions & 50 deletions hack/install-registry.sh

This file was deleted.

6 changes: 6 additions & 0 deletions hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,10 @@ openshift ex router --create --credentials="${KUBECONFIG}"
[ "$(openshift ex router | grep 'service exists')" ]
echo "ex router: ok"

[ ! "$(openshift ex registry | grep 'does not exist')"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this fail with some reasonable exit code instead of parsing the output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grep fails with an exit code.

----- Original Message -----

@@ -264,4 +264,10 @@ openshift ex router --create
--credentials="${KUBECONFIG}"
[ "$(openshift ex router | grep 'service exists')" ]
echo "ex router: ok"

+[ ! "$(openshift ex registry | grep 'does not exist')"]

shouldn't this fail with some reasonable exit code instead of parsing the
output?


Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1100/files#r25151005

[ "$(openshift ex registry -o yaml --credentials="${KUBECONFIG}" | grep 'openshift/origin-docker-registry')" ]
openshift ex registry --create --credentials="${KUBECONFIG}"
[ "$(openshift ex registry | grep 'service exists')" ]
echo "ex registry: ok"

osc get minions,pods
Loading