<commit_before>= Openshift Examples - Crunchy Containers
Crunchy Data Solutions, Inc.
v1.2.8, {docdate}
:title-logo-image: image:crunchy_logo.png["CrunchyData Logo",align="center",scaledwidth="80%"]

== Examples for the Openshift Environment
The examples/openshift directory containers examples for 
running the Crunchy containers in an Openshift environment.

The examples are explained below.

Some of the examples make use of NFS for a persistent volume
file system type, see the NFS Note at the bottom of this document
for details on how NFS is configured in these examples.  

Notes on NFS installation and file system permissions are in the install.asciidoc documentation.

For running the examples that require persistent volumes, you
will need to run the following script:
....
cd $BUILDBASE/examples/openshift
./create-pv.sh
./create-pvc.sh
....

If you are wanting to run the examples on a minishift instance
you will need to create the PVs using hostPath as follows:
....
oc login -u system:admin
./create-pv.sh hostpath
oc login -u developer
./create-pvc.sh
....

Additional steps are required to allow persistence to work
on minishift including:
....
oc login -u system:admin
oc edit scc restricted
....

Above, you will change runAsUser.Type strategy to RunAsAny.

On the boot2docker instance running minishift, you will need
to set the host path permissions as follows:
....
chmod 777 /mnt/sda1/data
....




=== *basic* - Running a single database container

This openshift template will create a single master PostgreSQL instance.


Running the example:

....
cd examples/openshift/basic
./run.sh
....

You can see what passwords were generated by running this command:

....
oc describe pod basic | grep PG
....

You can run the following command to test the database, entering
the value of PG_PASSWORD from above for the password when prompted:

....<commit_msg>update docs to mention NAMESPACE env var<commit_after>= Openshift Examples - Crunchy Containers
Crunchy Data Solutions, Inc.
v1.2.8, {docdate}
:title-logo-image: image:crunchy_logo.png["CrunchyData Logo",align="center",scaledwidth="80%"]

== Examples for the Openshift Environment
The examples/openshift directory containers examples for 
running the Crunchy containers in an Openshift environment.

The examples are explained below.

Some of the examples make use of NFS for a persistent volume
file system type, see the NFS Note at the bottom of this document
for details on how NFS is configured in these examples.  

Notes on NFS installation and file system permissions are in the install.asciidoc documentation.

For running the examples that require persistent volumes, you
will need to run the following script:
....
cd $BUILDBASE/examples/openshift
./create-pv.sh
./create-pvc.sh
....

If you are wanting to run the examples on a minishift instance
you will need to create the PVs using hostPath as follows:
....
oc login -u system:admin
./create-pv.sh hostpath
oc login -u developer
./create-pvc.sh
....

Additional steps are required to allow persistence to work
on minishift including:
....
oc login -u system:admin
oc edit scc restricted
....

Above, you will change runAsUser.Type strategy to RunAsAny.

On the boot2docker instance running minishift, you will need
to set the host path permissions as follows:
....
chmod 777 /mnt/sda1/data
....


The NAMESPACE environment variable is set to indicate which Openshift
project you want various example objects to use.  This variable
is set to *default* within the *examples/envvars.sh* script.  Set this
to match your project configuration.

=== *basic* - Running a single database container

This openshift template will create a single master PostgreSQL instance.


Running the example:

....
cd examples/openshift/basic
./run.sh
....

You can see what passwords were generated by running this command:

....
oc describe pod basic | grep PG
....

You can run the following command to test the database, entering
the value of PG_PASSWORD from above for the password when prompted:

....
{'fraction_non_alphanumeric': 0.07419354838709677, 'fraction_numerical': 0.004962779156327543, 'mean_word_length': 3.891990291262136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1424030', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1092, 'n_words': 539}