Server Deployment - Connection Refused

Hi all,

I have followed the documentation to create my own thinger server install based on Ubuntu Server 16.04:

http://docs.thinger.io/deployment/#install-on-ubuntu-1604

I have also added the line “#define THINGER_SERVER “xxx.xxx.xxx.xxx”” to the very top of my Arduino sketch to point to my local server rather than the cloud one.

I have then visited “https://console.thinger.io/#/settings” and replaced api.thinger.io with my servers local IP address and then gone to the console. However, whenever I try to add a device etc I have the following error:

Ooops! Cannot process your request. Error 0 (connection refused)

I have checked and both Thinger and Mongodb are running on my server. Are there any incoming firewall requirements?

Thanks.

Hi!

Are able to create a new account from the console.thinger.io? It might be that connection to db is not working or db is missing I have the same problem.

Hi,

I tried the same last night. So at least it worked for me if I used “localhost” instead of “api.thinger.io”. However, if I tried to connect from another computer on my network, then I got the connection refused as well, even after changing the URL to the actual IP address of the server. I do not know if you need to setup some permissions to be able to access the web server from a different computer.

I was able to (actually had to) create a new thinger.io account on the local server before I could log, kinda makes sense.

Bottom line for me at least. If I use “localhost” and access the console from the computer where the thinger.io server is installed, then everything works perfectly. Accessing it from a remote computer on the same LAN does not because of some permission issues.

Maybe a bit of a side question, but can’t you access the URL Thinger.io | Cloud Console directly from the console, that would be handy?

Best regards,
Simon

Heh, Don’t know what happened exactly but reinstalled and added the emailing stuff to config file and it started working. Is the smtp info mandatory or was it just pure luck? :slight_smile:

I believe it is optional without being 100% sure. At least I did not add the SMTP info yet and everything is working beautifully on localhost :slight_smile:

SMTP is not required for register by default. The server listen by default in all network interfaces (0.0.0.0). In order to make it work externally, it is required to check firewalls for ports for 443 (https), 80 (http), 25200 (thinger connection), and 25202 (thinger secure connection). To connect your browser to the server platform, just set locahost in the settings if you are using the server in the same host, or the server ip address if you are accessing from another host.

And, of course, the local deployment requires a new account, as all the data is handled offline in your server! :wink:

Great info, especially with the firewalls and specific ports, I missed that in the Docs guide, will try it out today :slight_smile:

As a note, I checked the ports on my local server using Macs port scan in Network Utility, and it showed that all the ports you mentioned were actually open. Since I kept getting the connection refused message when trying to log in from a remote computer, it most likely had to do with the SSL certificate.

So I tried opening the Error Console in my browser, and it said the following

[Error] Failed to load resource: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.1.24” which could put your confidential information at risk. (token, line 0)

So of course it had to do with the secure https connection :slight_smile: after visiting the server IP one time with https://, and whitelisting the IP, then everything is working perfectly.

Of course the proper solution would be to get a SSL certificate :slight_smile:


I also found out on a clean Ubuntu 16.04, mongodb will not automatically start, so you have to add it manually. If you receive the message “internal server error”, then mongodb is most likely not running. I followed the guide here to make sure it automatically starts when the server restarts

Here it says:

As of publication time, the official Ubuntu 16.04 MongoDB packages have not yet been updated to use the new systemd init system which is enabled by default on Ubuntu 16.04. Running MongoDB using those packages on a clean Ubuntu 16.04 server involves following an additional step to configure MongoDB as a systemd service that will automatically start on boot.

1 Like

All good info thanks as it wasn’t that obvious that I had to create a new user as pointing to my server. After doing this and autostart MongoDB the server is up and running and recording data.

However, I am still massively confused how this local server can now be accessed via the cloud console provided by thinger.io. Or, am I wrong in thinking this and my local server is only available on my local network? I don’t understand how console.thinger.io reroutes to my local install.

Any pointers?

Thanks.

Hi, nice you got it working! Maybe it is useful to update the docs for clarifying the MongoDB aspect. Any pull request for that? :slight_smile:

Regarding your question, the cloud console is pointing to your server as you have configured it in settings page. Notice that the cloud console is just a client that interacts with any server instance by using the server REST API. So, https://console.thinger.io provides you the web client that interacts with your server, it does not render anything on the server side, just provide the client pages and scripts. In fact, I have prepared packages (that will be available quite soon) for Windows, Linux and Mac, so you can download and run the console in your local machines…

Not sure if it is clear… This is a “modern” approach that greatly differs from standard web pages, so it can confuse at the beginning.

1 Like

Would be useful to also include a line about creating a new account as it is on the local server. It shouldn’t have caught me out but did :slight_smile:

Thanks for explaining about the REST API and it does now make sense how I am picking up my local machine when on my own network and pointing to https://console.thinger.io. However, and it is probably still me not understanding, but should I be able to access my local servers console when away from my network by pointing to https://console.thinger.io? I assumed that my server would be collecting all of the data and the cloud console would be able to display it.

Thanks.