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

UI+Lora configuration #13

Closed
4refr0nt opened this issue Nov 27, 2019 · 4 comments
Closed

UI+Lora configuration #13

4refr0nt opened this issue Nov 27, 2019 · 4 comments

Comments

@4refr0nt
Copy link

Please, give me example nginx and ui configuration with Mainflux+Lora+UI
How to configure nginx in main mainflux project for proxing and url rewriting additional microservices (reader, writer, bootstrap and so on) for manage lora GW and devices over UI.
I successfully manage non-lora devices, but I have many troubles with lora GW and devices.
With my config I have many errors in browser console and in HTTP req logs.

       location ~ ^/(reader) {
            include snippets/proxy-headers.conf;
            rewrite /reader/(.*) /$1 break;
            proxy_pass http://mainflux.example.com:8905;
        }

        location ~ ^/(writer) {
            include snippets/proxy-headers.conf;
            rewrite /writer/(.*) /$1 break;
            proxy_pass http://mainflux.example.com:8900;
        }

        location ~ ^/(config) {
            include snippets/proxy-headers.conf;
            rewrite /config/(.*) /things/configs/$1 break;
            proxy_pass http://mainflux.example.com:8202;
        }

        location ~ ^/(bootstrap) {
            include snippets/proxy-headers.conf;
            rewrite /bootstrap/(.*) /things/bootstrap/$1 break;
            proxy_pass http://mainflux.example.com:8202;
        }
@manuio
Copy link
Contributor

manuio commented Nov 27, 2019

@4refr0nt I'm not sure to understand your question. You can't manage LoRa GW from Mainflux. You must connect them to your ChirpStack Server (the project was previously called Lora Server), configure this MF_LORA_ADAPTER_MESSAGES_URL ENVAR with the address of your ChirpStack MQTT Broker and finally run the docker composition of lora-adapter.
From UI side this environment variable loraServer: 'http://lora.mainflux.io/#/' refers to the ChirpStack UI and not to the address of the message broker.

This doc can maybe help you.

@4refr0nt
Copy link
Author

4refr0nt commented Nov 28, 2019

I'm already read this doc and configure my mainflux as documented (ChirpStack server running, ENV VAR setted and put in system profile, profile activated for current user, and lora adapter started). Also, I'm cloned UI project and set proper urls in environmens.prod.ts and rebuld docker images, but I have some troubles with UI.
For reproduce this issue try install mainflux on clear VM (without saved docker images and volumes with previous data) and run as documented with ChirpStack server. Try open browser on other host (mainflux UI link).

  1. UI make GET http req with unproper url mainflux_host://things/version
    (proper links we can see in mainflux/things/swagger.yml)
    screen1

  2. UI make GET http req mainflux_host://reader/channels/xxx/messages?offset=0&limit=500
    but any reader not running and nginx redirects not configured in main docker/nginx folder.
    Mainflux_host nginx return root UI page for this req :)
    screen2

  3. Other undefined GET req by UI for unstarted microservices (mainflux_host nginx return root UI page):

  • /config
  • /writer
  • /bootstrap

Please, try add new gw and lora device over UI, then view and edit this items.

@manuio
Copy link
Contributor

manuio commented Nov 28, 2019

@4refr0nt Thank you for the details, I understand your issue now. The problem is that we are using Nginx as proxy and it expect to find all services up and running otherwise it crash... That's why the configuration is only made for Core services.
This UI is using addons (reader, writer and boostrap) and it needs a specific configuration of the proxy:

    location /config {
        proxy_pass http://localhost:8202/things/configs;
    }
    location /bootstrap {
        proxy_pass http://localhost:8202/things/bootstrap;
    }
    location /reader/channels {
        proxy_pass http://localhost:8905/channels;
    }
    location /writer/channels {
        proxy_pass http://localhost:8185/channels;
    }

Let's think about how to document this in this repo or if we add a whole new config of docker-compose and Nginx.

@4refr0nt
Copy link
Author

Thanks!

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