Skip to content

Installing the Raspberry Pi

dave griffiths edited this page Sep 5, 2017 · 2 revisions

Set up a wifi access point on the internal wlan0

We need to set up the internal wifi hardware so it's used as an access point, this is an authenticated ad-hoc node. The external wifi dongle is used for normal internet access (as setting this up as a access point is hard/difficult/impossible).

Following most of this:

https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/

We use hostapd and dnsmasq. Switching 172.24.1.1 for 192.168.2.1 (what the mongoose app and server expect) and changing ip ranges etc to match. Name the ssid "mongoose-web" with no password.

No need to do "Set up IPv4 forwarding"

Todo - put config files in repo

Check once this is done check that "mongoose-web" exists and you can connect to it externally.

Setting up the mongoose web server

Install racket:

sudo apt-get install racket

Then clone the mongoose git repo:

git clone git@github.com:fo-am/mongoose-2000.git

Go into mongoose-2000/web and test the server:

./server.scm 8888

This will take ages the first time as it download and installing further dependencies silently.

Launch the server at boot

More stuff needed:

 sudo apt-get install daemontools

"supervise" is used to start and check the server, restarting it in case of crashes.

Add a line to crontab (crontab -e):

@reboot supervise /home/pi/mongoose-2000/web

Reboot...

Testing

Once booted connect externally to mongoose-web and visit this URL:

http://192.168.2.1:8888/ 

Should say: "hello there"

or even:

http://192.168.2.1:8888/mongoose 

"malformed thingy"

Final check is to use the app to syncronise, if it's a clean database a tablet should start the process of dumping all it's data into the Pi as it detects it doesn't have the data.

Inspecting what's going on

Stop the server:

killall supervise
ps -ef | grep server
kill -9 XXX

Then start it manually, dumping to stdout:

./server.scm 8888