Tuesday, 19 February 2013

Adafruit Web IDE

Update: With the IDE installed on two separate pi using the same bit bucket account it seems to share the source code back and forth OK as long as you don't try to use both of them at the same time.

Having tried the manual instructions and failed (see below), I checked the "easy install" shell script and found it had provisions to use port 3000 if port 80 was already in use (e.g. by apache) so I just ran:

curl https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/scripts/install.sh | sudo sh


[verbosity...]
**** Create webide user and group ****
**** Adding webide user to sudoers ****
/etc/sudoers.tmp: parsed OK
/etc/sudoers.d/README: parsed OK
**** Adding default .bashrc file for webide user ****
**** Installing the WebIDE as a service ****
**** (to uninstall service, execute: 'sudo update-rc.d -f adafruit-webide.sh remove') ****
update-rc.d: using dependency based boot sequencing
OK
**** WARNING: PORT 80 IN USE. FALLING BACK TO 3000. ****
**** TO CHOOSE A DIFFERENT PORT USE THE FOLLOWING COMMAND: ****
**** redis-cli HMSET server port 3000 ****
**** AND RESTART THE SERVER ****
**** Starting the server...(please wait) ****
**** The Adafruit WebIDE is installed and running! ****
**** Commands: sudo service adafruit-webide.sh {start,stop,restart} ****
**** Navigate to http://rwspi.local:3000 to use the WebIDE

Then I created a bitbucket account for sellensr based on my google id. I created a couple of files, then did a reboot on the Pi. The apache server still works with rwspi.local and the webIDE with rwspi.local:3000. The files are stored at:

/usr/share/adafruit/webide/repositories

and belong to user and group webide, thus I can't copy files over to there as pi on a vnc file manager screen. Oddly the easy way to move files from ~/pi into the ide is to enable the samba share, then upload the files from the share through the IDE. Odd, but works really well.

I've been doing all this in Safari, which isn't explicitly supported, but seemed to be working OK until I left the IDE and some other stuff broke. Probably best to run the IDE in a supported Chrome window and other things in Safari.

Some of the assumptions I made about directory structure are no longer valid if I move .py files to the IDE, but that shouldn't be a surprise.

webide added itself to the /etc/sudoers file and takes over the hardware. As a result, www-data couldn't use the serial port until I put it back in the /etc/sudoers file.

Trying to do the manual version was a bad plan