I'm also not sure what I've to fill in here. So my image is created with this. 
This is angular and it contain's the URL of the server where it's running and 
its port:
(function () {
  'use strict';

  angular
    .module('app')
    .constant('config', {
      URL: 'http://ec2xxx-1.compute.amazonaws.com',
      PORT: '80',
      GRID_FLOAT_BREAKPOINT: 768
    });
})(); 





From: [email protected]
To: [email protected]
Subject: RE: Hosting Angular/nodejs -app in OpenShift 3.1
Date: Thu, 28 Jan 2016 08:31:54 +0000
CC: [email protected]




But it's working fine locally or just with the docker commands. It's because 
it's a reverse proxy.
But It's just not working in OpenShift. I can show you the deploymentconfigs:

DC of nodejs
apiVersion: v1
kind: DeploymentConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftNewApp
  creationTimestamp: 2016-01-27T13:58:53Z
  labels:
    app: nodejs
    test: "true"
  name: nodejs
  namespace: test5
  resourceVersion: "3046"
  selfLink: /oapi/v1/namespaces/test5/deploymentconfigs/nodejs
  uid: 199e7988-c4fe-11e5-b183-06515757374f
spec:
  replicas: 1
  selector:
    app: nodejs
    deploymentconfig: nodejs
  strategy:
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      annotations:
        openshift.io/generated-by: OpenShiftNewApp
      creationTimestamp: null
      labels:
        app: nodejs
        deploymentconfig: nodejs
    spec:
      containers:
      - image: ec2xxx1.compute.amazonaws.com:5000/test/nodejs:50
        imagePullPolicy: IfNotPresent
        name: nodejs
        ports:
        - containerPort: 8888
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
      dnsPolicy: ClusterFirst
      restartPolicy: Always



DC of nginx (which keeps restarting)

apiVersion: v1
kind: DeploymentConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftNewApp
  creationTimestamp: 2016-01-28T08:23:09Z
  labels:
    app: nginx
  name: nginx
  namespace: test5
  resourceVersion: "4909"
  selfLink: /oapi/v1/namespaces/test5/deploymentconfigs/nginx
  uid: 5d2381a5-c598-11e5-ad28-06515757374f
spec:
  replicas: 1
  selector:
    app: nginx
    deploymentconfig: nginx
  strategy:
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      annotations:
        openshift.io/generated-by: OpenShiftNewApp
      creationTimestamp: null
      labels:
        app: nginx
        deploymentconfig: nginx
    spec:
      containers:
      - image: ec2-xxx1.compute.amazonaws.com:5000/test/nginx:50
        imagePullPolicy: IfNotPresent
        name: nginx
        ports:
        - containerPort: 80
          protocol: TCP
        - containerPort: 443
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        volumeMounts:
        - mountPath: /var/cache/nginx
          name: nginx-volume-1
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: nginx-volume-1
  triggers:
  - type: ConfigChange
status:
  details:
    causes:
    - type: ConfigChange
  latestVersion: 1


So. Now they're deployed in different services. NodeJS is working fine. It can 
run on its own. But Nginx keeps restarting because it's a reverse proxy for the 
nodejs. But it can't find the nodejs-container. That's the reason why is 
container keep restarting:




Date: Wed, 27 Jan 2016 12:23:37 -0200
Subject: Re: Hosting Angular/nodejs -app in OpenShift 3.1
From: [email protected]
To: [email protected]
CC: [email protected]

I can't see your DeploymentConfiguration, but I believe that since nodejs is a 
standalone service, its port is 80, like any other http service:
try changing               server nodejs:8888 weight=10 max_fails=3 
fail_timeout=30s;
to              server nodejs:80 weight=10 max_fails=3 fail_timeout=30s;

Mateus CaruccioMaster of Puppets+55 (51) 8298.0026gtalk: 
[email protected]
twitter: @MateusCaruccio

This message and any attachment are solely for the intended
recipient and may contain confidential or privileged information
and it can not be forwarded or shared without permission.
Thank you!

On Wed, Jan 27, 2016 at 12:01 PM, Den Cowboy <[email protected]> wrote:



I just want to make my problem clear, so that's the reason for this new, longer 
message. Thanks . I tried already a lot.

I've created everything new.
So what I've done:
oc new-app image1 --name nginx
oc new-app image2 --name nodejs

See screenshot for the scenario at the moment.
The
 nginx-container is in a backoff restart-loop because it can't find 
nodejs:8888 (container-name and open port on the container).

Why is nginx searching for this container. Well, take a look to the nginx.conf
events { worker_connections 1024; }

http {
        include /etc/nginx/mime.types;

        upstream node-app {
              least_conn;
              server nodejs:8888 weight=10 max_fails=3 fail_timeout=30s;
              
        }
         
        server {
              listen 80;

              root /usr/share/nginx/html/dist;
              
              location / {
                index index.html;
              }

         
              location /api {
                proxy_pass http://node-app;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
              }
        }
}

So this is working fine when I just ran the containers like this:
docker run --restart=always -d --name "nodejs" image:${version} 
docker run --restart=always -d -p 80:80 --name nginx --link nodejs:nodejs 
image:${version} 

So I tried to put them under the same service, but it did not seem to help.





                                          

_______________________________________________

users mailing list

[email protected]

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



                                          

_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users                    
                  
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to