We're Hiring!

public data auto login fails

General user discussion about using the OMERO platform to its fullest. Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

There are workflow guides for various OMERO functions on our help site - http://help.openmicroscopy.org

You should find answers to any basic questions about using the clients there.

public data auto login fails

Postby derekeh » Mon May 07, 2018 12:48 pm

Hi,
I'm running OMERO 5.4.0 on localhost
nginx set up with defaults used in omero installation so omero-web.conf is:

Code: Select all
upstream omeroweb {
    server 127.0.0.1:4080 fail_timeout=0;
}

server {
    listen 80;
    server_name localhost;

    sendfile on;
    client_max_body_size 0;

    # maintenance page serve from here
    location @maintenance {
        root /home/omero/OMERO.py/etc/templates/error;
        try_files $uri /maintainance.html =502;
    }

    # weblitz django apps serve media from here
    location /static {
        alias /home/omero/OMERO.py/lib/python/omeroweb/static;
    }

    location @proxy_to_app {
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_buffering off;

        proxy_pass http://omeroweb;
    }

    location / {

        error_page 502 @maintenance;
        # checks for static file, if not found proxy to app
        try_files $uri @proxy_to_app;
    }


}




trying to set public user as described in:
https://docs.openmicroscopy.org/omero/5 ... ublic.html

and also from the post:
viewtopic.php?f=4&t=8435

result of config get:
Code: Select all

omero> config get
omero.web.application_server=wsgi-tcp
omero.web.debug=True
omero.web.public.enabled=True
omero.web.public.password=xxxxxx
omero.web.public.url_filter=^\/(figure|webadmin\/myphoto\/|webclient\/(?!(script_ui|ome_tiff|figure_script|render_image_download|download_|ome_tiff_script|archived_files\/download|download_orig_metadata))|webgateway\/(?!(archived_files|download_as)))
omero.web.public.user=public_user



restarted all services.
always have to use port 4080 eg. http://localhost:4080/webgateway/img_detail/252/

http://localhost/webgateway/img_detail/252/ results in a page not found error.

help appreciated to resolve this.
derekeh
 
Posts: 31
Joined: Mon Feb 12, 2018 12:00 pm

Re: public data auto login fails

Postby kennethgillen » Mon May 07, 2018 3:59 pm

derekeh wrote:Hi,
I'm running OMERO 5.4.0 on localhost


Hi.

A couple of questions to give the community some context.

Is your OMERO instance running on a shared resource / central server? In other words, is it "on localhost" with respect to the other commands in your post, or do you have an installation running on your local system, e.g. as a test?

What platform have you installed the server on, and which set of installation instructions did you follow?


derekeh wrote:always have to use port 4080 eg. http://localhost:4080/webgateway/img_detail/252/


This makes me think there's something wrong with your NGINX installation and configuration.

Is NGINX installed system-wide? Perhaps with a system package manager?

The following would tell us how NGINX is running:
Code: Select all
ps aux | grep nginx


What happens when you open http://localhost/

Could you send us your NGINX logfile, as well as OMERO.web log?
A .tar.gz zip up of the entire OMERO and OMERO.web log directory would be best - you can submit that via https://www.openmicroscopy.org/qa2/qa/upload/

Thanks,

Kenny
kennethgillen
 
Posts: 254
Joined: Mon Nov 05, 2012 3:39 pm

Re: public data auto login fails

Postby derekeh » Tue May 08, 2018 8:32 am

Thanks for responding.
Everything is installed on a local linux box running Centos7
Code: Select all
Linux version 3.10.0-693.5.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Fri Oct 20 20:32:50 UTC 2017


Installation instructions for OMERO server were followed from here:
https://docs.openmicroscopy.org/omero/5 ... ice36.html

Installation instructions for OMERO.web were followed from here:
https://docs.openmicroscopy.org/omero/5 ... ce3.6.html
Note: Option 1 taken and SELinux is disabled

nginx process output:
Code: Select all
root      8251  0.0  0.0 122896  2300 ?        Ss   08:35   0:00 nginx: master process /usr/sbin/nginx
nginx     8252  0.0  0.0 125504  3596 ?        S    08:35   0:00 nginx: worker process
nginx     8253  0.0  0.0 125504  3596 ?        S    08:35   0:00 nginx: worker process
nginx     8254  0.0  0.0 125504  3596 ?        S    08:35   0:00 nginx: worker process
nginx     8255  0.0  0.0 125504  3596 ?        S    08:35   0:00 nginx: worker process
nginx     8256  0.0  0.0 125504  3596 ?        S    08:35   0:00 nginx: worker process
nginx     8257  0.0  0.0 125504  4036 ?        S    08:35   0:00 nginx: worker process
nginx     8258  0.0  0.0 125504  3792 ?        S    08:35   0:00 nginx: worker process
nginx     8259  0.0  0.0 125504  4040 ?        S    08:35   0:00 nginx: worker process

nginx was installed as part of the OMERO.web install (see above). Version 1.12.2

*****************

I'm new to nginx, coming from Apache so perhaps I am not understanding the directives properly.
Here is what is currently happening:
If I open new browser (clean cache) to: http://localhost/webgateway/img_detail/252/ I get page not found.
If I go then to http://localhost I get my default index.html page at /usr/share/nginx/html/

!!! Now if I go to http://localhost:4080/webgateway/img_detail/252/ AND WAIT for 65 seconds (which just happens to be the keepalive_timeout value in nginx.conf) I can now view http://localhost/webgateway/img_detail/252/ successfully.
If I now go to http://localhost I get redirected to localhost/webclient (and am logged in as public-user.)

I've tried removing and changing the keepalive_timeout to 0, 5 but then the non-port url never loads.
There are only 2 conf files loaded into nginx. nginx.conf and omero-web.conf. I included the latter previously, I include the former here.
Code: Select all
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$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;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80; #; #; # default_server;
        listen       [::]:80; #; #; # default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}
derekeh
 
Posts: 31
Joined: Mon Feb 12, 2018 12:00 pm

Re: public data auto login fails

Postby kennethgillen » Tue May 08, 2018 2:18 pm

Hi derekeh,

The first thing I'd do here is to remove top level NGINX "server" and "location" blocks in /etc/nginx/nginx.conf, if your only plan for this NGINX instances is to host OMERO. (I'm guessing so, since you mention you installed it as part of the OMERO install.)

Since OMERO generates the necessary "server" and "location" blocks for you, which you then include via the include /etc/nginx/default.d/*.conf;` statement.

I'd recommend replacing that nginx.conf completely with a totally fresh one - there looks to be a fair amount of edits from a vanilla file, which aren't necessary to get OMERO.web running.

Here's an example from one of our production systems you may wish to try (noting in our case, the pid file is in /var/run, your original nginx.conf has /run/nginx.pid - so if you use this example, you might want to change ours to where yours originally was):

Code: Select all
user  nginx;
worker_processes 2;

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


events {
    worker_connections 65000;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$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;

    #gzip  on;

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


If you give that a try, let us know how you get on.

Thanks,

Kenny
kennethgillen
 
Posts: 254
Joined: Mon Nov 05, 2012 3:39 pm

Re: public data auto login fails

Postby derekeh » Wed May 09, 2018 6:49 am

Thanks Kenny, I will try that.
Just to note that I did not edit anything in the nginx.conf file. That's what I got when I installed via the OMERO instructions.
I actually got it working by trashing the omeroweb.conf file and moving the locations for webgateway and static into the nginx.conf.
I am also running glassfish proxied to nginx although I had removed that from the setup when discussing this post.
So my nginx.conf file now contains:
Code: Select all
location /myGlassfishWebApp {
                proxy_pass http://localhost:8080;
        }

        location /webgateway {
                proxy_pass http://localhost:4080;
        }

         # weblitz django apps serve media from here
        location /static {
                alias /home/omero/OMERO.py/lib/python/omeroweb/static;
        }


and everthing works as it should.
I can view my webapp page which is connecting to OMERO db through Blitz and click on thumbnail to launch webgateway with no ports in the URL and view the public image without login.
However, by removing the omeroweb.conf I may run into some problems down the line, so I will try your fix.
Thanks again for your help.
Derek
derekeh
 
Posts: 31
Joined: Mon Feb 12, 2018 12:00 pm

Re: public data auto login fails

Postby kennethgillen » Wed May 09, 2018 8:53 am

Hi Derek,

I'm glad you got it sorted out.

The main difficulty I can foresee is that we occasionally improve the omeroweb.conf NGINX config file, and recommend in the docs that users re-generate it on every upgrade to keep pace with the improvements.

That'll now be a manual step for you, merging in any differences between the new OMERO template and your main /etc/nginx/nginx.conf. So it might still be worth trying to work through getting the include statement in /etc/nginx/nginx.conf to work with an omeroweb.conf in /etc/nginx/conf.d/ so you can just re-gen the whole file.

See https://docs.openmicroscopy.org/omero/5 ... figuration

Best,

Kenny
kennethgillen
 
Posts: 254
Joined: Mon Nov 05, 2012 3:39 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 1 guest