Re: few basic questions about S2I and docker run

2016-09-12 Thread Ravi Kapoor
Hi Ben,

I am finally able to run my nodejs code on openshift with both approaches
(volume mount as well as S2I)
I was also able to resolve most of other issues I mentioned and was able to
run JEE application as well.

Thanks a lot for helping me through all the silly questions.
Good news is that now my company will be using openshift to manage our
dockers/deployments.

regards


On Sat, Sep 10, 2016 at 8:23 AM, Ben Parees  wrote:

> you can define a command on the container within the pod:
> http://kubernetes.io/docs/user-guide/configuring-containers/#launching-a-
> container-using-a-configuration-file
>
>
> On Fri, Sep 9, 2016 at 5:21 PM, Ravi  wrote:
>
>>
>> Thank you for this help.
>>
>> I was trying nginx because after invoking container, I do not have to run
>> a command. For java or node, after the container is run I will need to run
>> a command e.g.
>>
>> java -jar myapp.jar
>> OR
>> node server.js
>>
>> Can you guide me how to add this to the json file or point me to
>> documentation so I can try this?
>>
>> thanks so much
>>
>>
>> On 9/8/2016 6:56 PM, Ben Parees wrote:
>>
>>> Downloads$ oc get pods
>>> NAME READY STATUSRESTARTS   AGE
>>> nginx-1-deploy   1/1   Running   0  14s
>>> nginx-1-rmfl90/1   Error 0  11s
>>>
>>> Downloads$ oc logs nginx-1-rmfl9
>>> 2016/09/09 01:54:21 [warn] 1#1: the "user" directive makes sense only if
>>> the master process runs with super-user privileges, ignored in
>>> /etc/nginx/nginx.conf:2
>>> nginx: [warn] the "user" directive makes sense only if the master
>>> process runs with super-user privileges, ignored in
>>> /etc/nginx/nginx.conf:2
>>> 2016/09/09 01:54:21 [emerg] 1#1: mkdir() "/var/cache/nginx/client_temp"
>>> failed (13: Permission denied)
>>> nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (13:
>>> Permission denied)
>>>
>>>
>>> the nginx image probably only works when run as root or as some other
>>> specific user.  when images are run in openshift, by default they are
>>> assigned a random uid for security purposes.  that can cause issues with
>>> images that expect to run as a specific user.  please see our
>>> documentation:
>>>
>>> https://docs.openshift.org/latest/creating_images/guidelines
>>> .html#openshift-origin-specific-guidelines
>>> (section on support arbitrary uids)
>>>
>>> to relax the restriction, see:
>>> https://docs.openshift.org/latest/admin_guide/manage_scc.htm
>>> l#enable-images-to-run-with-user-in-the-dockerfile
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Sep 8, 2016 at 9:50 PM, Ravi >> > wrote:
>>>
>>>
>>> oh, forgot to add, I do not have any readiness probe.
>>>
>>> On 9/8/2016 6:47 PM, Ravi Kapoor wrote:
>>>
>>> I removed volumes, pod still failed. json and logs attached
>>>
>>>
>>>
>>> On Thu, Sep 8, 2016 at 6:35 PM, Ben Parees >> 
>>> >> wrote:
>>>
>>> though i don't see it in your json it sounds like you have a
>>> readiness probe defined on your pod and it's not being met
>>> successfully.
>>>
>>> the other possibility is it has to do w/ your mounts.  can
>>> you
>>> temporarily remove the volume mounts and see if the pod
>>> comes up?
>>>
>>>
>>> On Thu, Sep 8, 2016 at 8:33 PM, Ravi Kapoor
>>> 
>>> >> >> wrote:
>>>
>>> Pod deployment failed. error in console log is
>>>
>>> --> Scaling nginx-1 to 1
>>> --> Waiting up to 10m0s for pods in deployment nginx-1
>>> to become
>>> ready
>>> error: update acceptor rejected nginx-1: pods for
>>> deployment
>>> "nginx-1" took longer than 600 seconds to become ready
>>>
>>>
>>>
>>> *$ oc describe pods*
>>> Name:   nginx-1-deploy
>>> Namespace:  test
>>> Security Policy:restricted
>>> Node:   172.27.104.71/172.27.104.71
>>> 
>>> >> >
>>> Start Time: Thu, 08 Sep 2016 17:30:29 -0400
>>> Labels:
>>> openshift.io/deployer-pod-for.name=nginx-1
>>> 
>>> >> >
>>> Status: Failed
>>> IP: 172.17.0.2

Re: open shift env variables with slash characters

2016-09-12 Thread Julio Saura
ok seems solved

i had to put export for each env variable java did not recognize on 
/etc/profile file in the docker OS..

i did put that on my entry point script before starting jboss process and solved

thanks all!

best regards
> El 12 sept 2016, a las 12:14, Julio Saura  escribió:
> 
> for example
> 
> in the docker shell
> 
> root@apis-rc-y7pox:/# echo $AUTH_SQL_URL
> jdbc:oracle:thin:@bbdd:1521/sid
> 
> but on java when i recover that value is empty so  i get a null pointer 
> exception.
> 
> 
>> El 12 sept 2016, a las 12:04, Julio Saura > > escribió:
>> 
>> hello, no i don’t use official jboss images..
>> 
>> i use a custom image build by me ..
>> 
>> on my dockerfile there is nothing related to env variables ..  is on my 
>> entry point script where i read em and do some substitutions in jboss config 
>> files before launching jboss process  .. that part works ok
>> 
>> but after that reading them from our java app does not work , their value is 
>> null, .. and starting that same docker image in a docker standalone engine , 
>> and passing the same variables, works ok ..
>> 
>> my docker file is simple
>> 
>> FROM debian
>> 
>> RUN apt-get update -y
>> RUN apt-get install -y vim
>> RUN apt-get install -y sudo
>> USER root
>> COPY jboss.tar.gz / ( custom jboss tar.gz )
>> COPY jboss-as.conf /etc/init.d
>> COPY jboss-as /etc/init.d
>> RUN useradd -ms /bin/bash jbossadmin
>> RUN chmod +x /etc/init.d/jboss-as && chown jbossadmin: /etc/init.d/jboss-as
>> RUN cd / && tar xvfz jboss.tar.gz && rm jboss.tar.gz && chown -R jbossadmin: 
>> /opt
>> RUN /opt/jboss/jboss-as/bin/add-user.sh admin Developer#2015 --silent
>> 
>> EXPOSE 8080 
>> 
>> ENTRYPOINT ["/etc/init.d/jboss-as", "start”]
>> 
>> 
>> and in my entry point script i just do some replaces before starting jboss.
>> 
>> for example ( i have ASYNC_POOL word in the value entry of the xml inside 
>> the jboss.tar.gz i use,  so it get replaced ok )
>> 
>> sed -i -e 's/ASYNC_POOL/'"$ASYNC_POOL"'/g' 
>> /opt/jboss/jboss-as/standalone/configuration/standalone.xml
>> 
>> 
>> and in my RC i set it as follows :
>> 
>>"env": [
>>  {
>>"name”:"ASYNC_POOL",
>>"value”:"300"
>>  },
>> 
>> etc etc
>> 
>> that works like a charm, but all this variables are NULL when recovering 
>> them from my java app.
>> 
>> 
>> best regards
>> 
>> 
>>> El 12 sept 2016, a las 11:37, Aleksandar Kostadinov >> > escribió:
>>> 
>>> Do you use official Wildfly/JBossEAP images for OpenShift? OpenShift does 
>>> not run containers as root by default (this is the reason most standard 
>>> docker images need extra configuration to run on OpenShift).
>>> 
>>> To check why env vars are not visible, I think you'd need to post your 
>>> dockerfile somewhere.
>>> 
>>> Julio Saura wrote on 09/12/16 12:11:
 hello
 
 i have just started the process as root inside the docker just to be
 sure that  was the problem ,but still the same issue
 
 java process running inside jboss is not reading variable values but
 when connected to the docker shell , echoing them shows the values
 properly ..
 
 what i am doing wrong? shell processes are able to read values but app
 inside jboss no..
 
 best regards
 
 thanks again.
 
 
> El 12 sept 2016, a las 11:04, Julio Saura  
> >> escribió:
> 
> do i need to do something to make the env variables i pass on son when
> creating the RC to all users? or shall i do it manually dumping them
> into /etc/profile or user bash_profile file prior launching jboss?
> 
> thanks
> 
>> El 12 sept 2016, a las 10:45, Julio Saura > 
>> >> escribió:
>> 
>> hi
>> 
>> we have found the problem
>> 
>> the process inside the docker is launched with sudo to a non
>> privileged user por starting the jboss server  , don’t want the
>> process to be launched as root.
>> 
>> env variables are only available for the root user of the docker, not
>> for the user that launches jboss process, and so code finds em as null
>> 
>> Best regards
>> 
>> 
>> 
>> 
>>> El 9 sept 2016, a las 17:49, Julio Saura >> 
>>> >> escribió:
>>> 
 
 El 9 sept 2016, a las 17:47, Aleksandar Kostadinov
  
 >> escribió:
 
 Julio Saura wrote on 09/09/16 18:41:
> 
>> El 9 sept 2016, a las 17:39, 

Re: open shift env variables with slash characters

2016-09-12 Thread Aleksandar Kostadinov
Do you use official Wildfly/JBossEAP images for OpenShift? OpenShift 
does not run containers as root by default (this is the reason most 
standard docker images need extra configuration to run on OpenShift).


To check why env vars are not visible, I think you'd need to post your 
dockerfile somewhere.


Julio Saura wrote on 09/12/16 12:11:

hello

i have just started the process as root inside the docker just to be
sure that  was the problem ,but still the same issue

java process running inside jboss is not reading variable values but
when connected to the docker shell , echoing them shows the values
properly ..

what i am doing wrong? shell processes are able to read values but app
inside jboss no..

best regards

thanks again.



El 12 sept 2016, a las 11:04, Julio Saura > escribió:

do i need to do something to make the env variables i pass on son when
creating the RC to all users? or shall i do it manually dumping them
into /etc/profile or user bash_profile file prior launching jboss?

thanks


El 12 sept 2016, a las 10:45, Julio Saura > escribió:

hi

we have found the problem

the process inside the docker is launched with sudo to a non
privileged user por starting the jboss server  , don’t want the
process to be launched as root.

env variables are only available for the root user of the docker, not
for the user that launches jboss process, and so code finds em as null

Best regards





El 9 sept 2016, a las 17:49, Julio Saura > escribió:



El 9 sept 2016, a las 17:47, Aleksandar Kostadinov
> escribió:

Julio Saura wrote on 09/09/16 18:41:



El 9 sept 2016, a las 17:39, Aleksandar Kostadinov
> escribió:

Julio Saura wrote on 09/09/16 17:09:

Hello

just to be sure ..

i need to pass some env variables containing @ and / characters

so far i did always scape them

for example

  {
 "name”:"URL",
 "value”:”http:\/\/www.example.com
\/uri"
  },


This is not OpenShift specific. You need just correct JSON. As
far as ruby JSON parser says, there is no need to escape anything
in the above URL.


yeah i know is not open shift specific but since this an open
shift group i though it would be the right way to answer this :)

ok, i will investigate further then why i am having problems in
the app recovering variable values


You need to provide to the list more details of what you are seeing
exactly. I said JSON escaping is not specific to OpenSHift. But
issue might not be escaping itself.


yeah agree. let me do some investigations in the code i had .. i am
sure is a code problem if escaping is not needed ..

i am getting is a null pointer exception when recovering the env
variables values.

i will share conclusions as soon as i have

thanks




thanks aleksandar






this is the right way ? i am having problems recovering this
variable on a java app in my pods

on shell if i echo the variable’s value shows the value ok.

thanks in advance
Best regards.

___
users mailing list
users@lists.openshift.redhat.com

http://lists.openshift.redhat.com/openshiftmm/listinfo/users


___
users mailing list
users@lists.openshift.redhat.com

http://lists.openshift.redhat.com/openshiftmm/listinfo/users


___
users mailing list
users@lists.openshift.redhat.com 
http://lists.openshift.redhat.com/openshiftmm/listinfo/users




___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users


Re: open shift env variables with slash characters

2016-09-12 Thread Julio Saura
hello

i have just started the process as root inside the docker just to be sure that  
was the problem ,but still the same issue

java process running inside jboss is not reading variable values but when 
connected to the docker shell , echoing them shows the values properly ..

what i am doing wrong? shell processes are able to read values but app inside 
jboss no..

best regards

thanks again.


> El 12 sept 2016, a las 11:04, Julio Saura  escribió:
> 
> do i need to do something to make the env variables i pass on son when 
> creating the RC to all users? or shall i do it manually dumping them into 
> /etc/profile or user bash_profile file prior launching jboss?
> 
> thanks
> 
>> El 12 sept 2016, a las 10:45, Julio Saura > > escribió:
>> 
>> hi
>> 
>> we have found the problem
>> 
>> the process inside the docker is launched with sudo to a non privileged user 
>> por starting the jboss server  , don’t want the process to be launched as 
>> root.
>> 
>> env variables are only available for the root user of the docker, not for 
>> the user that launches jboss process, and so code finds em as null
>> 
>> Best regards
>> 
>> 
>> 
>> 
>>> El 9 sept 2016, a las 17:49, Julio Saura >> > escribió:
>>> 
 
 El 9 sept 2016, a las 17:47, Aleksandar Kostadinov > escribió:
 
 Julio Saura wrote on 09/09/16 18:41:
> 
>> El 9 sept 2016, a las 17:39, Aleksandar Kostadinov > > escribió:
>> 
>> Julio Saura wrote on 09/09/16 17:09:
>>> Hello
>>> 
>>> just to be sure ..
>>> 
>>> i need to pass some env variables containing @ and / characters
>>> 
>>> so far i did always scape them
>>> 
>>> for example
>>> 
>>>   {
>>>  "name”:"URL",
>>>  "value”:”http:\/\/www.example.com \/uri"
>>>   },
>> 
>> This is not OpenShift specific. You need just correct JSON. As far as 
>> ruby JSON parser says, there is no need to escape anything in the above 
>> URL.
> 
> yeah i know is not open shift specific but since this an open shift group 
> i though it would be the right way to answer this :)
> 
> ok, i will investigate further then why i am having problems in the app 
> recovering variable values
 
 You need to provide to the list more details of what you are seeing 
 exactly. I said JSON escaping is not specific to OpenSHift. But issue 
 might not be escaping itself.
>>> 
>>> yeah agree. let me do some investigations in the code i had .. i am sure is 
>>> a code problem if escaping is not needed .. 
>>> 
>>> i am getting is a null pointer exception when recovering the env variables 
>>> values.
>>> 
>>> i will share conclusions as soon as i have 
>>> 
>>> thanks
>>> 
 
> thanks aleksandar
> 
> 
>> 
>>> 
>>> this is the right way ? i am having problems recovering this variable 
>>> on a java app in my pods
>>> 
>>> on shell if i echo the variable’s value shows the value ok.
>>> 
>>> thanks in advance
>>> Best regards.
>>> 
>>> ___
>>> users mailing list
>>> users@lists.openshift.redhat.com 
>>> 
>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
>>> 
>> ___
>> users mailing list
>> users@lists.openshift.redhat.com 
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
>> 
> 
> ___
> users mailing list
> users@lists.openshift.redhat.com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users

___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users


Re: open shift env variables with slash characters

2016-09-12 Thread Julio Saura
do i need to do something to make the env variables i pass on son when creating 
the RC to all users? or shall i do it manually dumping them into /etc/profile 
or user bash_profile file prior launching jboss?

thanks

> El 12 sept 2016, a las 10:45, Julio Saura  > escribió:
> 
> hi
> 
> we have found the problem
> 
> the process inside the docker is launched with sudo to a non privileged user 
> por starting the jboss server  , don’t want the process to be launched as 
> root.
> 
> env variables are only available for the root user of the docker, not for the 
> user that launches jboss process, and so code finds em as null
> 
> Best regards
> 
> 
> 
> 
>> El 9 sept 2016, a las 17:49, Julio Saura > > escribió:
>> 
>>> 
>>> El 9 sept 2016, a las 17:47, Aleksandar Kostadinov >> > escribió:
>>> 
>>> Julio Saura wrote on 09/09/16 18:41:
 
> El 9 sept 2016, a las 17:39, Aleksandar Kostadinov  > escribió:
> 
> Julio Saura wrote on 09/09/16 17:09:
>> Hello
>> 
>> just to be sure ..
>> 
>> i need to pass some env variables containing @ and / characters
>> 
>> so far i did always scape them
>> 
>> for example
>> 
>>   {
>>  "name”:"URL",
>>  "value”:”http:\/\/www.example.com \/uri"
>>   },
> 
> This is not OpenShift specific. You need just correct JSON. As far as 
> ruby JSON parser says, there is no need to escape anything in the above 
> URL.
 
 yeah i know is not open shift specific but since this an open shift group 
 i though it would be the right way to answer this :)
 
 ok, i will investigate further then why i am having problems in the app 
 recovering variable values
>>> 
>>> You need to provide to the list more details of what you are seeing 
>>> exactly. I said JSON escaping is not specific to OpenSHift. But issue might 
>>> not be escaping itself.
>> 
>> yeah agree. let me do some investigations in the code i had .. i am sure is 
>> a code problem if escaping is not needed .. 
>> 
>> i am getting is a null pointer exception when recovering the env variables 
>> values.
>> 
>> i will share conclusions as soon as i have 
>> 
>> thanks
>> 
>>> 
 thanks aleksandar
 
 
> 
>> 
>> this is the right way ? i am having problems recovering this variable on 
>> a java app in my pods
>> 
>> on shell if i echo the variable’s value shows the value ok.
>> 
>> thanks in advance
>> Best regards.
>> 
>> ___
>> users mailing list
>> users@lists.openshift.redhat.com 
>> 
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
>> 
> ___
> users mailing list
> users@lists.openshift.redhat.com 
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users

___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users


Re: open shift env variables with slash characters

2016-09-12 Thread Julio Saura
hi

we have found the problem

the process inside the docker is launched with sudo to a non privileged user 
por starting the jboss server  , don’t want the process to be launched as root.

env variables are only available for the root user of the docker, not for the 
user that launches jboss process, and so code finds em as null

Best regards




> El 9 sept 2016, a las 17:49, Julio Saura  escribió:
> 
>> 
>> El 9 sept 2016, a las 17:47, Aleksandar Kostadinov  
>> escribió:
>> 
>> Julio Saura wrote on 09/09/16 18:41:
>>> 
 El 9 sept 2016, a las 17:39, Aleksandar Kostadinov  
 escribió:
 
 Julio Saura wrote on 09/09/16 17:09:
> Hello
> 
> just to be sure ..
> 
> i need to pass some env variables containing @ and / characters
> 
> so far i did always scape them
> 
> for example
> 
>   {
>  "name”:"URL",
>  "value”:”http:\/\/www.example.com\/uri"
>   },
 
 This is not OpenShift specific. You need just correct JSON. As far as ruby 
 JSON parser says, there is no need to escape anything in the above URL.
>>> 
>>> yeah i know is not open shift specific but since this an open shift group i 
>>> though it would be the right way to answer this :)
>>> 
>>> ok, i will investigate further then why i am having problems in the app 
>>> recovering variable values
>> 
>> You need to provide to the list more details of what you are seeing exactly. 
>> I said JSON escaping is not specific to OpenSHift. But issue might not be 
>> escaping itself.
> 
> yeah agree. let me do some investigations in the code i had .. i am sure is a 
> code problem if escaping is not needed .. 
> 
> i am getting is a null pointer exception when recovering the env variables 
> values.
> 
> i will share conclusions as soon as i have 
> 
> thanks
> 
>> 
>>> thanks aleksandar
>>> 
>>> 
 
> 
> this is the right way ? i am having problems recovering this variable on 
> a java app in my pods
> 
> on shell if i echo the variable’s value shows the value ok.
> 
> thanks in advance
> Best regards.
> 
> ___
> users mailing list
> users@lists.openshift.redhat.com 
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
> 
___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users