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

"upstream" directive is not allowed here #226

Open
sjoshi10 opened this issue Jul 17, 2017 · 15 comments
Open

"upstream" directive is not allowed here #226

sjoshi10 opened this issue Jul 17, 2017 · 15 comments

Comments

@sjoshi10
Copy link

Hey @ehazlett , we are getting this error when we upgraded to interlock 1.4.0. We had to update nginx.conf template file to get it working. This is the error we are seeing:

2017/07/17 13:33:00 [emerg] 92#92: "upstream" directive is not allowed here in /etc/nginx/nginx.conf:95
nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/nginx.conf:95

@ehazlett
Copy link
Owner

Can you give an example of your deployment (containers, labels, etc) so I can try to re-create. Thanks!

@sjoshi10
Copy link
Author

sjoshi10 commented Jul 17, 2017

services:
  sonarqube:
    image: dtr-1.prod/admin/sonarqube:comp
    logging:
      driver: gelf
      options:
        tag: sonarqube
        gelf-address: udp://0.0.0.0:12201
    mem_limit: 2000m
    restart: always
    ports:
    - '8080'
    labels:
    - interlock.ssl=true
    - interlock.ssl_only=true
    - interlock.ssl_backend_tls_verify=false
    - interlock.ssl_cert=/certs/cert.pem
    - interlock.ssl_cert_key=/certs/key.pem
    - interlock.hostname=76sonarqubecomp
    - interlock.domain=apps.prod
    - gitbranch=development
    - env=prod
    - com.docker.swarm.reschedule-policies=["on-node-failure"]
networks:
  default:
    driver: overlay```

@sjoshi10
Copy link
Author

@ehazlett this is our docker-compose.yml file

@sjoshi10
Copy link
Author

@ehazlett were you able to recreate the problem?

@ehazlett
Copy link
Owner

I haven't yet. I'm hoping to get to it today.

@sjoshi10
Copy link
Author

@ehazlett any luck?

@ehazlett
Copy link
Owner

@sjoshi10 hey sorry for the delay. i'm not able to reproduce this on my end. Do you have any other apps that are running that could be conflicting?

@sjoshi10
Copy link
Author

@ehazlett Hey, we deployed this to UCP. We are getting this error because the nginx.conf that interlock produces is missing curly braces.

@sjoshi10
Copy link
Author

sjoshi10 commented Jul 28, 2017

user  www-data;
worker_processes  2;
worker_rlimit_nofile 65535;

error_log  /var/log/error.log warn;
pid        /etc/nginx/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 128;
    client_max_body_size 2048M;

    log_format  main  '$remote_addr - $remote_user [$upstream_addr] [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
    # scheme used to connect to this server
    map $http_x_forwarded_proto $proxy_x_forwarded_proto {
      default $http_x_forwarded_proto;
      ''      $scheme;
    }

    #gzip  on;
    proxy_connect_timeout 600;
    proxy_send_timeout 600;
    proxy_read_timeout 600;
    proxy_set_header        X-Real-IP         $remote_addr;
    proxy_set_header        X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $proxy_x_forwarded_proto;
    proxy_set_header        Host              $http_host;
    send_timeout 600;

    # ssl
    ssl_prefer_server_ciphers on;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;


    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    # default host return 503
    server {
            listen 80;
            server_name _;

            location / {
                return 503;
            }

            location /nginx_status {
                stub_status on;
                access_log off;
            }
    }



    upstream wordpresstest4.apps.test {
        zone wordpresstest4.apps.test_backend 64k;

        server 10.177.80.146:32768;

    }



    server {
        listen 80;
        server_name wordpresstest4.apps.test;



        return 302 https://$server_name$request_uri;


    upstream interlocktest.dev {
        zone interlocktest.dev_backend 64k;

        server 10.177.80.172:32768;
        server 10.177.80.198:32768;

    }



    server {
        listen 80;
        server_name interlocktest.dev;



        return 302 https://$server_name$request_uri;


    include /etc/nginx/conf.d/*.conf;
}

@sjoshi10
Copy link
Author

2017/07/17 13:33:00 [emerg] 92#92: "upstream" directive is not allowed here in /etc/nginx/nginx.conf:95 @ehazlett

@ehazlett
Copy link
Owner

@sjoshi10 can you see if #238 fixes? You can use the image ehazlett/interlock:pr-238 to test.

@sjoshi10
Copy link
Author

@ehazlett I am still seeing that error after using that image.

@sjoshi10
Copy link
Author

sjoshi10 commented Aug 2, 2017

@ehazlett any idea why it's still happening?

@ghost
Copy link

ghost commented Feb 18, 2018

still...

@ehazlett
Copy link
Owner

ehazlett commented Feb 18, 2018 via email

ehazlett pushed a commit that referenced this issue Aug 16, 2019
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

No branches or pull requests

2 participants