Setup an API Server

Hello,

I have managed to get the Flukso device image compiled and flashed onto the device - now I am trying to replicate the API server.

I hope that I am right is assuming that the API server receives the data from the device and it is written in Erland and WebMachine.

I am coming across several issues that I want to both point out for anyone following me and/or get help on if anyone has an answer,

Firstly, it appears that OpenWRT does not correctly return DNS values if they are on a private IP range. For example, if you set up api.yourdomain.com to point to 192.168.1.10, you will get an invalid response from dig or nslookup.

I had to create a entry in the /etc/hosts file - 192.168.1.10 api.yourdomain.com - just so ping will work.

Secondly, are there any instructions anywhere on how to set up the API server. At the moment I can get WebMachine working standalone, but when I run ./startup-dev.sh, I get a MySQL error. I have created a database and user with the matching passwords already. But no tables.

Where can I get the "logger" table structure required by the API?

Any pointers would be greatfully accepted.

Regards

Geoff

icarus75's picture

Hi Geoff,

For the DNS issue, see the flukso-dev mailing list thread [1].

The API part of the server is indeed Erlang/Webmachine-based. The website itself is running on a Drupal core. Both access a commom mySQL database. Getting the entire setup right from scratch isn't that straightforward. In June I was thinking of writing a sort of debootstrap script that would configure a Flukso XEN VM from scratch [2]. But I didn't press forward because:
1/ the Flukso server architecture is in constant flux
2/ getting everything right out-of-the-box would mean a ton of work (e.g.nginx setup with SSL certs)

[1]: http://lists.flukso.net/pipermail/flukso-dev/2011-May/000018.html
[2]: https://github.com/flukso/fls/tree/develop/xen

Cheers,
Bart.

geofftech's picture

Thanks Bart,

I had a proper look at the Drupal database again and the "logger_" tables are in-fact there!!! I missed them the first time I looked.

I am trying to get this Erlang+WebMachine+Flukso API server running - I am recording the process so when I get it all worked out, I'll post back the instructions.

The big issues I have had so far is that the DNS did not resolve to a local IP address (as mentioned above) and getting a hole through IPTables for port 8000.

Are there any tricks you can think of that may be helpful? Anything is good?

Regards

Geoff

geofftech's picture

Hi,

There only seems to be tables for

* logger_devices
* logger_meters

in the Drupal database. But the Flukso code also refers to other tables...

* logger_tokens

Would it be possible to get a SQL dump of the current database schema please?

MVI's picture

Hi,

I'm trying to build my own server. I have been working several days on it because I'm new with all this stuff. So far I've installed and configured drupal 6 with flukso theme and all the modules needed.
The problem is when I try to install "services" module in order to run RESTapi (flukso API). I can't get "services" module for drupal 6.x, it only exists for version 7.x; If I update drupal to version 7, none of the flukso modules are compatible... So, I think on two possible solutions:

1.- Could someone send me the "services" module compatible with drupal 6, please?
2.- Have you already upgraded the code to drupal 7?

Thank you for your help! :D