This page (revision-14) was last changed on 23-Apr-2022 17:06 by Harry Metske

This page was created on 23-Apr-2022 17:06 by Harry Metske

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
14 23-Apr-2022 17:06 15 KB Harry Metske to previous
13 23-Apr-2022 17:06 15 KB Harry Metske to previous | to last
12 23-Apr-2022 17:06 15 KB Harry Metske to previous | to last
11 23-Apr-2022 17:06 15 KB Harry Metske to previous | to last
10 23-Apr-2022 17:06 14 KB Harry Metske to previous | to last
9 23-Apr-2022 17:06 13 KB Harry Metske to previous | to last
8 23-Apr-2022 17:06 11 KB Harry Metske to previous | to last
7 23-Apr-2022 17:06 9 KB Harry Metske to previous | to last
6 23-Apr-2022 17:06 8 KB Harry Metske to previous | to last
5 23-Apr-2022 17:06 7 KB Harry Metske to previous | to last
4 23-Apr-2022 17:06 7 KB Harry Metske to previous | to last
3 23-Apr-2022 17:06 2 KB Harry Metske to previous | to last
2 23-Apr-2022 17:06 1 KB Harry Metske to previous | to last
1 23-Apr-2022 17:06 670 bytes Harry Metske to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 3 removed 2 lines
[{TableOfContents}]
\\
At line 18 changed one line
!! Runnable jar, DIY.
!! Runnable jar.
At line 49 removed 5 lines
==> Yes:
{{{
➜ ~ rhc set-env DROPWIZARD_YAML=src/main/resources/dropwizard.yml --app diy
Setting environment variable(s) ... done
}}}
At line 73 changed one line
!! Download oc/rhc cli
! Download oc cli
At line 177 removed 2 lines
%%
At line 199 removed 54 lines
When specifying all arguments it works:
{{{
➜ ~ rhc setup --server openshift.redhat.com --clean --rhlogin harry.metske@gmail.com --password <your password>
OpenShift Client Tools (RHC) Setup Wizard
This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git are properly installed.
Using harry.metske@gmail.com to login to openshift.redhat.com
OpenShift can create and store a token on disk which allows to you to access the server without using your password. The key is stored in your home directory and should be kept secret. You can delete the key at any time by running 'rhc logout'.
Please enter "yes" or "no".
yes
Generating an authorization token for this client ... lasts about 1 month
Saving configuration to /home/metskem/.openshift/express.conf ... done
Checking for git ... found git version 2.7.4
Checking common problems .. done
Checking for a domain ... computerhok
Checking for applications ... found 1
diy http://diy-computerhok.rhcloud.com/
You are using 1 of 3 total gears
The following gear sizes are available to you: small
Your client tools are now configured.
}}}
!! Developing
Our source code has been copied from the github repo to an internal RedHat repo. The overview page tells use what this RedHat git repo is: __ssh://583f185e2d5271b8c6000069@diy-computerhok.rhcloud.com/~/git/diy.git/__ . %%warning I don't see an option for an https URL %%
So we (locally) add this remote repo : {{git remote add openshift ssh://583f185e2d5271b8c6000069@diy-computerhok.rhcloud.com/~/git/diy.git/}}.
We also have to provide special [Action hooks|https://developers.openshift.com/managing-your-applications/action-hooks.html] because we have to specify how to start our application, and we have to specify the port to listen on (the latter can be solved better/differently I think).
So created 3 additional scripts in our git repo:
* .openshift/action_hooks/build
* .openshift/action_hooks/deploy
* .openshift/action_hooks/start
Containing:
__build__
%%prettify
{{{
#!/bin/bash
gradle assemble
}}}
At line 255 removed 129 lines
__deploy__
%%prettify
{{{
#!/bin/bash
echo "current dir 1: `pwd`"
cd $OPENSHIFT_REPO_DIR
echo "current dir 2: `pwd`"
ls -la
sed -i 's/@OPENSHIFT_DIY_IP@/'"$OPENSHIFT_DIY_IP"'/g' src/main/resources/demoapp1.openshift.yaml
sed -i 's/@OPENSHIFT_DIY_PORT@/'"$OPENSHIFT_DIY_PORT"'/g' src/main/resources/demoapp1.openshift.yaml
}}}
%%
__start__
%%prettify
{{{
#!/bin/bash
cd $OPENSHIFT_REPO_DIR
export DROPWIZARD_YAML=src/main/resources/demoapp1.openshift.yaml
nohup java -jar build/libs/demoapp1-0.1.0.jar > ${OPENSHIFT_DIY_LOG_DIR}/demoapp1.log 2>&1 &
}}}
%%
Then when we git push (1), this was before we had the bulid script :
{{{
➜ demoapp1 git:(master) ✗ git push openshift master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 474 bytes | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Stopping DIY cartridge
remote: Building git ref 'master', commit cfb642e
remote: Preparing build for deployment
remote: Deployment id is fcb8b14e
remote: Activating deployment
remote: Starting DIY cartridge
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://583f185e2d5271b8c6000069@diy-computerhok.rhcloud.com/~/git/diy.git/
4c0c10b..cfb642e master -> master
}}}
It tells us all success, but the app still fails (503 response). How to diagnose further, the UI does not show anything about status or logs. Let's try the ssh again.
Then we added the build hook script and pushed again:
{{{
➜ demoapp1 git:(master) ✗ git push openshift master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 497 bytes | 0 bytes/s, done.
Total 6 (delta 2), reused 0 (delta 0)
remote: Stopping DIY cartridge
remote: Building git ref 'master', commit 1ec49f3
remote: /var/lib/openshift/583f185e2d5271b8c6000069/app-root/runtime/repo/.openshift/action_hooks/build: line 2: gradle: command not found
remote: An error occurred executing 'gear postreceive' (exit code: 127)
remote: Error message: CLIENT_ERROR: Failed to execute action hook 'build' for 583f185e2d5271b8c6000069 application diy
remote:
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://583f185e2d5271b8c6000069@diy-computerhok.rhcloud.com/~/git/diy.git/
13bd4bc..1ec49f3 master -> master
}}}
There is no gradle available (only mvn. And which version:
{{{
[diy-computerhok.rhcloud.com 583f185e2d5271b8c6000069]\> mvn --version
Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.121/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-642.6.2.el6.x86_64", arch: "i386", family: "unix"
}}}
%%warning This is going nowhere.... we need something with containers%%
!! Running containers
The idea is to just a container from an image, and that envvars should determine which jar file to run.
....created subimage from ......
pushed to internal docker registry
Fire up with oc:
{{{
[2016-12-01 13:11.32] /drives/g/tools
[metskeh.RB904184] ➤ ./oc new-app docker-registry.linux.rabobank.nl/online.io/javarunner:0.1 --env JARFILE_URL="http://lsrv4008.linux.rabobank.nl/artifacts/dropwizardtest-1.4/dropwizardtest-1.4.jar"
--> Found Docker image be874f9 (2 hours old) from docker-registry.linux.rabobank.nl for "docker-registry.linux.rabobank.nl/online.io/javarunner:0.1"
* An image stream will be created as "javarunner:0.1" that will track this image
* This image will be deployed in deployment config "javarunner"
* [WARNING] Image "javarunner" runs as the 'root' user which may not be permitted by your cluster administrator
* The image does not expose any ports - if you want to load balance or send traffic to this component
you will need to create a service with 'expose dc/javarunner --port=[port]' later
--> Creating resources with label app=javarunner ...
ImageStream "javarunner" created
DeploymentConfig "javarunner" created
--> Success
Run 'oc status' to view your app.
}}}
Why does it take so long on my Rabo laptop on E2B (VDI is much faster):
{{{
[MetskeH.RB344164] ➤ time ./oc status -v
In project testproject (demoapp1) on server https://ose-master-api.linux.rabobank.nl:8443
svc/javarunner - 192.168.215.67:8080
dc/javarunner deploys imagestreamtag/javarunner:0.2
#1 deployed 19 hours ago - 1 pod
Warnings:
* container "javarunner" in pod/javarunner-1-s8ylj has restarted 234 times
* The image trigger for dc/javarunner will have no effect until imagestreamtag/javarunner:0.2 is imported or created by a build.
View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.
real 0m 37.28s
user 0m 0.01s
sys 0m 0.01s
}}}
At line 193 added one line
[{ALLOW edit metskem}]