Skip to content

Commit

Permalink
Update README and fix parameter typo
Browse files Browse the repository at this point in the history
  • Loading branch information
themoosman committed Mar 25, 2019
1 parent 0adaf25 commit 3d3dded
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 110 deletions.
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,27 @@

This repository provides a sample Python web application implemented using the Flask web framework and hosted using ``gunicorn``. It is intended to be used to demonstrate deployment of Python web applications to OpenShift 3.

Modified to for readness probe demo, original code from: https://github.com/OpenShiftDemos/os-sample-python
Original code from: https://github.com/OpenShiftDemos/os-sample-python

## Implementation Notes
## Modifications

This sample Python application relies on the support provided by the default S2I builder for deploying a WSGI application using the ``gunicorn`` WSGI server. The requirements which need to be satisfied for this to work are:
This sample has been modified to be a sample Python application with Kubernetes Liveness and Redness probes.

* The WSGI application code file needs to be named ``app.py``.
* The WSGI application entry point within the code file needs to be named ``application``.
* The ``gunicorn`` package must be listed in the ``requirements.txt`` file for ``pip``.

In addition, the ``.s2i/environment`` file has been created to allow environment variables to be set to override the behaviour of the default S2I builder for Python.

* The environment variable ``APP_CONFIG`` has been set to declare the name of the config file for ``gunicorn``.

## Deployment Steps

To deploy this sample Python web application from the OpenShift web console, you should select ``python:2.7``, ``python:3.3``, ``python:3.4`` or ``python:latest``, when using _Add to project_. Use of ``python:latest`` is the same as having selected the most up to date Python version available, which at this time is ``python:3.4``.

The HTTPS URL of this code repository which should be supplied to the _Git Repository URL_ field when using _Add to project_ is:
To deploy this sample Python web application from the OpenShift use the provided template.

* https://github.com/OpenShiftDemos/os-sample-python.git
Template parameters can be found here. https://github.com/themoosman/ocp-python-crash-me/blob/master/ocp/application-template.yaml#L178-L203

If using the ``oc`` command line tool instead of the OpenShift web console, to deploy this sample Python web application, you can run:

```
oc new-app https://github.com/OpenShiftDemos/os-sample-python.git
```
oc new-project ocp-demo
In this case, because no language type was specified, OpenShift will determine the language by inspecting the code repository. Because the code repository contains a ``requirements.txt``, it will subsequently be interpreted as including a Python application. When such automatic detection is used, ``python:latest`` will be used.
#To deploy the template using the defaults.
oc process -f application-template.yaml | oc create -f -
If needing to select a specific Python version when using ``oc new-app``, you should instead use the form:
#Add any necessary `-p` arguments to the command below
#For example to override the default namespace and Red Hat repository.
oc process -f application-template.yaml -p NAMESPACE=my-demo -p EXTERNAL_IMAGE_REPO_URL=registry.example.com:5000 | oc create -f -
```
oc new-app python:2.7~https://github.com/OpenShiftDemos/os-sample-python.git
```
86 changes: 0 additions & 86 deletions dc1.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions ocp/application-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
annotations:
description: Build Config for a sample Python application.
labels:
name: slack-bot-ngrok
name: python-crash-me-template
objects:
- apiVersion: v1
kind: ImageStream
Expand Down Expand Up @@ -177,7 +177,7 @@ objects:

parameters:
- name: GIT_URI
description: The ngrok Git URI.
description: The Git URI.
value: "https://github.com/themoosman/ocp-python-crash-me.git"
required: true
- name: GIT_REF
Expand Down

0 comments on commit 3d3dded

Please sign in to comment.