Pylon and the Raspberry Pi

I prefer working with my Chromebook for developing with my Raspberry Pi. I use the Secure Shell extension for SSH. Sometimes I want to use an IDE instead of editing files with nano, especially since I have to manually tab each line. I can't download an IDE since I can't access my Chromebook's developer mode, and the chrome apps either didn't open or didn't allow access to other devices (to access the Raspberry Pi) I discovered Cloud9 but unfortunately I had trouble with it's dependencies, and I didn't want to create an AWS account. A few days later I came across Pylon.

What is Pylon?

Pylon is an IDE that you can access in the web browser, which is perfect for the Chromebook. It is a Cloud9 v2 descendant with extras. You can use it by hosting a Pylon web server on the Raspberry Pi and accessing it in your browser.

Setup

Pylon requires Node.js (with version 10.20.1 or later), g++, make, and python. You will also need npm to install the node dependencies. You should have everything but Node.js installed by default. To install Node.js and npm:

# apt-get install nodejs npm

Note: commands starting with # should be run as root, and commands starting with $ should be run as a normal user.

After you install all of those dependencies, you can download Pylon and it's Node.js dependencies.

$ git clone https://github.com/pylonide/pylon.git
$ cd pylon
$ npm install

After that, you are ready to start using Pylon!

Usage

To start the server, you can run:

$ bin/pylon.sh

However, you will probably want to specify some options.

You can change which IP to listen to with the -l option. You should use 0.0.0.0 to be able to access Pylon from any device. However, it is recommended that you add authentication too. You can use the --username and --password options to set the username and password. You can also change which directory will be Pylon's workspace directory with the -w option. You can change the port where Pylon will listen. The default port is 3131 if you do not specify one. Here is an example for starting a Pylon server listening on 0.0.0.0 with username pi and password raspberry with the user's home directory as the workspace.

$ bin/pylon.sh -w ~ -l 0.0.0.0 --username pi --password raspberry

Then I can access Pylon with mDNS or using the Raspberry Pi's IP address. Here is an example link with mDNS, if your Raspberry Pi's device name is raspberrypi (default) and the device you are accessing from supports mDNS and you used the default port this link should take you to your Pylon IDE.

raspberrypi.local:3131

Then you can login with your username and password (if you set one up)

If you would like to use a form login page (I recommend this) then open the configs/default.js in nano. Scroll all the way down to the bottom of the file, and change "./pylon.connect.basic-auth" to "./pylon.connect.form-auth".

Run on Startup

Maybe you want to run the Pylon server when starting up your Raspberry Pi. You can do that with crontab. You should put your command to start up Pylon in an sh file. Don't forget to add

#!/bin/sh

at the top of your sh file, and add +x to it with chmod. I made a start.sh file in my pylon folder.

Then, access your crontab file with:

crontab -e

If it is your first time editing crontab it might ask you to choose an editor. Choose nano. Then, at the bottom of the screen, type @reboot /path/to/script.sh &

Here is an example:

@reboot ~/pylon/start.sh &

Don't forget the & at the end. Save the file and close nano and crontab will be ready to start the Pylon server when starting up your Raspberry Pi.

Crontab and Screen

You might want to use screen instead (I recommend this). First you will need to install screen with apt.

# apt-get install screen

Then you can edit crontab like above, but we will change out pylon line. You also need to edit your start.sh to use the full path (from / or ~) instead of relative. Here is an example if I have pylon in my home directory:

#!/bin/sh
~/pylon/bin/pylon.sh -l 0.0.0.0 --username pi --password raspberry -w ~

Then you can open up your crontab file and use this line:

@reboot screen -S pylon -d -m ~/pylon/start.sh

Using & at the end of the line is not necessary if you are creating a detached screen. Save and close the crontab file and now a detached screen running a Pylon server will be created when you start the Raspberry Pi.