Wirecloud / docker-wirecloud

🐳 Docker Official Image packaging for WireCloud https://conwet.fi.upm.es/wirecloud
Other
8 stars 15 forks source link

Wirecloud failed to run in Firefox / Chrome #26

Closed arilwan closed 5 years ago

arilwan commented 5 years ago

Dear Commnity, I am running dockerized images of wirecloud+nginx from a remote server, trying to access Wirecloud from my browser. Wirecloud failed to load correctly, issuing the following message:

Your browser seems to lack some required features
We recommend you to upgrade your browser to the newest version of either Firefox or Google Chrome as these are the browsers currently supported by WireCloud.

new wirecloud

I can confirm my browsers (firefox and chrome) are up-to-date, and I can run wirecloud locally on my machine using same browsers, as in following image: wirecloud 2

Any idea why this problem happpens? Below is my docker-compose file.

version: "3.1"
services:
 nginx:
    restart: always
    container_name: fiware-nginx
    image: nginx
    networks:
      - default
    ports:
      - 53153:80
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - ./wirecloud-static:/var/www/static:ro
      - ./nginx_logs:/var/log/nginx
    depends_on:
      - wirecloud
 postgres:
    restart: always
    image: postgres:10
    hostname: postgres
    container_name: fiware-postgres
    expose:
      - "5432"
    ports:
      - "5432:5432"
    networks:
      - default
    environment:
      - "POSTGRES_PASSWORD=password"
      - "POSTGRES_USER=postgres"
      - "POSTGRES_DB=postgres"
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
 elasticsearch:
    restart: always
    container_name: fiware-elasticsearch
    image: elasticsearch:2.4
    volumes:
      - ./elasticsearch-data:/usr/share/elasticsearch/data
    command: elasticsearch  -Des.index.max_result_window=50000
 memcached:
    restart: always
    container_name: fiware-memcached
    image: memcached:1
    command: memcached -m 2048m  
 wirecloud:
    restart: always
    image: fiware/wirecloud
    container_name: fiware-wirecloud
    networks:
        - default
    depends_on:
        - postgres
        - elasticsearch
        - memcached
    environment:
        - DEBUG=False
        - DB_HOST=postgres
        - DB_PASSWORD=password # Change this password!
        - FORWARDED_ALLOW_IPS=*
        - ELASTICSEARCH2_URL=http://elasticsearch:9200/
        - MEMCACHED_LOCATION=memcached:11211
    volumes:
      - ./wirecloud-data:/opt/wirecloud_instance/data
      - ./static:/var/www/static
arilwan commented 5 years ago

Hi @aarranz Can you spot what is causing this problem, please? Can't figure out what's the cause.

arilwan commented 5 years ago

I tried this with Safari too, same problem.

aarranz commented 5 years ago

Hi @arilwan,

Sorry for the delay, It seems a problem with the static files. Please, try following those steps:

Best Regards, Álvaro

arilwan commented 5 years ago

Hi @aarranz

Just made these changes and restarts services, yet I'm receiving same message as before.

arilwan commented 5 years ago

Hi @aarranz I share here my nginx.conf file:

user  nginx;
worker_processes  1;

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

events {
    worker_connections  1024;
}

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;

    server {

        listen 53153;

        #server_name example.org MY_SERVER_IP;

        client_max_body_size 20M;
        charset utf-8;

        location /static {
            alias /var/www/static;
        }

        location / {
            proxy_pass http://wirecloud:8000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
       location /iotagent {
           proxy_pass http://fiware-iotagent:4041;

        }

    }
}

port mapping in docker-compose.yml:

ports:
       - "53153:53153"
aarranz commented 5 years ago

I found the problems, you have changed folder name for static files on the wirecloud service (to static), but you are using the old name (wirecloud-static) on the nginx service. This make nginx not able to serve static files. On the other hand, as you are using a custom port, you have to indicate it by changing the following line:

proxy_set_header Host $host;

to

proxy_set_header Host $host:53153;

on the nginx.conf file.

Hope this solve your problems.

arilwan commented 5 years ago

Great! It works... closing.

jeremymeyers commented 2 years ago

This seems to still be a problem with the https://hub.docker.com/r/fiware/wirecloud image, if one wants to have wirecloud live on a port other than 8000 (which in my case is already taken).

Screen Shot 2021-12-09 at 5 22 36 PM Screen Shot 2021-12-09 at 5 23 24 PM