Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s2i-liberty #4

Merged
merged 42 commits into from
Oct 14, 2016
Merged

s2i-liberty #4

merged 42 commits into from
Oct 14, 2016

Conversation

raffaelespazzoli
Copy link
Contributor

No description provided.

# This image provides a base for building and running WildFly applications.
# It builds using maven and runs the resulting artifacts on WildFly 10.1.0 Final

FROM websphere-liberty:webProfile7
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this using a red hat based base or debian?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the builder image can be any. The runtime image is created by IBM based on debian. I changed the user to our standard 1001. I think we want to keep the IBM's provided image as our base image because it increases the chances for our customers that IBM will support it.

Copy link
Contributor

@etsauer etsauer left a comment

Choose a reason for hiding this comment

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

Overall this looks really nice. Just recommending a few changes to the Documentation.

@sabre1041 please review as well.


### Environment Specifications

This demo should be run on an installation of OpenShift Enterprise V3.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's change "OpenShift Enterprise" to "OpenShift Container Platform" as that's the official name as of 3.3


## Setup Instructions

There is no specific requirements necessary for this demonstration. The presenter should have an OpenShift Enterprise 3.3 environment available with access to the public Internet and the OpenShift Command Line Tools installed on their machine.
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, "OpenShift Container Platform"

oc login <OpenShift_Master_API_Address>
```

Create a new project called *play-demo*
Copy link
Contributor

Choose a reason for hiding this comment

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

switch "play-demo" for "liberty-demo"

The content used to produce the Liberty runtime image can originate from a Git repository. Execute the following command to start a new image build using the git source strategy.:

```
oc new-build websphere-liberty:webProfile7~https://github.com/raffaelespazzoli/containers-quickstarts --context-dir=s2i-liberty --name=liberty-runtime-s2i --strategy=docker
Copy link
Contributor

Choose a reason for hiding this comment

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

let's change the git repo name to https://github.com/redhat-cop/containers-quickstarts


In this example we will use a pre-existing builder image that can build maven based apps: `registry.access.redhat.com/jboss-eap-7/eap70-openshift`

#### Git Source
Copy link
Contributor

Choose a reason for hiding this comment

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

So this heading to me implies "Hey let's build an app from source using our liberty base image", which in actuality, this is the step to docker build the base image in OpenShift. I think we should change this heading to "Building the S2I Base Image", and then have a separate "Build from Git" heading that shows the oc new-app command pointing to an application git repo, in addition to the "Binary Build" steps below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't get this comment. can we talk about it? I applied the other feedback

Copy link
Contributor

Choose a reason for hiding this comment

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

We can disregard this comment

Copy link
Contributor

@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

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

Reviewed README only. Added some comments to the README. Also recommend changing the name of the file to the capitalize README to conform with conventions.

Looks good otherwise. Only suggestion is a validation step to demonstrate the application was successfully deployed (hit a web page etc)


OpenShift provides several out of the box Source to Image builder images. To support deployments in Liberty, a new s2i builder image will be created to support a simplified deployment to OpenShift. Once the new image is produced, an example application will be deployed.

We will use the [extended builds approach](https://docs.openshift.org/latest/dev_guide/builds.html#extended-builds).
Copy link
Contributor

Choose a reason for hiding this comment

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

- sourcePath: /opt/eap/standalone/deployments/hello-world-war-1.0.0.war
destinationDir: artifacts
```
notice that the source strategy has two additional sections:
Copy link
Contributor

@sabre1041 sabre1041 Oct 6, 2016

Choose a reason for hiding this comment

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

Can we provide this modifications as a patch command that users can easily apply?


### Create a new Application

To demonstrate the usage of the newly created builder and runtime images, a Jee example application will be built and deployed to Liberty using the Source to Image process.
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalize JEE

The build that was triggered by the `new-app` command can be found by executing the following command:

```
oc get builds -l=app=play-app
Copy link
Contributor

@sabre1041 sabre1041 Oct 6, 2016

Choose a reason for hiding this comment

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

Change to hello-world assuming that is the correct label


* `oc new-app` - OpenShift command to create a a new application
* `-i=hello-world` - Name of the ImageStream that contains the result of the build config that uses the extended s2i process
* `--name=play-app` - Name to be applied to the newly created resources
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to hello-world


## Considerations on http session failover

When liberty is deployed in a cloud environment certain limitation applies as explained in this [document](http://www.ibm.com/support/knowledgecenter/en/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/cwlp_paas_restrict.html).
Copy link
Contributor

Choose a reason for hiding this comment

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

Sentence needs to be cleaned up. "When liberty is deployed in a cloud environment, there are certain limitations that apply as explained in this document"

@etsauer
Copy link
Contributor

etsauer commented Oct 8, 2016

@raffaelespazzoli this looks much better. However, after I run the oc new-app to create the deployment, the pod gets stuck in a CrashLoop with the following error:

[esauer@localhost containers-quickstarts]$ oc get pods
NAME                            READY     STATUS             RESTARTS   AGE
hello-world-1-build             0/1       Completed          0          14h
hello-world-1-mih0g             0/1       CrashLoopBackOff   2          14h
hello-world-artifacts-1-build   0/1       Completed          0          14h
s2i-liberty-1-build             0/1       Completed          0          14h
[esauer@localhost containers-quickstarts]$ oc logs -f hello-world-1-mih0g
JVMSHRC155E Error copying username into cache name
JVMSHRC686I Failed to startup shared class cache. Continue without using it as -Xshareclasses:nonfatal is specified
CWWKE0005E: The runtime environment could not be launched.
CWWKE0044E: There is no write permission for server directory /opt/ibm/wlp/output/defaultServer

@raffaelespazzoli
Copy link
Contributor Author

@etsauer I tried to reproduce the error, but it works fine with me. Which approach are you trying? Also can you make sure you start from a clean project?

@sabre1041
Copy link
Contributor

@raffaelespazzoli The issue is most likely caused by the relaxed permissions of the Red Hat CDK. By default, all containers are run with the anyuid scc. When I ran through the steps in the PR using the baseline CDK configuration, I was able to launch the container successfully (as it was running with the anyuid scc). When I removed that privilege, with the following command, I hit the same error as @etsauer

oc adm policy remove-scc-from-group anyuid system:authenticated

@etsauer
Copy link
Contributor

etsauer commented Oct 10, 2016

@sabre1041 what would cause that? the dockerfile uses USER 1001 which should get a proper uuid right?

@sabre1041
Copy link
Contributor

@etsauer no. by default in non-CDK installations, a user is randomly assigned from a range and the UID in the dockerfile is ignored as governed by the restricted scc. In the CDK, all authenticated users are given access to the anyuid scc.

@raffaelespazzoli
Copy link
Contributor Author

I added some instructions to the docker file which should fix the issue.
The image still works for me but I don't have an easily accessible OCP (I'm working on it).
@etsauer do you mind retesting it?

@sabre1041
Copy link
Contributor

@raffaelespazzoli validated latest updates allow container to start up successfully.

README needs to add instructions on how to view the sample application. This requires the service to be exposed and in particular, the correct port (default is 7777, but application is available on 9080). In addition, application is available at /hello-world-war-1.0.0 instead of /

@raffaelespazzoli
Copy link
Contributor Author

@sabre1041 thanks, I addressed the port issue and added instructions on how to verify the application.
I didn't change the context root of the application as that would require a change in the application code which I don't own.

@sabre1041
Copy link
Contributor

@raffaelespazzoli this looks great. Would you be able to squash all of the commits? Then we should be good to merge

@sabre1041
Copy link
Contributor

@etsauer you will need to approve changes before we will eventually be able to merge

@sabre1041 sabre1041 merged commit d3247b2 into redhat-cop:master Oct 14, 2016
pcarney8 pushed a commit to pcarney8/containers-quickstarts that referenced this pull request Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants